]> git.mxchange.org Git - juser-core.git/blobdiff - src/org/mxchange/jusercore/model/user/LoginUser.java
Continued:
[juser-core.git] / src / org / mxchange / jusercore / model / user / LoginUser.java
index 865594efc9df0bc0ca5a9751a8fe412bec0b9a9b..d6de5bf9a24a69c44f20abb5ddfc61aa31665f14 100644 (file)
@@ -39,6 +39,7 @@ import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.UserContact;
+import org.mxchange.jcontacts.model.utils.ContactUtils;
 import org.mxchange.jcoreutils.Comparables;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
@@ -220,8 +221,8 @@ public class LoginUser implements User {
                // Checkparameter and return 0 if equal
                if (null == user) {
                        // Should not happen
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.equals(this)) {
+                       throw new NullPointerException("Parameter 'user' is null"); //NOI18N
+               } else if (Objects.equals(this, user)) {
                        // Same object
                        return 0;
                }
@@ -229,7 +230,7 @@ public class LoginUser implements User {
                // Init comparitors
                final int comparitors[] = {
                        // First contact
-                       this.getUserContact().compareTo(user.getUserContact()),
+                       ContactUtils.compare(this.getUserContact(), user.getUserContact()),
                        // ... then user name
                        this.getUserName().compareTo(user.getUserName())
                };
@@ -253,14 +254,20 @@ public class LoginUser implements User {
 
                if (!Objects.equals(this.getUserName(), user.getUserName())) {
                        return false;
+               } else if (!Objects.equals(this.getUserAccountStatus(), user.getUserAccountStatus())) {
+                       return false;
                } else if (!Objects.equals(this.getUserConfirmKey(), user.getUserConfirmKey())) {
                        return false;
-               } else if (!Objects.equals(this.getUserAccountStatus(), user.getUserAccountStatus())) {
+               } else if (!Objects.equals(this.getUserId(), user.getUserId())) {
                        return false;
-               } else if (!Objects.equals(this.getUserContact(), user.getUserContact())) {
+               } else if (!Objects.equals(this.getUserMustChangePassword(), user.getUserMustChangePassword())) {
+                       return false;
+               } else if (!Objects.equals(this.getUserName(), user.getUserName())) {
                        return false;
                } else if (!Objects.equals(this.getUserProfileMode(), user.getUserProfileMode())) {
                        return false;
+               } else if (!Objects.equals(this.getUserContact(), user.getUserContact())) {
+                       return false;
                }
 
                return true;
@@ -407,10 +414,12 @@ public class LoginUser implements User {
                int hash = 5;
 
                hash = 83 * hash + Objects.hashCode(this.getUserName());
-               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.getUserConfirmKey());
+               hash = 83 * hash + Objects.hashCode(this.getUserId());
+               hash = 83 * hash + Objects.hashCode(this.getUserMustChangePassword());
                hash = 83 * hash + Objects.hashCode(this.getUserProfileMode());
+               hash = 83 * hash + Objects.hashCode(this.getUserContact());
 
                return hash;
        }