summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-domain/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-domain/src/main')
-rw-r--r--ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java
index 4eebb02f..aff5b1f1 100644
--- a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java
+++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java
@@ -2,7 +2,7 @@
* ============LICENSE_START==========================================
* ONAP Portal SDK
* ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
@@ -91,33 +91,26 @@ public class UserApp implements java.io.Serializable, Comparable {
return (this.getUserId().equals(castOther.getUserId()))
&& (this.getApp().getId().equals(castOther.getApp().getId()))
- && (this.getRole().getId().equals(castOther.getRole().getId()))
+ && (this.getRole().getId() != null ? this.getRole().getId().equals(castOther.getRole().getId()) : this.getRole().getName().equals(castOther.getRole().getName()))
&& ((this.priority == null && castOther.getPriority() == null)
|| this.getPriority().equals(castOther.getPriority()));
}
@Override
public int hashCode() {
- int result = 17;
- result = 37 * result + (int) (this.getUserId() == null ? 0 : this.getUserId().intValue());
- result = 37 * result + (int) (this.getApp().getId() == null ? 0 : this.getApp().getId().intValue());
- result = 37 * result + (int) (this.getRole().getId() == null ? 0 : this.getRole().getId().intValue());
+ Long result = 17l;
+ result = 37 * result + (int) (this.getUserId() == null ? 0 : this.getUserId().hashCode());
+ result = 37 * result + (int) (this.getApp().getId() == null ? 0 : this.getApp().getId().hashCode());
+ result = 37 * result + (int) (this.getRole().getId() == null ? (this.getRole().getName() == null ? 0 : this.getRole().getName().hashCode() ) : this.getRole().getId().hashCode());
result = 37 * result + (int) (this.priority == null ? 0 : this.priority);
- return result;
+ return Long.hashCode(result);
}
@Override
public int compareTo(Object other) {
UserApp castOther = (UserApp) other;
- Long c1 = (this.getUserId() == null ? 0 : this.getUserId())
- + (this.getApp() == null || this.getApp().getId() == null ? 0 : this.getApp().getId())
- + (this.getRole() == null || this.getRole().getId() == null ? 0 : this.getRole().getId())
- + (this.priority == null ? 0 : this.priority);
- Long c2 = (castOther.getUserId() == null ? 0 : castOther.getUserId())
- + (castOther.getApp() == null || castOther.getApp().getId() == null ? 0 : castOther.getApp().getId())
- + (castOther.getRole() == null || castOther.getRole().getId() == null ? 0 : castOther.getRole().getId())
- + (castOther.priority == null ? 0 : castOther.priority);
- return c1.compareTo(c2);
+ int c1 = this.hashCode() - castOther.hashCode();
+ return c1;
}
}