this.emailAddresses.add(event.getUpdatedContact().getContactEmailAddress());
}
- @Override
- public void afterUserRegistrationEvent (@Observes final UserRegisteredEvent 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 contact instance only once
- this.uniqueAddContact(registeredContact);
-
- // Add user name and email address
- this.addUserNameEmailAddress(registeredContact);
-
- // Clear all data
- this.clear();
- }
-
@Override
public void afterUserConfirmedAccountEventEvent (@Observes final UserConfirmedAccountEvent event) {
// event should not be null
this.copyContact(event.getLoggedInUser().getUserContact());
}
+ @Override
+ public void afterUserRegistrationEvent (@Observes final UserRegisteredEvent 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 () {
* @param faxNumber Fax number to remove
*/
private void removeFromContacts (final DialableFaxNumber faxNumber) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: faxNumber={1} - CALLED!", this.getClass().getSimpleName(), faxNumber)); //NOI18N
+
// Is it valid?
if (null == faxNumber) {
// Throw NPE
// Loop through all contacts
for (final Contact contact : this.contacts) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1},contact.contactFaxNumber={2}", this.getClass().getSimpleName(), contact, contact.getContactFaxNumber())); //NOI18N
+
// Is the number set?
if (Objects.equals(contact.getContactFaxNumber(), faxNumber)) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting faxNumber={1} ...", this.getClass().getSimpleName(), faxNumber)); //NOI18N
+
// Found it
contact.setContactFaxNumber(null);
}
* @param landLineNumber Land-line number to remove
*/
private void removeFromContacts (final DialableLandLineNumber landLineNumber) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: landLineNumber={1} - CALLED!", this.getClass().getSimpleName(), landLineNumber)); //NOI18N
+
// Is it valid?
if (null == landLineNumber) {
// Throw NPE
// Loop through all contacts
for (final Contact contact : this.contacts) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1},contact.contactLandLineNumber={2}", this.getClass().getSimpleName(), contact, contact.getContactLandLineNumber())); //NOI18N
+
// Is the number set?
if (Objects.equals(contact.getContactLandLineNumber(), landLineNumber)) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting landLineNumber={1} ...", this.getClass().getSimpleName(), landLineNumber)); //NOI18N
+
// Found it
contact.setContactLandLineNumber(null);
}
*/
private void removeFromContacts (final DialableMobileNumber mobileNumber) {
// Log message
- System.out.println(MessageFormat.format("{0}.removeFromContacts: CALLED!", this.getClass().getSimpleName())); //NOI18N
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
// Is it valid?
if (null == mobileNumber) {
// Loop through all contacts
for (final Contact contact : this.contacts) {
// Log message
- System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1}", this.getClass().getSimpleName(), contact)); //NOI18N
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1},contact.contactMobileNumber={2}", this.getClass().getSimpleName(), contact, contact.getContactMobileNumber())); //NOI18N
// Is the number set?
if (Objects.equals(contact.getContactMobileNumber(), mobileNumber)) {
// Log message
- System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting ...", this.getClass().getSimpleName())); //NOI18N
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting mobileNumber={1} ...", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
// Unset it
contact.setContactMobileNumber(null);