]> git.mxchange.org Git - juser-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 16 Apr 2020 22:23:15 +0000 (00:23 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 16 Apr 2020 22:23:15 +0000 (00:23 +0200)
- don't use primary key in equals()/hashCode() methods, better try to distinct
  entities with other properties

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java
src/org/mxchange/jusercore/model/user/LoginUser.java

index 58c1cfb1fdf03d7a7886f1b65227390ed9ea08f1..35454861390da6bf501d634681bc4b04f8bf919e 100644 (file)
@@ -167,9 +167,11 @@ public class EmailAddressChange implements ChangeableEmailAddress {
 
                final ChangeableEmailAddress otherEmail = (ChangeableEmailAddress) object;
 
-               if (!Objects.equals(this.getEmailChangeId(), otherEmail.getEmailChangeId())) {
+               if (!Objects.equals(this.getEmailAddress(), otherEmail.getEmailAddress())) {
                        return false;
-               } else if (!Objects.equals(this.getEmailAddress(), otherEmail.getEmailAddress())) {
+               } else if (!Objects.equals(this.getEmailChangeHash(), otherEmail.getEmailChangeHash())) {
+                       return false;
+               } else if (!Objects.equals(this.getEmailChangeStatus(), otherEmail.getEmailChangeStatus())) {
                        return false;
                } else if (!Objects.equals(this.getEmailChangeUser(), otherEmail.getEmailChangeUser())) {
                        return false;
@@ -256,8 +258,9 @@ public class EmailAddressChange implements ChangeableEmailAddress {
        public int hashCode () {
                int hash = 5;
 
-               hash = 71 * hash + Objects.hashCode(this.getEmailChangeId());
                hash = 71 * hash + Objects.hashCode(this.getEmailAddress());
+               hash = 71 * hash + Objects.hashCode(this.getEmailChangeHash());
+               hash = 71 * hash + Objects.hashCode(this.getEmailChangeStatus());
                hash = 71 * hash + Objects.hashCode(this.getEmailChangeUser());
 
                return hash;
index 2cfbf4a351bc7e77008432cda262a5cbda514831..436d17c7cb5ae72e5640d9b4f514bfc8aebdcc5d 100644 (file)
@@ -258,7 +258,13 @@ public class LoginUser implements User {
 
                if (!Objects.equals(this.getUserName(), other.getUserName())) {
                        return false;
-               } else if (!Objects.equals(this.getUserId(), other.getUserId())) {
+               } else if (!Objects.equals(this.getUserConfirmKey(), other.getUserConfirmKey())) {
+                       return false;
+               } else if (!Objects.equals(this.getUserAccountStatus(), other.getUserAccountStatus())) {
+                       return false;
+               } else if (!Objects.equals(this.getUserContact(), other.getUserContact())) {
+                       return false;
+               } else if (!Objects.equals(this.getUserProfileMode(), other.getUserProfileMode())) {
                        return false;
                }
 
@@ -404,8 +410,13 @@ public class LoginUser implements User {
        @Override
        public int hashCode () {
                int hash = 5;
+
                hash = 83 * hash + Objects.hashCode(this.getUserName());
-               hash = 83 * hash + Objects.hashCode(this.getUserId());
+               hash = 83 * hash + Objects.hashCode(this.getUserConfirmKey());
+               hash = 83 * hash + Objects.hashCode(this.getUserAccountStatus());
+               hash = 83 * hash + Objects.hashCode(this.getUserContact());
+               hash = 83 * hash + Objects.hashCode(this.getUserProfileMode());
+
                return hash;
        }