package org.mxchange.addressbook.beans.user;
import java.io.Serializable;
-import java.util.Date;
import java.util.List;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
+import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
+import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
public interface AddressbookUserWebSessionController extends Serializable {
/**
- * Tries to lookup user by given id number. If the user is not found or the
- * account status is not CONFIRMED proper exceptions are thrown.
- * <p>
- * @param userId User id
- * <p>
- * @return User instance
- * <p>
- * @throws UserNotFoundException If the user is not found
- */
- User lookupUserById (final Long userId) throws UserNotFoundException;
-
- /**
- * Event observer for new user registrations
- * <p>
- * @param event User registration event
- */
- void afterRegistrationEvent (final UserRegisteredEvent event);
-
- /**
- * Event observer for logged-in user
- * <p>
- * @param event Event instance
- */
- void afterUserLogin (final UserLoggedInEvent event);
-
- /**
- * All public user profiles
- * <p>
- * @return A list of all public user profiles
- */
- List<User> allVisibleUsers ();
-
- /**
- * Creates an instance from all properties
- * <p>
- * @return A user instance
- */
- User createUserInstance ();
-
- /**
- * Getter for birth day
- * <p>
- * @return Birth day
- */
- Date getBirthday ();
-
- /**
- * Setter for birth day
- * <p>
- * @param birthday Birth day
- */
- void setBirthday (final Date birthday);
-
- /**
- * Getter for ellphone number's carrier
- * <p>
- * @return Cellphone number's carrier
- */
- SmsProvider getCellphoneCarrier ();
-
- /**
- * Setter for cellphone number's carrier prefix
- * <p>
- * @param cellphoneCarrier Cellphone number's carrier prefix
- */
- void setCellphoneCarrier (final SmsProvider cellphoneCarrier);
-
- /**
- * Getter for ellphone number
- * <p>
- * @return Cellphone number
- */
- Long getCellphoneNumber ();
-
- /**
- * Setter for ellphone number
- * <p>
- * @param cellphoneNumber Cellphone number
- */
- void setCellphoneNumber (final Long cellphoneNumber);
-
- /**
- * City
- * <p>
- * @return the city
- */
- String getCity ();
-
- /**
- * City
- * <p>
- * @param city the city to set
- */
- void setCity (final String city);
-
- /**
- * Getter for comments
- * <p>
- * @return Comments
- */
- String getComment ();
-
- /**
- * Setter for comment
- * <p>
- * @param comment Comments
- */
- void setComment (final String comment);
-
- /**
- * Getter for country instance
- * <p>
- * @return Country instance
- */
- Country getCountry ();
-
- /**
- * Setter for country instance
- * <p>
- * @param country Country instance
- */
- void setCountry (final Country country);
-
- /**
- * Getter for email address
- * <p>
- * @return Email address
- */
- String getEmailAddress ();
-
- /**
- * Setter for email address
- * <p>
- * @param emailAddress Email address
- */
- void setEmailAddress (final String emailAddress);
-
- /**
- * Getter for email address 1 (changing)
- * <p>
- * @return Email address
- */
- String getEmailAddress1 ();
-
- /**
- * Setter for email address 1 (changing)
- * <p>
- * @param emailAddress1 Email address 1
- */
- void setEmailAddress1 (final String emailAddress1);
-
- /**
- * Getter for email address 2 (repeat changing)
- * <p>
- * @return Email address 2
- */
- String getEmailAddress2 ();
-
- /**
- * Setter for email address 2 (repeat changing)
- * <p>
- * @param emailAddress2 Email address 2
- */
- void setEmailAddress2 (final String emailAddress2);
-
- /**
- * Getter for email address, repeated
- * <p>
- * @return the emailAddress, repeated
- */
- String getEmailAddressRepeat ();
-
- /**
- * Setter for email address repeated
- * <p>
- * @param emailAddressRepeat the emailAddress to set
- */
- void setEmailAddressRepeat (final String emailAddressRepeat);
-
- /**
- * Family name
- * <p>
- * @return the familyName
- */
- String getFamilyName ();
-
- /**
- * Family name
- * <p>
- * @param familyName the familyName to set
+ * Minimum password length
*/
- void setFamilyName (final String familyName);
+ public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
/**
- * Getter for fax number's area code
+ * Observes events being fired when an administrator has added a new
+ * contact.
* <p>
- * @return Fax number's area code
+ * @param event Event being fired
*/
- Integer getFaxAreaCode ();
+ void afterAdminAddedContact (final AdminAddedContactEvent event);
/**
- * Setter for fax number's area code
+ * Event observer for newly added users by adminstrator
* <p>
- * @param faxAreaCode Fax number's area code
+ * @param event Event being fired
*/
- void setFaxAreaCode (final Integer faxAreaCode);
+ void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
/**
- * Getter for fax's country instance
+ * Event observer for updated user data by administrator
* <p>
- * @return Fax' country instance
+ * @param event Event being updated
*/
- Country getFaxCountry ();
+ void afterAdminUpdatedUserDataEvent (final AdminUpdatedUserDataEvent event);
/**
- * Setter for fax's country instance
+ * Listens to fired event when user updated personal data
* <p>
- * @param faxCountry Fax' country instance
+ * @param event Event being fired
*/
- void setFaxCountry (final Country faxCountry);
+ void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
/**
- * Getter for fax number
+ * Event observer for new user registrations
* <p>
- * @return Fax number
+ * @param event User registration event
*/
- Long getFaxNumber ();
+ void afterRegistrationEvent (final UserRegisteredEvent event);
/**
- * Setter for fax number
+ * Event observer for logged-in user
* <p>
- * @param faxNumber Fax number
+ * @param event Event instance
*/
- void setFaxNumber (final Long faxNumber);
+ void afterUserLogin (final UserLoggedInEvent event);
/**
- * First name
+ * All users
* <p>
- * @return the first name
+ * @return A list of all public user profiles
*/
- String getFirstName ();
+ List<User> allUsers ();
/**
- * First name
+ * All public user profiles
* <p>
- * @param firstName the first name to set
+ * @return A list of all public user profiles
*/
- void setFirstName (final String firstName);
+ List<User> allVisibleUsers ();
/**
- * Gender of the contact
+ * Checks whether users are registered
* <p>
- * @return the gender
+ * @return Whether users are registered
*/
- Gender getGender ();
+ boolean hasUsers ();
/**
- * Gender of the contact
+ * Checks whether the given contact is a user
* <p>
- * @param gender the gender to set
- */
- void setGender (final Gender gender);
-
- /**
- * House number
+ * @param contact Contact to check
* <p>
- * @return the houseNumber
+ * @return Whether the contact is a user
*/
- Short getHouseNumber ();
+ boolean isContactFound (final Contact contact);
/**
- * House number
+ * Checks whether a public user account is registered. This means that at
+ * least one user profile has its flag "public user profile" enabled.
* <p>
- * @param houseNumber the houseNumber to set
+ * @return Whether at least one user has a public profile
*/
- void setHouseNumber (final Short houseNumber);
+ boolean isVisibleUserFound ();
/**
- * Getter for phone number's area code
+ * Checks whether given user instance's name is used
* <p>
- * @return Phone number's area code
- */
- Integer getPhoneAreaCode ();
-
- /**
- * Setter for phone number's area code
+ * @param user User instance's name to check
* <p>
- * @param phoneAreaCode Phone number's area code
+ * @return Whether it is already used
*/
- void setPhoneAreaCode (final Integer phoneAreaCode);
+ boolean isUserNameRegistered (final User user);
/**
- * Getter for phone number's country instance
+ * Tries to lookup user by given id number. If the user is not found or the
+ * account status is not CONFIRMED proper exceptions are thrown.
* <p>
- * @return Phone number's country instance
- */
- Country getPhoneCountry ();
-
- /**
- * Setter for phone number's country instance
+ * @param userId User id
* <p>
- * @param phoneCountry Phone number's country instance
- */
- void setPhoneCountry (final Country phoneCountry);
-
- /**
- * Getter for phone number
+ * @return User instance
* <p>
- * @return Phone number
+ * @throws UserNotFoundException If the user is not found
*/
- Long getPhoneNumber ();
+ User lookupUserById (final Long userId) throws UserNotFoundException;
/**
- * Setter for phone number
+ * Returns a list of all selectable contacts for user creation. Contacts
+ * from already existing users are excluded in this list.
* <p>
- * @param phoneNumber Phone number
+ * @return A list of all selectable contacts
*/
- void setPhoneNumber (final Long phoneNumber);
+ List<Contact> selectableContacts ();
/**
- * Street
+ * Creates an instance from all properties
* <p>
- * @return the street
+ * @return A user instance
*/
- String getStreet ();
+ User createUserInstance ();
/**
- * Street
+ * Creates a user instance for login phase
* <p>
- * @param street the street to set
+ * @return User instance
*/
- void setStreet (final String street);
+ User createUserLogin ();
/**
* Getter for user id
*/
void setUserProfileMode (final ProfileMode userProfileMode);
- /**
- * ZIP code
- * <p>
- * @return the zipCode
- */
- Integer getZipCode ();
-
- /**
- * ZIP code
- * <p>
- * @param zipCode the zipCode to set
- */
- void setZipCode (final Integer zipCode);
-
- /**
- * Checks whether user instance's email address is used
- * <p>
- * @param user User instance's email address to check
- * <p>
- * @return Whether it is already used
- */
- boolean isEmailAddressRegistered (final User user);
-
/**
* Checks whether all required personal data is set
* <p>
*/
boolean isRequiredChangePersonalDataSet ();
- /**
- * Checks whether same email addresses have been entered
- * <p>
- * @return Whether same email addresses have been entered
- */
- boolean isSameEmailAddressEntered ();
-
/**
* Checks whether same passwords has been entered
* <p>
boolean isSamePasswordEntered ();
/**
- * Checks whether given user instance's name is used
+ * Checks if the user id is empty
* <p>
- * @param user User instance's name to check
+ * @return Whether the user id is empty
+ */
+ boolean isUserIdEmpty ();
+
+ /**
+ * Changes logged-in user's personal data if the current password matches
+ * and TAC + privacy statement has been accepted.
* <p>
- * @return Whether it is already used
+ * @return New target page
*/
- boolean isUserNameRegistered (final User user);
+ String doChangePersonalData ();
/**
- * Checks whether a public user account is registered. This means that at
- * least one user profile has its flag "public user profile" enabled.
+ * Checks whether this application requires a user name to be entered.
+ * Otherwise a random name like "userXXXXX" is generated
* <p>
- * @return Whether at least one user has a public profile
+ * @return Whether this application requires a user name
*/
- boolean isVisibleUserFound ();
+ boolean isUserNameRequired ();
/**
- * Checks if the user id is empty
+ * Checks wether public user profiles are enabled. This requires that user
+ * names are also enabled.
* <p>
- * @return Whether the user id is empty
+ * @return Whether public user profiles are enabled
*/
- boolean isUserIdEmpty ();
+ boolean isPublicUserProfileEnabled ();
}