import javax.persistence.Transient;
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontacts.model.contact.UserContact;
+import org.mxchange.jcoreee.utils.Comparables;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
@NamedQuery (name = "SearchUserByEmailAddress", query = "SELECT u FROM users AS u INNER JOIN contacts AS c ON u.userContact = c WHERE LOWER(c.contactEmailAddress) LIKE LOWER(:emailAddress)"),
@NamedQuery (name = "SearchUserByConfirmKey", query = "SELECT u FROM users AS u WHERE u.userConfirmKey = :confirmKey"),
@NamedQuery (name = "SearchAllUsersExcept", query = "SELECT u FROM users AS u WHERE u != :user ORDER BY u.userId ASC"),
- @NamedQuery (name = "AllUsers", query = "SELECT u FROM users AS u ORDER BY u.userId ASC"),
- }
+ @NamedQuery (name = "AllUsers", query = "SELECT u FROM users AS u ORDER BY u.userId ASC"),}
)
@SuppressWarnings ("PersistenceUnitPresent")
public class LoginUser implements User {
* @param userMustChangePassword Whether user must change password
* @param userEncryptedPassword Encrypted password
* @param userAccountStatus Account status
- * @param userContact User's contact data
+ * @param userContact User's contact data
*/
public LoginUser (final String userName, final ProfileMode userProfileMode, final Boolean userMustChangePassword, final String userEncryptedPassword, final UserAccountStatus userAccountStatus, final Contact userContact) {
// Call other constructor first
return 0;
}
- // There can only be one user per user name
- return this.getUserName().compareTo(user.getUserName());
+ // Init comparitors
+ final int comparitors[] = {
+ // First contact
+ this.getUserContact().compareTo(user.getUserContact()),
+ // ... then user name
+ this.getUserName().compareTo(user.getUserName())
+ };
+
+ // Check all values
+ final int comparison = Comparables.checkAll(comparitors);
+
+ // Return value
+ return comparison;
}
@Override