/**
* Whether the user must change password after login
*/
- @Column (name = "user_must_change_password")
+ @Basic (optional = false)
+ @Column (name = "user_must_change_password", nullable = false)
private Boolean userMustChangePassword;
/**
this.userProfileMode = ProfileMode.INVISIBLE;
}
+ /**
+ * Constructor with all required fields
+ * <p>
+ * @param userName Username
+ * @param userProfileMode Profile mode
+ * @param userMustChangePassword Whether user must change password
+ * @param userEncryptedPassword Encrypted password
+ * @param userAccountStatus Account status
+ * @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
+ this();
+
+ // Validate all parameter
+ if (null == userName) {
+ // Throw NPE
+ throw new NullPointerException("userName is null"); //NOI18N
+ } else if (userName.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("userName is empty"); //NOI18N
+ } else if (null == userProfileMode) {
+ // Throw NPE
+ throw new NullPointerException("userProfileMode is null"); //NOI18N
+ } else if (null == userMustChangePassword) {
+ // Throw it again
+ throw new NullPointerException("userMustChangePassword is null"); //NOI18N
+ } else if (null == userEncryptedPassword) {
+ // Throw it again
+ throw new NullPointerException("userEncryptedPassword is null"); //NOI18N
+ } else if (userEncryptedPassword.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("userEncryptedPassword is empty"); //NOI18N
+ } else if (null == userAccountStatus) {
+ // Throw NPE
+ throw new NullPointerException("userAccountStatus is null"); //NOI18N
+ } else if (null == userContact) {
+ // Throw it again
+ throw new NullPointerException("userContact is null"); //NOI18N
+ }
+
+ // Set all fields
+ this.userAccountStatus = userAccountStatus;
+ this.userEncryptedPassword = userEncryptedPassword;
+ this.userMustChangePassword = userMustChangePassword;
+ this.userName = userName;
+ this.userProfileMode = userProfileMode;
+ this.userContact = userContact;
+ }
+
@Override
public boolean equals (final Object object) {
if (null == object) {