import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.deleted.ObservableAdminDeletedContactEvent;
import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcountry.data.Country;
this.emailAddresses = new LinkedList<>();
}
- @Override
+ /**
+ * 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) {
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) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
+ /**
+ * Event observer for deleted contact instance by administrator
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminDeletedContactEvent (@Observes final ObservableAdminDeletedContactEvent event) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
+ /**
+ * 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) {
this.clear();
}
- @Override
- public void afterAdminUnlinkedFaxContactDataEvent (@Observes final ObservableAdminUnlinkedFaxNumberEvent event) {
+ /**
+ * 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) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getUnlinkedFaxNumber() == null) {
+ } else if (event.getUpdatedContact() == null) {
// Throw NPE again
- throw new NullPointerException("event.unlinkedFaxNumber is null"); //NOI18N
- } else if (event.getUnlinkedFaxNumber().getPhoneId() == null) {
+ throw new NullPointerException("event.updatedContact is null"); //NOI18N
+ } else if (event.getUpdatedContact().getContactId() == null) {
// userId is null
- throw new NullPointerException("event.unlinkedFaxNumber.contactId is null"); //NOI18N
- } else if (event.getUnlinkedFaxNumber().getPhoneId() < 1) {
+ throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+ } else if (event.getUpdatedContact().getContactId() < 1) {
// Not avalid id
- throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedFaxNumber(), event.getUnlinkedFaxNumber().getPhoneId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
}
- // Remove it from list
- this.removeFromContacts(event.getUnlinkedFaxNumber());
+ // Add contact instance only once
+ this.uniqueAddContact(event.getUpdatedContact());
- // Clear all data
- this.clear();
+ // Add email address to list
+ this.emailAddresses.add(event.getUpdatedContact().getContactEmailAddress());
}
- @Override
- public void afterAdminUnlinkedLandLineContactDataEvent (@Observes final ObservableAdminUnlinkedLandLineNumberEvent 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
throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getUnlinkedLandLineNumber() == null) {
+ } else if (event.getRegisteredUser() == null) {
// Throw NPE again
- throw new NullPointerException("event.unlinkedLandLineNumber is null"); //NOI18N
- } else if (event.getUnlinkedLandLineNumber().getPhoneId() == null) {
+ throw new NullPointerException("event.registeredUser is null"); //NOI18N
+ } else if (event.getRegisteredUser().getUserId() == null) {
// userId is null
- throw new NullPointerException("event.unlinkedLandLineNumber.contactId is null"); //NOI18N
- } else if (event.getUnlinkedLandLineNumber().getPhoneId() < 1) {
+ throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N
+ } else if (event.getRegisteredUser().getUserId() < 1) {
// Not avalid id
- throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedLandLineNumber(), event.getUnlinkedLandLineNumber().getPhoneId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
}
- // Remove it from list
- this.removeFromContacts(event.getUnlinkedLandLineNumber());
+ // Get user instance
+ Contact registeredContact = event.getRegisteredUser().getUserContact();
+
+ // Copy all data from registered->user
+ this.copyContact(registeredContact);
+
+ // Add user name and email address
+ this.addUserNameEmailAddress(registeredContact);
// Clear all data
this.clear();
}
- @Override
+ /**
+ * Event observer for unlinked mobile contact by administrators
+ * <p>
+ * @param event Unlinked mobile contact event
+ */
public void afterAdminUnlinkedMobileContactDataEvent (@Observes final ObservableAdminUnlinkedMobileNumberEvent event) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
- public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
- // event should not be null
- if (null == event) {
- // Throw NPE
- throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getUpdatedContact() == null) {
- // Throw NPE again
- throw new NullPointerException("event.updatedContact is null"); //NOI18N
- } else if (event.getUpdatedContact().getContactId() == null) {
- // userId is null
- throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
- } else if (event.getUpdatedContact().getContactId() < 1) {
- // Not avalid id
- throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
- }
-
- // Add contact instance only once
- this.uniqueAddContact(event.getUpdatedContact());
-
- // Add email address to list
- this.emailAddresses.add(event.getUpdatedContact().getContactEmailAddress());
- }
-
- @Override
- public void afterUserConfirmedAccountEventEvent (@Observes final ObservableUserConfirmedAccountEvent event) {
+ /**
+ * 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) {
// Throw NPE
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) {
this.copyContact(event.getLoggedInUser().getUserContact());
}
- @Override
- public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
- // event should not be null
- if (null == event) {
- // Throw NPE
- throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getRegisteredUser() == null) {
- // Throw NPE again
- throw new NullPointerException("event.registeredUser is null"); //NOI18N
- } else if (event.getRegisteredUser().getUserId() == null) {
- // userId is null
- throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N
- } else if (event.getRegisteredUser().getUserId() < 1) {
- // Not avalid id
- throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
- }
-
- // Get user instance
- Contact registeredContact = event.getRegisteredUser().getUserContact();
-
- // Copy all data from registered->user
- this.copyContact(registeredContact);
-
- // Add user name and email address
- this.addUserNameEmailAddress(registeredContact);
-
- // Clear all data
- this.clear();
- }
-
@Override
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
public List<Contact> allContacts () {
- // Debug message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactController.allContacts: contactList.size()={0} - EXIT!", this.contactList.size()));
-
// Return un-modified list
return this.contacts;
}
@Override
public Contact createContactInstance () {
- // User message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: CALLED!", this.getClass().getSimpleName()));
-
// Is all required data set?
if (!this.isRequiredPersonalDataSet()) {
// No, then abort here
contact.setContactBirthday(this.getBirthday());
contact.setContactComment(this.getComment());
- // Debug message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: this.emailAddress={1}", this.getClass().getSimpleName(), this.getEmailAddress()));
// Don't set null or wrong references
if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
// Now the number must be given
contact.setContactMobileNumber(mobile);
}
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: contact={1} - EXIT!", this.getClass().getSimpleName(), contact));
// Return it
return contact;
}
return localContact;
}
- @Override
+ /**
+ * Event observer when a list with unused mobile numbers is being created
+ * <p>
+ * @param event Event being fired
+ */
public void removeMobileNumberFromListEvent (@Observes final AdminRemoveMobileNumberFromListEvent event) {
// event should not be null
if (null == event) {
import org.mxchange.jcontacts.contact.gender.Gender;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
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.deleted.ObservableAdminDeletedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
/**
* 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 for deleted contact instance by administrator
- * <p>
- * @param event Event being fired
- */
- void afterAdminDeletedContactEvent (final ObservableAdminDeletedContactEvent event);
-
- /**
- * Event observer for unlinked fax contact by administrators
- * <p>
- * @param event Unlinked fax contact event
- */
- void afterAdminUnlinkedFaxContactDataEvent (final ObservableAdminUnlinkedFaxNumberEvent event);
-
- /**
- * Event observer for unlinked land-line contact by administrators
- * <p>
- * @param event Unlinked land-line contact event
- */
- void afterAdminUnlinkedLandLineContactDataEvent (final ObservableAdminUnlinkedLandLineNumberEvent event);
-
- /**
- * Event observer for unlinked mobile contact by administrators
- * <p>
- * @param event Unlinked mobile contact event
- */
- void afterAdminUnlinkedMobileContactDataEvent (final ObservableAdminUnlinkedMobileNumberEvent event);
-
- /**
- * Event observer when user confirmed account.
- * <p>
- * @param event Event being fired
- */
- void afterUserConfirmedAccountEventEvent (final ObservableUserConfirmedAccountEvent event);
-
- /**
- * Event observer when a list with unused mobile numbers is being created
- * <p>
- * @param event Event being fired
- */
- void removeMobileNumberFromListEvent(final AdminRemoveMobileNumberFromListEvent 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 afterUserRegistrationEvent (final ObservableUserRegisteredEvent event);
-
- /**
- * Observes events being fired when an administrator has added a new
- * contact.
- * <p>
- * @param event Event being fired
- */
- void afterAdminAddedContactEvent (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 afterAdminLinkedUserEvent (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 javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
import org.mxchange.jcontacts.events.fax.linked.AdminLinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
import org.mxchange.jcontacts.events.fax.unlinked.AdminUnlinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
import org.mxchange.jcontacts.events.landline.unlinked.AdminUnlinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jjobs.beans.BaseJobsController;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController;
import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
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.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
-import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
/**
* An administrative contact phone controller (bean)
}
}
- @Override
+ /**
+ * 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) {
this.clear();
}
- @Override
+ /**
+ * Event observer for newly added users by administrator
+ * <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.io.Serializable;
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
String unlinkMobileContactData ();
/**
- * 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 afterAdminAddedContactEvent (final ObservableAdminAddedContactEvent event);
-
- /**
- * Event observer for updated contact data by administrators
- * <p>
- * @param event Updated contact data event
- */
- void afterAdminUpdatedContactDataEvent (final ObservableAdminUpdatedContactEvent event);
-
- /**
- * Links given contact instance with setted fax number or entered data. If
+ * Links given contact instance with set fax number or entered data. If
* both is set, a proper exception is thrown as this is an invalid state.
* <p>
* @param contact Contact instance to link with existing/new data
String doLinkAddFaxNumber (final Contact contact);
/**
- * Links given contact instance with setted land-line number or entered
+ * Links given contact instance with set land-line number or entered
* data. If both is set, a proper exception is thrown as this is an invalid
* state.
* <p>
String doLinkAddLandLineNumber (final Contact contact);
/**
- * Links given contact instance with setted mobile or entered data. If both
+ * Links given contact instance with set mobile or entered data. If both
* is set, a proper exception is thrown as this is an invalid state.
* <p>
* @param contact Contact instance to link with existing/new data
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
import org.mxchange.jjobs.beans.BaseJobsController;
import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
import org.mxchange.jphone.phonenumbers.DialableNumber;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
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.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
-import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
/**
- * An administrative contact phone controller (bean)
+ * A general contact bean (controller)
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
this.contacts = new HashMap<>(10);
}
- @Override
+ /**
+ * 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) {
this.clear();
}
- @Override
+ /**
+ * Event observer for newly added users by administrator
+ * <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 unlinked fax contact by administrators
+ * <p>
+ * @param event Unlinked fax contact event
+ */
public void afterAdminUnlinkedFaxContactDataEvent (@Observes final ObservableAdminUnlinkedFaxNumberEvent event) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
+ /**
+ * Event observer for unlinked land-line contact by administrators
+ * <p>
+ * @param event Unlinked land-line contact event
+ */
public void afterAdminUnlinkedLandLineContactDataEvent (@Observes final ObservableAdminUnlinkedLandLineNumberEvent event) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
+ /**
+ * Event observer for unlinked mobile contact by administrators
+ * <p>
+ * @param event Unlinked mobile contact event
+ */
public void afterAdminUnlinkedMobileContactDataEvent (@Observes final ObservableAdminUnlinkedMobileNumberEvent 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;
-import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
/**
* An interface for user beans
*/
List<Contact> allMobileNumberContacts ();
- /**
- * 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 afterAdminAddedContactEvent (final ObservableAdminAddedContactEvent event);
-
- /**
- * Event observer for updated contact data by administrators
- * <p>
- * @param event Updated contact data event
- */
- void afterAdminUpdatedContactDataEvent (final ObservableAdminUpdatedContactEvent event);
-
- /**
- * Event observer for unlinked fax contact by administrators
- * <p>
- * @param event Unlinked fax contact event
- */
- void afterAdminUnlinkedFaxContactDataEvent (final ObservableAdminUnlinkedFaxNumberEvent event);
-
- /**
- * Event observer for unlinked land-line contact by administrators
- * <p>
- * @param event Unlinked land-line contact event
- */
- void afterAdminUnlinkedLandLineContactDataEvent (final ObservableAdminUnlinkedLandLineNumberEvent event);
-
- /**
- * Event observer for unlinked mobile contact by administrators
- * <p>
- * @param event Unlinked mobile contact event
- */
- void afterAdminUnlinkedMobileContactDataEvent (final ObservableAdminUnlinkedMobileNumberEvent event);
-
}
import javax.naming.NamingException;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
-import org.mxchange.jjobs.beans.BaseJobsController;
import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
+import org.mxchange.jjobs.beans.BaseJobsController;
/**
* A country bean
}
}
- @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 JobsLocalizationSessionController 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.jjobs.beans.user.JobsUserWebSessionController;
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
*/
private String baseTemplatePathName;
- /**
- * Current password
- */
- private String userCurrentPassword;
-
/**
* Logged-in user instance
*/
@Inject
private JobsUserWebSessionController userController;
+ /**
+ * Current password
+ */
+ private String userCurrentPassword;
+
/**
* Flag whether the user has logged-in, set only from inside
*/
}
}
- @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) {
}
@Override
- public String getUserCurrentPassword () {
- return this.userCurrentPassword;
+ public User getLoggedInUser () {
+ return this.loggedInUser;
}
@Override
- public void setUserCurrentPassword (final String userCurrentPassword) {
- this.userCurrentPassword = userCurrentPassword;
+ public void setLoggedInUser (final User loggedInUser) {
+ this.loggedInUser = loggedInUser;
}
@Override
- public User getLoggedInUser () {
- return this.loggedInUser;
+ public String getUserCurrentPassword () {
+ return this.userCurrentPassword;
}
@Override
- public void setLoggedInUser (final User loggedInUser) {
- this.loggedInUser = loggedInUser;
+ public void setUserCurrentPassword (final String userCurrentPassword) {
+ this.userCurrentPassword = userCurrentPassword;
}
@Override
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 JobsUserLoginWebSessionController 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);
-
}
import javax.naming.NamingException;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jjobs.beans.BaseJobsController;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
import org.mxchange.jphone.events.fax.deleted.AdminFaxNumberDeletedEvent;
import org.mxchange.jphone.events.fax.removed.AdminFaxNumberRemovedFromListEvent;
import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote;
-import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
/**
* Administrative controller (bean) for phone numbers
@Override
public String deleteFaxData (final DialableFaxNumber faxNumber) {
- // Log message
- System.out.println(MessageFormat.format("{0}.deleteFaxData: faxNumber={1} - CALLED!", this.getClass().getSimpleName(), faxNumber)); //NOI18N
-
// Is all data set
if (faxNumber == null) {
// Not set, throw NPE
@Override
public String deleteLandLineData (final DialableLandLineNumber landLineNumber) {
- // Log message
- System.out.println(MessageFormat.format("{0}.deleteLandLineData: landLineNumber={1} - CALLED!", this.getClass().getSimpleName(), landLineNumber)); //NOI18N
-
// Is all data set
if (landLineNumber == null) {
// Not set, throw NPE
@Override
public String deleteMobileData (final DialableMobileNumber mobileNumber) {
- // Log message
- System.out.println(MessageFormat.format("{0}.deleteMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
-
// Is all data set
if (mobileNumber == null) {
// Not set, throw NPE
@Override
public String editFaxData (final DialableFaxNumber faxNumber) {
- // Log message
- System.out.println(MessageFormat.format("{0}.editFaxData: faxNumber={1} - CALLED!", this.getClass().getSimpleName(), faxNumber)); //NOI18N
-
// Is all data set
if (faxNumber == null) {
// Not set, throw NPE
// Is the mobile provider and number the same?
if ((Objects.equals(this.getPhoneCountry(), faxNumber.getPhoneCountry())) && (Objects.equals(this.getPhoneAreaCode(), faxNumber.getPhoneAreaCode())) && (Objects.equals(this.getPhoneNumber(), faxNumber.getPhoneNumber()))) {
- // Log message
- System.out.println(MessageFormat.format("{0}.editFaxData: No difference - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
// Show message
this.showFacesMessage("form_edit_fax:faxNumber", "ERROR_ADMIN_NO_CHANGE_ENTERED"); //NOI18N
@Override
public String editLandLineData (final DialableLandLineNumber landLineNumber) {
- // Log message
- System.out.println(MessageFormat.format("{0}.editLandLineData: landLineNumber={1} - CALLED!", this.getClass().getSimpleName(), landLineNumber)); //NOI18N
-
// Is all data set
if (landLineNumber == null) {
// Not set, throw NPE
// Is the mobile provider and number the same?
if ((Objects.equals(this.getPhoneCountry(), landLineNumber.getPhoneCountry())) && (Objects.equals(this.getPhoneAreaCode(), landLineNumber.getPhoneAreaCode())) && (Objects.equals(this.getPhoneNumber(), landLineNumber.getPhoneNumber()))) {
- // Log message
- System.out.println(MessageFormat.format("{0}.editLandLineData: No difference - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
// Show message
this.showFacesMessage("form_edit_landline:landLineNumber", "ERROR_ADMIN_NO_CHANGE_ENTERED"); //NOI18N
@Override
public String editMobileData (final DialableMobileNumber mobileNumber) {
- // Log message
- System.out.println(MessageFormat.format("{0}.editMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
-
// Is all data set
if (mobileNumber == null) {
// Not set, throw NPE
return ""; //NOI18N
}
- // Log message
- System.out.println(MessageFormat.format("{0}.editMobileData: this.mobileProvider.providerId={1},mobileNumber.mobileProvider.providerId={2},this.phoneNumber={3},mobileNumber.phoneNumber={4}", this.getClass().getSimpleName(), this.getMobileProvider().getProviderId(), mobileNumber.getMobileProvider().getProviderId(), this.getPhoneNumber(), mobileNumber.getPhoneNumber())); //NOI18N
-
// Is the mobile provider and number the same?
if ((Objects.equals(this.getMobileProvider(), mobileNumber.getMobileProvider())) && (Objects.equals(this.getPhoneNumber(), mobileNumber.getPhoneNumber()))) {
- // Log message
- System.out.println(MessageFormat.format("{0}.editMobileData: No difference - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
// Show message
this.showFacesMessage("form_edit_mobile:mobileNumber", "ERROR_ADMIN_NO_CHANGE_ENTERED"); //NOI18N
@Override
public void setPhoneNumber (final Long phoneNumber) {
- System.out.println(MessageFormat.format("{0}: Setting phoneNumber={1},previous:{2}", this.getClass().getSimpleName(), phoneNumber, this.phoneNumber));
this.phoneNumber = phoneNumber;
}
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
import org.mxchange.jjobs.beans.BaseJobsController;
import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote;
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.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
/**
* Regular controller (bean) for phone numbers
throw new NullPointerException("event.linkedFaxNumer is null");
}
- // Log message
- System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedFaxNumberEvent: event.linkedFaxNumber.phoneId=" + event.getLinkedFaxNumber().getPhoneId());
-
// Is the id number in linked number not set?
if (event.getLinkedFaxNumber().getPhoneId() == null) {
- // Log message
- System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedFaxNumberEvent: Adding to list: "+event.getContact().getContactFaxNumber());
-
// Then it is a new number, so add it from contact as there the id number has been set
this.uniqueAddFaxNumber(event.getContact().getContactFaxNumber());
}
throw new NullPointerException("event.linkedLandLineNumer is null");
}
- // Log message
- System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedLandLineNumberEvent: event.linkedLandLineNumber.phoneId=" + event.getLinkedLandLineNumber().getPhoneId());
-
// Is the id number in linked number not set?
if (event.getLinkedLandLineNumber().getPhoneId() == null) {
- // Log message
- System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedLandLineNumberEvent: Adding to list: "+event.getContact().getContactLandLineNumber());
-
// Then it is a new number, so add it from contact as there the id number has been set
this.uniqueAddLandLineNumber(event.getContact().getContactLandLineNumber());
}
throw new NullPointerException("event.linkedMobileNumer is null");
}
- // Log message
- System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedMobileNumberEvent: event.linkedMobileNumber.phoneId=" + event.getLinkedMobileNumber().getPhoneId());
-
// Is the id number in linked number not set?
if (event.getLinkedMobileNumber().getPhoneId() == null) {
- // Log message
- System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedMobileNumberEvent: Adding to list: "+event.getContact().getContactMobileNumber());
-
// Then it is a new number, so add it from contact as there the id number has been set
this.uniqueAddMobileNumber(event.getContact().getContactMobileNumber());
}
private JobsFeaturesWebApplicationController featureController;
/**
- * Reemote register session bean
+ * Remote register session bean
*/
private UserRegistrationSessionBeanRemote registerBean;
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
+ /**
+ * 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) {
User registeredUser = event.getRegisteredUser();
// @TODO Nothing to do with the user here?
-
// Clear all data
this.clear();
}
package org.mxchange.jjobs.beans.user;
import java.io.Serializable;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
import org.mxchange.jusercore.model.user.User;
/**
*/
public interface JobsAdminUserWebRequestController extends Serializable {
- /**
- * Event observer for new user registrations
- * <p>
- * @param event User registration event
- */
- void afterUserRegistrationEvent (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.jjobs.beans.BaseJobsController;
import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
-import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
-import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
-import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
-import org.mxchange.jusercore.model.user.LoginUser;
-import org.mxchange.jusercore.model.user.User;
-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.unlocked.ObservableAdminUnlockedUserEvent;
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.exceptions.UserPasswordMismatchException;
+import org.mxchange.jusercore.model.user.LoginUser;
+import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
+import org.mxchange.jusercore.model.user.UserUtils;
+import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
/**
* A user controller (bean)
@Inject
private JobsFeaturesWebApplicationController featureController;
- /**
- * Localization controller
- */
- @Inject
- private JobsLocalizationSessionController localizationController;
-
/**
* Event being fired when user updated personal data
*/
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;
Context context = new InitialContext();
// Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+ this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jrecruiter-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
} catch (final NamingException e) {
// Throw again
throw new FaceletException(e);
}
}
- @Override
+ /**
+ * Event observer for newly added users by administrator
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
// event should not be null
if (null == event) {
this.setUserId(event.getAddedUser().getUserId());
}
- @Override
+ /**
+ * Event observer for deleted user accounts (by administrator)
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminDeletedUserEvent (final ObservableAdminDeletedUserEvent event) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
+ /**
+ * Event observer for linked users 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) {
this.setUserId(event.getLinkedUser().getUserId());
}
- @Override
+ /**
+ * Event observer for locked users
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminLockedUserEvent (@Observes final ObservableAdminLockedUserEvent event) {
// event should not be null
if (null == event) {
this.updateList(event.getLockedUser());
}
- @Override
+ /**
+ * Event observer for unlocked users
+ * <p>
+ * @param event Event being fired
+ */
public void afterAdminUnlockedUserEvent (@Observes final ObservableAdminUnlockedUserEvent event) {
// event should not be null
if (null == event) {
this.updateList(event.getUnlockedUser());
}
- @Override
+ /**
+ * Event observer for updated user data by administrator
+ * <p>
+ * @param event Event being updated
+ */
public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) {
// event should not be null
if (null == event) {
this.clear();
}
- @Override
+ /**
+ * 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) {
this.updateList(event.getConfirmedUser());
}
- @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 new user registrations
+ * <p>
+ * @param event User registration event
+ */
public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
// event should not be null
if (null == event) {
this.setUserId(registeredUser.getUserId());
}
- @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
+ /**
+ * 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) {
@Override
public User createUserInstance (final boolean createContactData) {
+ // Trace message
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createUserInstance: CALLED!", this.getClass().getSimpleName()));
+
// Required personal data must be set
assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
this.setUserPasswordRepeat(randomPassword);
}
- // Set local, user name and mode
- user.setUserLocale(this.localizationController.getLocale());
+ // Set user name and mode
user.setUserName(this.getUserName());
user.setUserProfileMode(this.getUserProfileMode());
// Create contact instance
Contact contact = this.contactController.createContactInstance();
+ // Debug message
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createUserInstance: contact={1}", this.getClass().getSimpleName(), contact));
+
// Set contact in user
user.setUserContact(contact);
}
+ // Trace message
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createUserInstance: user={1} - EXIT!", this.getClass().getSimpleName(), user));
+
// Return it
return user;
}
@Override
public User createUserLogin () {
+ // Trace message
+ //* NOISY-DEBUG */ System.out.println(MessageFormat.format("{0}.createUserLogin: CALLED!", this.getClass().getSimpleName()));
+
// Is all data set?
if (this.getUserName() == null) {
// Throw NPE
// Update all data ...
recruiter.setUserName(this.getUserName());
+ // Trace message
+ //* NOISY-DEBUG */ System.out.println(MessageFormat.format("{0}.createUserLogin: recruiter={1} - EXIT!", this.getClass().getSimpleName(), recruiter));
+
// Return the new instance
return recruiter;
}
if (this.userNameList.contains(user.getUserName())) {
// Abort here
throw new IllegalArgumentException(MessageFormat.format("User name {0} already added.", user.getUserName())); //NOI18N
+ } else if (this.contactController.isEmailAddressRegistered(user.getUserContact())) {
+ // Already added
+ throw new IllegalArgumentException(MessageFormat.format("Email address {0} already added.", user.getUserContact().getContactEmailAddress())); //NOI18N
}
// Add user name
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.delete.ObservableAdminDeletedUserEvent;
-import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
-import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
-import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
-import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
-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 deleted user accounts (by administrator)
- * <p>
- * @param event Event being fired
- */
- void afterAdminDeletedUserEvent (final ObservableAdminDeletedUserEvent event);
-
- /**
- * Event observer for linked users with existing contact data
- * <p>
- * @param event Event being fired
- */
- void afterAdminLinkedUserEvent (final ObservableAdminLinkedUserEvent event);
-
- /**
- * Event observer for locked users
- * <p>
- * @param event Event being fired
- */
- void afterAdminLockedUserEvent (final ObservableAdminLockedUserEvent event);
-
- /**
- * Event observer for unlocked users
- * <p>
- * @param event Event being fired
- */
- void afterAdminUnlockedUserEvent (final ObservableAdminUnlockedUserEvent 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 afterUserConfirmedAccountEvent (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 afterUserUpdatedPersonalDataEvent (final ObservableUpdatedUserPersonalDataEvent event);
-
- /**
- * Event observer for new user registrations
- * <p>
- * @param event User registration event
- */
- void afterUserRegistrationEvent (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);
private JobsUserLoginWebSessionController 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 JobsUserPasswordWebRequestController 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 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
// 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
// @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: mobileNumber={0} - EXIT!", mobileNumber)); //NOI18N
-
// Return it
return mobileNumber;
}
@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
}
}
* @param event User registration event
*/
public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterUserRegistrationEvent: event={0} - CALLED!", event)); //NOI18N
-
// 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:afterUserRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N
-
// Update cache
JobsUserIdValidator.cachedStatus.add(registeredUser.getUserId());
-
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace("UserIdValidator:afterUserRegistrationEvent: 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
JobsUserIdValidator.cachedStatus.add(userId);
-
- // Trace message
- // NOISY-DEBUG: this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
}
}