*/
private final ContactSessionBeanRemote contactBean;
+ /**
+ * General contact controller
+ */
+ @Inject
+ private AddressbookContactWebSessionController contactController;
+
/**
* Contact id
*/
return this.contactController.allContacts();
}
- @Override
- public String changeContactData () {
- // Get contact instance
- Contact contact = this.adminHelper.getContact();
-
- // Default is not same contact
- if (this.isSameContactFound(contact)) {
- // Already registered
- throw new FaceletException(new ContactAlreadyAddedException(contact));
- }
-
- // Init contact
- Contact updatedContact;
-
- // Try to call EJB
- try {
- // Call EJB
- updatedContact = this.contactBean.addContact(contact);
- } catch (final ContactAlreadyAddedException ex) {
- // Throw again
- throw new FaceletException(ex);
- }
-
- // Fire event
- this.addedContactEvent.fire(new AdminContactAddedEvent(updatedContact));
-
- // Clear this bean
- this.clear();
-
- // Return outcome
- return "admin_list_contact"; //NOI18N
- }
-
@Override
public void copyContactToController (final Contact contact) {
// The contact instance must be valid
this.zipCode = zipCode;
}
+ @Override
+ public boolean hasContacts () {
+ return (!this.allContacts().isEmpty());
+ }
+
/**
* Post-initialization of this class
*/
@Override
public void afterAdminUpdatedContactDataEvent (@Observes final AdminUpdatedContactEvent event) {
// Trace message
- System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N
// event should not be null
if (null == event) {
@Override
public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) {
// Trace message
- System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
// event should not be null
if (null == event) {
Contact registeredContact = event.getRegisteredUser().getUserContact();
// Debug message
- System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: registeredContact={0}", registeredContact)); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: registeredContact={0}", registeredContact)); //NOI18N
// Copy all data from registered->user
this.copyContact(registeredContact);
this.clear();
// Trace message
- System.out.println("ContactWebBean:afterRegistration: EXIT!"); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterRegistration: EXIT!"); //NOI18N
}
@Override
public void afterUserLogin (final @Observes UserLoggedInEvent event) {
// Trace message
- System.out.println(MessageFormat.format("ContactWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
// event should not be null
if (null == event) {
this.copyContact(event.getLoggedInUser().getUserContact());
// Trace message
- System.out.println("ContactWebBean:afterUserLogin - EXIT!"); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterUserLogin - EXIT!"); //NOI18N
}
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ @Override
public List<Contact> allContacts () {
return this.contactList;
}
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.gender.Gender;
import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
*/
public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
+ /**
+ * Returns a list of all found contacts
+ * <p>
+ * @return A list of all contacts.
+ */
+ List<Contact> allContacts();
+
/**
* Updates all data from bean in given contact instance
* <p>