this.userProfileMode = ProfileMode.INVISIBLE;
}
- @Override
- public void copyAll (final User user) {
- // Is contact set?
- if (user.getUserContact() instanceof Contact) {
- // Copy also contact data
- this.getUserContact().copyAll(user.getUserContact());
- }
-
- // Copy other data
- this.setUserConfirmKey(user.getUserConfirmKey());
- this.setUserName(user.getUserName());
- this.setUserEncryptedPassword(user.getUserEncryptedPassword());
- this.setUserAccountStatus(user.getUserAccountStatus());
- this.setUserCreated(user.getUserCreated());
- this.setUserLastLocked(user.getUserLastLocked());
- this.setUserLastLockedReason(user.getUserLastLockedReason());
- this.setUserUpdated(user.getUserUpdated());
- this.setUserProfileMode(user.getUserProfileMode());
- this.setUserLocale(user.getUserLocale());
- this.setUserMustChangePassword(user.getUserMustChangePassword());
- }
-
@Override
public boolean equals (final Object object) {
if (null == object) {
}
/**
- * Determines given password's strength: 0 = worst, 100 = best. This method is
- * based on
+ * Determines given password's strength: 0 = worst, 100 = best. This method
+ * is based on
* http://stackoverflow.com/questions/1614811/how-do-i-measure-the-strength-of-a-password
* <p>
* @param password Clear-text password
return score;
}
+ /**
+ * Copies all attributes from other user object to target
+ * <p>
+ * @param sourceUser Source instance
+ * @param targetUser Target instance
+ */
+ public static void copyAll (final User sourceUser, final User targetUser) {
+ // Check all parameter
+ if (null == sourceUser) {
+ // Throw NPE
+ throw new NullPointerException("sourceUser is null"); //NOI18N
+ } else if (null == targetUser) {
+ // Throw NPE
+ throw new NullPointerException("targetUser is null"); //NOI18N
+ }
+
+ // Is contact set?
+ if (sourceUser.getUserContact() instanceof Contact) {
+ // Copy also contact data
+ targetUser.getUserContact().copyAll(sourceUser.getUserContact());
+ }
+
+ // Copy other data
+ targetUser.setUserConfirmKey(sourceUser.getUserConfirmKey());
+ targetUser.setUserName(sourceUser.getUserName());
+ targetUser.setUserEncryptedPassword(sourceUser.getUserEncryptedPassword());
+ targetUser.setUserAccountStatus(sourceUser.getUserAccountStatus());
+ targetUser.setUserCreated(sourceUser.getUserCreated());
+ targetUser.setUserLastLocked(sourceUser.getUserLastLocked());
+ targetUser.setUserLastLockedReason(sourceUser.getUserLastLockedReason());
+ targetUser.setUserUpdated(sourceUser.getUserUpdated());
+ targetUser.setUserProfileMode(sourceUser.getUserProfileMode());
+ targetUser.setUserLocale(sourceUser.getUserLocale());
+ targetUser.setUserMustChangePassword(sourceUser.getUserMustChangePassword());
+ }
+
/**
* Creates a pseudo-random password with given length
* <p>
* Checks if direct password the updatedUser's password
* <p>
* @param clearTextPassword Clear-text (direct) password
- * @param updatedUser Updated user instance from database
+ * @param updatedUser Updated user instance from database
* <p>
* @return Whether the password matches
*/