import java.io.Serializable;
import java.security.SecureRandom;
import java.text.MessageFormat;
+import java.util.Properties;
import java.util.Random;
import org.apache.commons.codec.digest.Crypt;
import org.apache.commons.codec.digest.DigestUtils;
return hash;
}
+ /**
+ * Returns a Properties object from given user instance.
+ * <p>
+ * @param user User instance to get all fields from
+ * <p>
+ * @return All properties from given user
+ */
+ public static Properties getAllUserFields (final User user) {
+ // Parameter should be valid
+ if (null == user) {
+ // Throw NPE
+ throw new NullPointerException("user is null");
+ }
+
+ // Init properties list
+ Properties properties = new Properties();
+
+ // Set all:
+ // - User data
+ properties.setProperty("userId", Long.toString(user.getUserId()));
+ properties.setProperty("userName", user.getUserName());
+ properties.setProperty("userConfirmKey", user.getUserConfirmKey());
+ properties.setProperty("userLastLockedReason", user.getUserLastLockedReason());
+ properties.setProperty("userAccountStatus", user.getUserAccountStatus().toString());
+
+ // - Contact data
+ properties.setProperty("contactGender", user.getUserContact().getContactGender().toString());
+ properties.setProperty("contactTitle", user.getUserContact().getContactTitle());
+ properties.setProperty("contactFirstName", user.getUserContact().getContactFirstName());
+ properties.setProperty("contactFamilyName", user.getUserContact().getContactFamilyName());
+ properties.setProperty("contactStreet", user.getUserContact().getContactStreet());
+ properties.setProperty("contactHouseNumber", Short.toString(user.getUserContact().getContactHouseNumber()));
+ properties.setProperty("contacCity", user.getUserContact().getContactCity());
+ properties.setProperty("contactZipCode", Integer.toString(user.getUserContact().getContactZipCode()));
+ properties.setProperty("contactBirthday", user.getUserContact().getContactBirthday().toString());
+ properties.setProperty("contactEmailAddress", user.getUserContact().getContactEmailAddress());
+ properties.setProperty("contactCreated", user.getUserContact().getContactCreated().toString());
+ properties.setProperty("contactUpdated", user.getUserContact().getContactUpdated().toString());
+
+ // Return it
+ return properties;
+ }
+
/**
* Checks if password from container matches the updatedUser's password
* <p>