Alexander Wels has uploaded a new change for review.

Change subject: webadmin: cluster equals
......................................................................

webadmin: cluster equals

- Fixed cluster equals to return true when two clusters are
  actually equals. This causes loading indicators to show on
  automatic refreshes.

Change-Id: Iab51ef7ac2e456988b640378d3ab0ea98039af7f
Signed-off-by: Alexander Wels <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroupHostsAndVMs.java
2 files changed, 46 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/28957/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
index c42a63b..63612a0 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
@@ -4,6 +4,7 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 
@@ -99,7 +100,7 @@
     @Size(max = BusinessEntitiesDefinitions.VM_SERIAL_NUMBER_SIZE)
     private String customSerialNumber;
 
-    private Set<VmRngDevice.Source> requiredRngSources;
+    private final Set<VmRngDevice.Source> requiredRngSources;
 
     public VDSGroup() {
         migrateOnError = MigrateOnErrorOptions.YES;
@@ -350,18 +351,22 @@
         this.spiceProxy = spiceProxy;
     }
 
+    @Override
     public String getCustomSerialNumber() {
         return customSerialNumber;
     }
 
+    @Override
     public void setCustomSerialNumber(String customSerialNumber) {
         this.customSerialNumber = customSerialNumber;
     }
 
+    @Override
     public SerialNumberPolicy getSerialNumberPolicy() {
         return serialNumberPolicy;
     }
 
+    @Override
     public void setSerialNumberPolicy(SerialNumberPolicy serialNumberPolicy) {
         this.serialNumberPolicy = serialNumberPolicy;
     }
@@ -424,6 +429,8 @@
             return false;
         }
         VDSGroup other = (VDSGroup) obj;
+        // *ATTENTION* when adding fields to this, please make sure that 
equals still works, if not this will
+        // cause all kinds of havoc in the UI when clusters are refreshed.
         return (ObjectUtils.objectsEqual(id, other.id)
                 && ObjectUtils.objectsEqual(compatVersion, other.compatVersion)
                 && ObjectUtils.objectsEqual(compatibility_version, 
other.compatibility_version)
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroupHostsAndVMs.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroupHostsAndVMs.java
index 7dbc3ba..c005c43 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroupHostsAndVMs.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroupHostsAndVMs.java
@@ -36,4 +36,42 @@
         this.vms = vms;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + hosts;
+        result = prime * result + ((vdsGroupId == null) ? 0 : 
vdsGroupId.hashCode());
+        result = prime * result + vms;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        VDSGroupHostsAndVMs other = (VDSGroupHostsAndVMs) obj;
+        if (hosts != other.hosts) {
+            return false;
+        }
+        if (vdsGroupId == null) {
+            if (other.vdsGroupId != null) {
+                return false;
+            }
+        } else if (!vdsGroupId.equals(other.vdsGroupId)) {
+            return false;
+        }
+        if (vms != other.vms) {
+            return false;
+        }
+        return true;
+    }
+
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab51ef7ac2e456988b640378d3ab0ea98039af7f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to