import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController;
import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
+import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
}
}
+ @Override
+ public void afterAdminAddedContact (@Observes final AdminAddedContactEvent event) {
+ // The event must be valid
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getAddedContact()== null) {
+ // Throw again ...
+ throw new NullPointerException("event.addedContact is null"); //NOI18N
+ } else if (event.getAddedContact().getContactId() == null) {
+ // ... and again
+ throw new NullPointerException("event.addedContact.customerId is null"); //NOI18N
+ } else if (event.getAddedContact().getContactId() < 1) {
+ // Not valid
+ throw new IllegalArgumentException(MessageFormat.format("event.addedContact.customerId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N //NOI18N
+ }
+
+ // Call other method
+ this.selectableContacts.add(event.getAddedContact());
+ }
+
@Override
public void afterAdminAddedUserEvent (@Observes final AdminAddedUserEvent event) {
// Trace message
List<User> allUsers = this.allUsers();
// Get all contacts
- List<Contact> allContacts = this.contactController.allContacts();
+ List<Contact> allContacts = this.contactBean.getAllContacts();
// Get iterator
Iterator<Contact> iterator = allContacts.iterator();