--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jusercore.exceptions;
+
+import java.text.MessageFormat;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An exception thrown when the entered password did not match the stored
+ * password.
+ * <p>
+ * @author Roland Haeder
+ */
+public class UserPasswordMismatchException extends Exception {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 97_283_567_871_569_401L;
+
+ /**
+ * Creates an exception with given user instance
+ * <p>
+ * @param user User instance
+ */
+ public UserPasswordMismatchException (final User user) {
+ super(MessageFormat.format("Password for user {0} does not match stored password.", user));
+ }
+}
package org.mxchange.jusercore.model.user;
import java.util.Calendar;
+import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
this.setUserLocked(user.getUserLocked());
}
+ @Override
+ public boolean equals (final Object object) {
+ if (object == null) {
+ return false;
+ }
+ if (getClass() != object.getClass()) {
+ return false;
+ }
+
+ final User other = (User) object;
+
+ return Objects.equals(this.getUserName(), other.getUserName());
+ }
+
@Override
public UserAccountStatus getUserAccountStatus () {
return this.userAccountStatus;
public void setUserName (final String userName) {
this.userName = userName;
}
+
+ @Override
+ public int hashCode () {
+ int hash = 5;
+ hash = 83 * hash + Objects.hashCode(this.getUserName());
+ return hash;
+ }
}
* @param customerNumber User number
*/
public void setUserName (final String customerNumber);
+
+ /**
+ * Checks if object is a User instance and whether it matches with this
+ * object.
+ * <p>
+ * @param object Object to be checked
+ * @return Whether it matches this object
+ */
+ @Override
+ public boolean equals (final Object object);
+
+ /**
+ * Hash code caluclation for this object
+ * <p>
+ * @return Hash code for this object
+ */
+ @Override
+ public int hashCode ();
}