Daniel Erez has uploaded a new change for review. Change subject: core: add equals to CinderDisk and CinderConnectionInfo ......................................................................
core: add equals to CinderDisk and CinderConnectionInfo Adding an equals method for CinderDisk and CinderConnectionInfo. Change-Id: If38042f849e7ca791cb359f6eb9c974edddb0c71 Bug-Url: https://bugzilla.redhat.com/1185826 Signed-off-by: Daniel Erez <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderConnectionInfo.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderDisk.java 2 files changed, 28 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/40013/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderConnectionInfo.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderConnectionInfo.java index afef3a5..fb0917c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderConnectionInfo.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderConnectionInfo.java @@ -46,5 +46,24 @@ " data=" + data + "]"; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CinderConnectionInfo that = (CinderConnectionInfo) o; + + if (driverVolumeType != null ? !driverVolumeType.equals(that.driverVolumeType) : that.driverVolumeType != null) + return false; + return !(data != null ? !data.equals(that.data) : that.data != null); + + } + + @Override + public int hashCode() { + int result = driverVolumeType != null ? driverVolumeType.hashCode() : 0; + result = 31 * result + (data != null ? data.hashCode() : 0); + return result; + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderDisk.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderDisk.java index 23ace39..619c703 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderDisk.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/CinderDisk.java @@ -1,5 +1,7 @@ package org.ovirt.engine.core.common.businessentities.storage; +import org.ovirt.engine.core.common.utils.ObjectUtils; + public class CinderDisk extends DiskImage { CinderConnectionInfo cinderConnectionInfo; @@ -21,4 +23,11 @@ public void setCinderConnectionInfo(CinderConnectionInfo cinderConnectionInfo) { this.cinderConnectionInfo = cinderConnectionInfo; } + + @Override + public boolean equals(Object obj) { + CinderDisk cinderDisk = (CinderDisk) obj; + return super.equals(obj) + && ObjectUtils.objectsEqual(cinderConnectionInfo, cinderDisk.getCinderConnectionInfo()); + } } -- To view, visit https://gerrit.ovirt.org/40013 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If38042f849e7ca791cb359f6eb9c974edddb0c71 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Daniel Erez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
