Allon Mureinik has uploaded a new change for review.

Change subject: core: ImagesHandler: filterImageDisks readability
......................................................................

core: ImagesHandler: filterImageDisks readability

Improved readability of ImagesHandler.filterImageDisks:
1. Reordered the evaluated conditions
2. Changed the terminology from "filter", which may be ambiguous to
   "allowOnly".

Change-Id: I7cc2fc314e05fda6b1c6cdf39365b64fa0cfe345
Signed-off-by: Allon Mureinik <amure...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/18/12318/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
index 757cd02..23b78a2 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
@@ -591,19 +591,23 @@
 
     /**
      * Filter image disks by attributes.
-     * @param listOfDisks - The list of disks to be filtered.
-     * @param filterNotShareableDisks - Indication whether to filter disks 
which are not shareable.
-     * @param filterAllowSnapshotDisks - Indication whether to filter disks 
which are allowed to be snapshot.
+     *
+     * @param listOfDisks
+     *            - The list of disks to be filtered.
+     * @param allowOnlyNotShareableDisks
+     *            - Indication whether to allow only disks that are not 
shareable
+     * @param allowOnlyAllowSnapshotDisks
+     *            - Indication whether to allow only disks which are allowed 
to be snapshoted.
      * @return - List filtered of disk images.
      */
     public static List<DiskImage> filterImageDisks(Collection<? extends Disk> 
listOfDisks,
-            boolean filterNotShareableDisks,
-            boolean filterAllowSnapshotDisks) {
+            boolean allowOnlyNotShareableDisks,
+            boolean allowOnlyAllowSnapshotDisks) {
         List<DiskImage> diskImages = new ArrayList<DiskImage>();
         for (Disk disk : listOfDisks) {
-            if ((!filterNotShareableDisks || !disk.isShareable())
-                    && disk.getDiskStorageType() == DiskStorageType.IMAGE &&
-                    (!filterAllowSnapshotDisks || disk.isAllowSnapshot())) {
+            if (disk.getDiskStorageType() == DiskStorageType.IMAGE &&
+                    (!allowOnlyNotShareableDisks || !disk.isShareable()) &&
+                    (!allowOnlyAllowSnapshotDisks || disk.isAllowSnapshot())) {
                 diskImages.add((DiskImage) disk);
             }
         }


--
To view, visit http://gerrit.ovirt.org/12318
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7cc2fc314e05fda6b1c6cdf39365b64fa0cfe345
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to