// Fire event
this.addedContactEvent.fire(new AdminContactAddedEvent(updatedContact));
+ // Clear this bean
+ this.clear();
+
// Return outcome
return "admin_list_contact"; //NOI18N
}
import org.mxchange.jcontacts.contact.UserContact;
import org.mxchange.jcontacts.contact.gender.Gender;
import org.mxchange.jcontacts.contact.utils.ContactUtils;
+import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcountry.data.Country;
import java.util.List;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.gender.Gender;
+import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
import org.mxchange.jcountry.data.Country;
*/
void updateContactDataFromController (final Contact userContact);
- /**
- * Adds given email address to list
- * <p>
- * @param contactEmailAddress Email address to add
- */
- void addEmailAddress (final String contactEmailAddress);
-
/**
* Tries to lookup contact by given id number. If the user is not found a
* proper exceptions are thrown.
*/
void afterRegistrationEvent (final UserRegisteredEvent event);
+ /**
+ * Observes events being fired when an administrator has added a new
+ * contact.
+ * <p>
+ * @param event Event being fired
+ */
+ void afterAdminAddedContact (final AdminAddedContactEvent event);
+
/**
* Event observer for updated contact data by admins
* <p>
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
-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.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
import java.io.Serializable;
import java.util.List;
import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
*/
boolean isContactFound (final Contact contact);
+ /**
+ * Observes events being fired when an administrator has added a new
+ * contact.
+ * <p>
+ * @param event Event being fired
+ */
+ void afterAdminAddedContact (final AdminAddedContactEvent event);
+
/**
* Checks whether a public user account is registered. This means that at
* least one user profile has its flag "public user profile" enabled.