this.emailAddressList = new LinkedList<>();
}
- @Override
- public void afterAdminAddedContact (@Observes final ObservableAdminAddedContactEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedContact(): event={0} - CALLED!", event)); //NOI18N
-
+ /**
+ * Observes events being fired when an administrator has added a new
+ * contact.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
// The event must be valid
if (null == event) {
// Throw NPE
this.selectableContacts.add(event.getAddedContact());
}
- @Override
+ /**
+ * Event observer for newly added users by adminstrator
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
// Trace message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedUserEvent(): event={0} - CALLED!", event)); //NOI18N
this.clear();
}
- @Override
- public void afterAdminLinkedUser (@Observes final ObservableAdminLinkedUserEvent event) {
+ /**
+ * Observes events being fired when an administrator has linked a new user
+ * with existing contact data.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
this.clear();
}
- @Override
+ /**
+ * Event observer for updated contact data by administrators
+ * <p>
+ * @param event Updated contact data event
+ */
public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
// event should not be null
if (null == event) {
//* NOISY-DEBUG: */ System.out.println("contactController.afterAdminUpdatedContactDataEvent(): EXIT!"); //NOI18N
}
- @Override
- public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
+ /**
+ * Event observer for new user registrations
+ * <p>
+ * @param event User registration event
+ */
+ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
this.clear();
}
- @Override
+ /**
+ * Event observer when user confirmed account.
+ * <p>
+ * @param event Event being fired
+ */
public void afterUserConfirmedAccount (@Observes final ObservableUserConfirmedAccountEvent event) {
// event should not be null
if (null == event) {
this.uniqueAddContact(event.getConfirmedUser().getUserContact());
}
- @Override
+ /**
+ * Event observer for logged-in user
+ * <p>
+ * @param event Event instance
+ */
public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
// event should not be null
if (null == event) {
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
-import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
/**
* An interface for user beans
*/
List<Contact> allContacts ();
- /**
- * Event observer for newly added users by adminstrator
- * <p>
- * @param event Event being fired
- */
- void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event);
-
- /**
- * Event observer when user confirmed account.
- * <p>
- * @param event Event being fired
- */
- void afterUserConfirmedAccount (final ObservableUserConfirmedAccountEvent event);
-
/**
* Updates all data from bean in given contact instance
* <p>
*/
Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
- /**
- * Event observer for new user registrations
- * <p>
- * @param event User registration event
- */
- void afterRegistrationEvent (final ObservableUserRegisteredEvent event);
-
- /**
- * Observes events being fired when an administrator has added a new
- * contact.
- * <p>
- * @param event Event being fired
- */
- void afterAdminAddedContact (final ObservableAdminAddedContactEvent event);
-
- /**
- * Observes events being fired when an administrator has linked a new user
- * with existing contact data.
- * <p>
- * @param event Event being fired
- */
- void afterAdminLinkedUser (final ObservableAdminLinkedUserEvent event);
-
- /**
- * Event observer for updated contact data by administrators
- * <p>
- * @param event Updated contact data event
- */
- void afterAdminUpdatedContactDataEvent (final ObservableAdminUpdatedContactEvent event);
-
- /**
- * Event observer for logged-in user
- * <p>
- * @param event Event instance
- */
- void afterUserLoginEvent (final ObservableUserLoggedInEvent event);
-
/**
* Creates an instance from all properties
* <p>
import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController;
import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestController;
import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
/**
* A general contact bean (controller)
this.contacts = new HashMap<>(10);
}
- @Override
- public void afterAdminAddedContact (@Observes final ObservableAdminAddedContactEvent event) {
+ /**
+ * Observes events being fired when an administrator has added a new
+ * contact.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
// The event must be valid
if (null == event) {
// Throw NPE
this.clear();
}
- @Override
+ /**
+ * Event observer for newly added users by adminstrator
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
+ /**
+ * Event observer for updated contact data by administrators
+ * <p>
+ * @param event Updated contact data event
+ */
public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
// event should not be null
if (null == event) {
import java.util.List;
import javax.ejb.Local;
import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
/**
* An interface for user beans
*/
List<Contact> allMobileContacts ();
- /**
- * Event observer for newly added users by adminstrator
- * <p>
- * @param event Event being fired
- */
- void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event);
-
- /**
- * Observes events being fired when an administrator has added a new
- * contact.
- * <p>
- * @param event Event being fired
- */
- void afterAdminAddedContact (final ObservableAdminAddedContactEvent event);
-
- /**
- * Event observer for updated contact data by administrators
- * <p>
- * @param event Updated contact data event
- */
- void afterAdminUpdatedContactDataEvent (final ObservableAdminUpdatedContactEvent event);
-
}
}
}
- @Override
- public void afterAdminAddedCountry (@Observes final ObservableAdminAddedCountryEvent event) {
+ /**
+ * Observing method when the event is fired that an administrator added a
+ * new country
+ * <p>
+ * @param event Event instance
+ */
+ public void afterAdminAddedCountryEvent (@Observes final ObservableAdminAddedCountryEvent event) {
// Is all valid?
if (null == event) {
// Throw NPE
import java.io.Serializable;
import java.util.List;
import org.mxchange.jcountry.data.Country;
-import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
/**
* An interface for country beans
*/
List<Country> allCountries ();
- /**
- * Observing method when the event is fired that an administrator added a
- * new country
- * <p>
- * @param event Event instance
- */
- void afterAdminAddedCountry (final ObservableAdminAddedCountryEvent event);
-
}
*/
private Locale locale;
- @Override
+ /**
+ * Event observer for logged-in user
+ * <p>
+ * @param event Event instance
+ */
public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
// event should not be null
if (null == event) {
}
}
- @Override
+ /**
+ * Event observer for logged-out user
+ * <p>
+ * @param event Event instance
+ */
public void afterUserLogoutEvent (@Observes final ObservableUserLogoutEvent event) {
// event should not be null
if (null == event) {
import java.io.Serializable;
import java.util.Locale;
-import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
-import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent;
/**
* An interface for localization change beans
*/
public interface AddressbookLocalizationSessionController extends Serializable {
- /**
- * Event observer for logged-in user
- * <p>
- * @param event Event instance
- */
- void afterUserLoginEvent (final ObservableUserLoggedInEvent event);
-
- /**
- * Event observer for logged-out user
- * <p>
- * @param event Event instance
- */
- void afterUserLogoutEvent (final ObservableUserLogoutEvent event);
-
/**
* Getter for locale
* <p>
import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
import org.mxchange.jusercore.container.login.LoginContainer;
import org.mxchange.jusercore.container.login.UserLoginContainer;
+import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
+import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent;
import org.mxchange.jusercore.events.logout.UserLogoutEvent;
+import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
import org.mxchange.jusercore.exceptions.UserStatusLockedException;
import org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
-import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent;
-import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
/**
* A web bean for user registration
}
}
- @Override
+ /**
+ * Method being call after user's password has been updated (and history
+ * entry has been created).
+ * <p>
+ * @param event Event being observed
+ */
public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) {
// Check parameter
if (null == event) {
import javax.ejb.Local;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
-import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
/**
* An interface for registration web controllers
@Local
public interface AddressbookUserLoginWebSessionController extends Serializable {
- /**
- * Method being call after user's password has been updated (and history
- * entry has been created).
- * <p>
- * @param event Event being observed
- */
- void afterUserUpdatedPasswordEvent (final ObservableUpdatedUserPasswordEvent event);
-
/**
* Checks whether given clear-text password is in user's password history.
* <p>
}
}
- @Override
- public void afterAdminAddedMobileProvider (@Observes final AdminAddedMobileProviderEvent event) {
+ /**
+ * Observes events being fired after the administrator has added a new
+ * mobile provider
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminAddedMobileProviderEvent (@Observes final AdminAddedMobileProviderEvent event) {
// Is all valid?
if (null == event) {
// Throw NPE
import java.io.Serializable;
import java.util.List;
-import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
/**
*/
List<MobileProvider> allMobileProviders ();
- /**
- * Observes events being fired after the administrator has added a new
- * mobile provider
- * <p>
- * @param event Event being fired
- */
- void afterAdminAddedMobileProvider (final AdminAddedMobileProviderEvent event);
-
}
private AddressbookFeaturesWebApplicationController featureController;
/**
- * Reemote register session bean
+ * Remote register session bean
*/
private UserRegistrationSessionBeanRemote registerBean;
}
// Now only redirect to next page as the JSF does it
- return "register_page2"; //NOI18N
+ return "user_register_page2"; //NOI18N
}
}
private String userName;
/**
- * User password (unencrypted from web form)
+ * User password (clear-text from web form)
*/
private String userPassword;
/**
- * User password repeated (unencrypted from web form)
+ * User password repeated (clear-text from web form)
*/
private String userPasswordRepeat;
return "admin_list_user"; //NOI18N
}
- @Override
- public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
+ /**
+ * Event observer for new user registrations
+ * <p>
+ * @param event User registration event
+ */
+ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
User registeredUser = event.getRegisteredUser();
// @TODO Nothing to do with the user here?
-
// Clear all data
this.clear();
}
import java.io.Serializable;
import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
/**
* An interface for user beans
*/
public interface AddressbookAdminUserWebRequestController extends Serializable {
- /**
- * Event observer for new user registrations
- * <p>
- * @param event User registration event
- */
- void afterRegistrationEvent (final ObservableUserRegisteredEvent event);
-
/**
* Adds user instance to database by preparing a complete user instance and
* sending it to the EJB. The data set in the controller is being verified,
void setUserName (final String userName);
/**
- * Getter for unencrypted user password
+ * Getter for clear-text user password
* <p>
- * @return Unencrypted user password
+ * @return Clear-text user password
*/
String getUserPassword ();
/**
- * Setter for unencrypted user password
+ * Setter for clear-text user password
* <p>
- * @param userPassword Unencrypted user password
+ * @param userPassword Clear-text user password
*/
void setUserPassword (final String userPassword);
/**
- * Getter for unencrypted user password repeated
+ * Getter for clear-text user password repeated
* <p>
- * @return Unencrypted user password repeated
+ * @return Clear-text user password repeated
*/
String getUserPasswordRepeat ();
/**
- * Setter for unencrypted user password repeated
+ * Setter for clear-text user password repeated
* <p>
- * @param userPasswordRepeat Unencrypted user password repeated
+ * @param userPasswordRepeat Clear-text user password repeated
*/
void setUserPasswordRepeat (final String userPasswordRepeat);
import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
+import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
+import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
+import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
+import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
+import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent;
import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
import org.mxchange.jusercore.model.user.UserUtils;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
-import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
-import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
-import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
-import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent;
/**
* A user bean (controller)
private List<String> userNameList;
/**
- * User password (unencrypted from web form)
+ * User password (clear-text from web form)
*/
private String userPassword;
/**
- * User password repeated (unencrypted from web form)
+ * User password repeated (clear-text from web form)
*/
private String userPasswordRepeat;
}
}
- @Override
+ /**
+ * Event observer for newly added users by adminstrator
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
// Trace message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterAdminAddedUserEvent: event={0} - CALLED!", event)); //NOI18N
//* NOISY-DEBUG: */ System.out.println("UserWebBean:afterAdminAddedUserEvent: EXIT!"); //NOI18N
}
- @Override
+ /**
+ * Event observer for updated user data by administrator
+ * <p>
+ * @param event Event being updated
+ */
public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) {
// Trace message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterAdminUpdatedUserEvent: event={0} - CALLED!", event)); //NOI18N
//* NOISY-DEBUG: */ System.out.println("UserWebBean:afterAdminUpdatedUserEvent: EXIT!"); //NOI18N
}
- @Override
- public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
-
+ /**
+ * Event observer for new user registrations
+ * <p>
+ * @param event User registration event
+ */
+ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
//* NOISY-DEBUG: */ System.out.println("UserWebBean:afterRegistration: EXIT!"); //NOI18N
}
- @Override
- public void afterUserConfirmedAccount (@Observes final ObservableUserConfirmedAccountEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N
-
+ /**
+ * Event observer when user confirmed account.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterUserConfirmedAccountEvent (@Observes final ObservableUserConfirmedAccountEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
this.uniqueAddUser(event.getConfirmedUser());
}
- @Override
+ /**
+ * Event observer for logged-in user
+ * <p>
+ * @param event Event instance
+ */
public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
// Trace message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
}
}
- @Override
+ /**
+ * Method being call after user's password has been updated (and history
+ * entry has been created).
+ * <p>
+ * @param event Event being observed
+ */
public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) {
// Check parameter
if (null == event) {
this.updateList(event.getPasswordHistory().getUserPasswordHistoryUser());
}
- @Override
- public void afterUserUpdatedPersonalData (@Observes final ObservableUpdatedUserPersonalDataEvent event) {
+ /**
+ * Listens to fired event when user updated personal data
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterUserUpdatedPersonalDataEvent (@Observes final ObservableUpdatedUserPersonalDataEvent event) {
// Check parameter
if (null == event) {
// Throw NPE
User user = new LoginUser();
// Is user name required?
- if (!this.isUserNameRequired()) {
+ if ((!this.featureController.isFeatureEnabled("user_name_required")) && (this.getUserName() == null)) { //NOI18N
// Generate pseudo-random user name
String randomName = this.userBean.generateRandomUserName();
} else if (!this.userLoginController.ifCurrentPasswordMatches()) {
// Password not matching
throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
- } else if (!this.featureController.isFeatureEnabled("edit_user_data")) {
+ } else if (!this.featureController.isFeatureEnabled("edit_user_data")) { //NOI18N
// Editing is not allowed
throw new IllegalStateException("User tried to edit personal data."); //NOI18N
}
this.contactController.updateContactDataFromController(user.getUserContact());
// It should be there, so run some tests on it
- assert (user instanceof User) : "Instance userLoginController.loggedInUser is null";
- assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null";
- assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId());
- assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null";
- assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null";
- assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
+ assert (user instanceof User) : "Instance userLoginController.loggedInUser is null"; //NOI18N
+ assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null"; //NOI18N
+ assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N
+ assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N
+ assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; //NOI18N
+ assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
// Update all fields
user.setUserProfileMode(this.getUserProfileMode());
boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
// This requires user names being enabled, too.
- if ((isEnabled) && (!this.isUserNameRequired())) {
+ if ((isEnabled) && (!this.featureController.isFeatureEnabled("user_name_required"))) { //NOI18N
// Not valid state, users must be able to modify their profile, especially when it is public
throw new IllegalStateException("Public user profiles are enabled but user name requirement is disabled, this is not possible."); //NOI18N
}
return this.contactController.isRequiredPersonalDataSet();
} else {
// Single registration page
- return (((this.getUserName() != null) || (!this.isUserNameRequired())) &&
+ return (((this.getUserName() != null) || (!this.featureController.isFeatureEnabled("user_name_required"))) && //NOI18N
(this.getUserProfileMode() != null) &&
(this.contactController.isRequiredPersonalDataSet()) &&
(this.getUserPassword() != null) &&
return ((this.userNameList instanceof List) && (this.userNameList.contains(user.getUserName())));
}
- @Override
- public boolean isUserNameRequired () {
- // Get context parameter
- String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_user_name_required"); //NOI18N
-
- // Is it set?
- boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
-
- // Return value
- return isRequired;
- }
-
@Override
public boolean isVisibleUserFound () {
return ((this.visibleUserList instanceof List) && (!this.visibleUserList.isEmpty()));
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
-import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
-import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
-import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
-import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent;
/**
* An interface for user beans
*/
public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
- /**
- * Event observer for newly added users by adminstrator
- * <p>
- * @param event Event being fired
- */
- void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event);
-
- /**
- * Event observer for updated user data by administrator
- * <p>
- * @param event Event being updated
- */
- void afterAdminUpdatedUserDataEvent (final ObservableAdminUpdatedUserDataEvent event);
-
- /**
- * Event observer when user confirmed account.
- * <p>
- * @param event Event being fired
- */
- void afterUserConfirmedAccount (final ObservableUserConfirmedAccountEvent event);
-
- /**
- * Method being call after user's password has been updated (and history
- * entry has been created).
- * <p>
- * @param event Event being observed
- */
- void afterUserUpdatedPasswordEvent (final ObservableUpdatedUserPasswordEvent event);
-
- /**
- * Listens to fired event when user updated personal data
- * <p>
- * @param event Event being fired
- */
- void afterUserUpdatedPersonalData (final ObservableUpdatedUserPersonalDataEvent event);
-
- /**
- * Event observer for new user registrations
- * <p>
- * @param event User registration event
- */
- void afterRegistrationEvent (final ObservableUserRegisteredEvent event);
-
- /**
- * Event observer for logged-in user
- * <p>
- * @param event Event instance
- */
- void afterUserLoginEvent (final ObservableUserLoggedInEvent event);
-
/**
* All users
* <p>
void setUserName (final String userName);
/**
- * Getter for unencrypted user password
+ * Getter for clear-text user password
* <p>
- * @return Unencrypted user password
+ * @return Clear-text user password
*/
String getUserPassword ();
/**
- * Setter for unencrypted user password
+ * Setter for clear-text user password
* <p>
- * @param userPassword Unencrypted user password
+ * @param userPassword Clear-text user password
*/
void setUserPassword (final String userPassword);
/**
- * Getter for unencrypted user password repeated
+ * Getter for clear-text user password repeated
* <p>
- * @return Unencrypted user password repeated
+ * @return Clear-text user password repeated
*/
String getUserPasswordRepeat ();
/**
- * Setter for unencrypted user password repeated
+ * Setter for clear-text user password repeated
* <p>
- * @param userPasswordRepeat Unencrypted user password repeated
+ * @param userPasswordRepeat Clear-text user password repeated
*/
void setUserPasswordRepeat (final String userPasswordRepeat);
*/
String doChangePersonalData ();
- /**
- * Checks whether this application requires a user name to be entered.
- * Otherwise a random name like "userXXXXX" is generated
- * <p>
- * @return Whether this application requires a user name
- */
- boolean isUserNameRequired ();
-
/**
* Checks wether public user profiles are enabled. This requires that user
* names are also enabled.
private AddressbookUserLoginWebSessionController userLoginController;
/**
- * User password (unencrypted from web form)
+ * User password (clear-text from web form)
*/
private String userPassword;
/**
- * User password repeated (unencrypted from web form)
+ * User password repeated (clear-text from web form)
*/
private String userPasswordRepeat;
public interface AddressbookUserPasswordWebRequestController extends Serializable {
/**
- * Getter for unencrypted user password
+ * Getter for clear-text user password
* <p>
- * @return Unencrypted user password
+ * @return Clear-text user password
*/
String getUserPassword ();
/**
- * Setter for unencrypted user password
+ * Setter for clear-text user password
* <p>
- * @param userPassword Unencrypted user password
+ * @param userPassword Clear-text user password
*/
void setUserPassword (final String userPassword);
/**
- * Getter for current unencrypted user password
+ * Getter for current clear-text user password
* <p>
- * @return Current unencrypted user password
+ * @return Current clear-text user password
*/
String getUserCurrentPassword ();
/**
- * Setter for current unencrypted user password
+ * Setter for current clear-text user password
* <p>
- * @param userCurrentPassword Current unencrypted user password
+ * @param userCurrentPassword Current clear-text user password
*/
void setUserCurrentPassword (final String userCurrentPassword);
/**
- * Getter for unencrypted user password repeated
+ * Getter for clear-text user password repeated
* <p>
- * @return Unencrypted user password repeated
+ * @return Clear-text user password repeated
*/
String getUserPasswordRepeat ();
/**
- * Setter for unencrypted user password repeated
+ * Setter for clear-text user password repeated
* <p>
- * @param userPasswordRepeat Unencrypted user password repeated
+ * @param userPasswordRepeat Clear-text user password repeated
*/
void setUserPasswordRepeat (final String userPasswordRepeat);
@Override
public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
-
// Is the value null or empty?
if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
// Warning message
}
// Init instance
- DialableMobileNumber cellphone = null;
+ DialableMobileNumber mobile = null;
try {
// Try to parse the value as long
- Long cellphoneId = Long.valueOf(submittedValue);
-
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId)); //NOI18N
+ Long mobileId = Long.valueOf(submittedValue);
- // Try to get cellphone instance from it
- cellphone = this.phoneBean.findMobileNumberById(cellphoneId);
-
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: cellphone={0}", cellphone)); //NOI18N
+ // Try to get mobile instance from it
+ mobile = this.phoneBean.findMobileNumberById(mobileId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
// @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
}
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: cellphone={0} - EXIT!", cellphone)); //NOI18N
-
// Return it
- return cellphone;
+ return mobile;
}
@Override
@Override
public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
-
// Is the value null or empty?
if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
// Warning message
// Try to parse the value as long
Long contactId = Long.valueOf(submittedValue);
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contactId{0}", contactId)); //NOI18N
-
// Try to get user instance from it
contact = this.contactBean.findContactById(contactId);
-
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contact={0}", contact)); //NOI18N
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
// @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
}
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: contact={0} - EXIT!", contact)); //NOI18N
-
// Return it
return contact;
}
@Override
public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2},this.countryBean={3} - CALLED!", context, component, submittedValue, this.countryBean)); //NOI18N
-
// Is the value null or empty?
if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
// Warning message
// Category id should not be below 1
assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: countryId={0}", countryId)); //NOI18N
-
// Try to find it
for (final Country cntry : countryList) {
// Is the id the same? (null-safe)
throw new ConverterException(ex);
}
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: country={0} - EXIT!", country)); //NOI18N
-
// Return it
return country;
}
@Override
public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
-
// Is the value null or empty?
if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
// Warning message
// Category id should not be below 1
assert (providerId > 0) : "providerId is smaller than one: " + providerId; //NOI18N
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: providerId={0}", providerId)); //NOI18N
-
// Try to find it
for (final MobileProvider prov : providerList) {
// Is the id the same? (null-safe)
// @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logException(ex);
}
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: provider={0} - EXIT!", provider)); //NOI18N
-
// Return it
return provider;
}
@Override
public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
-
// Is the value null or empty?
if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
// Warning message
// Try to parse the value as long
Long userId = Long.valueOf(submittedValue);
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId)); //NOI18N
-
// Try to get user instance from it
user = this.userBean.findUserById(userId);
-
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: user={0}", user)); //NOI18N
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
// @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex)); //NOI18N
}
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: user={0} - EXIT!", user)); //NOI18N
-
// Return it
return user;
}
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
// All accepted, required fields
String[] requiredFields = {"birthday", "contactBirthday"}; //NOI18N
Date birthday = (Date) value;
// @TODO Finish this, e.g. load maximum,minimum birthday from properties file
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
}
}
* <p>
* @param event User registration event
*/
- public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterRegistrationEvent: event={0} - CALLED!", event)); //NOI18N
-
+ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
// Get user instance
User registeredUser = event.getRegisteredUser();
- // Debug message
- // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N
-
// Update cache
AddressbookUserIdValidator.cachedStatus.add(registeredUser.getUserId());
-
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace("UserIdValidator:afterRegistrationEvent: EXIT!"); //NOI18N
}
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
// All accepted, required fields
String[] requiredFields = {"userId"}; //NOI18N
// Add to cache if valid
AddressbookUserIdValidator.cachedStatus.add(userId);
-
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
}
}