- opps, somehow by that big cherry-pick, these changes got lost, now fully fixed
Signed-off-by: Roland Häder <roland@mxchange.org>
package org.mxchange.addressbook.beans.contact.phone;
import java.text.MessageFormat;
+import java.util.Calendar;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
*/
private static final long serialVersionUID = 542_145_347_916L;
+ /**
+ * Administrative EJB for phone number
+ */
+ private AdminContactsPhoneSessionBeanRemote adminContactPhoneBean;
+
/**
* Event being fired when a fax number has been linked
*/
@Any
private Event<ObservableAdminLinkedMobileNumberEvent> adminLinkedMobileNumberEvent;
- /**
- * Administrative EJB for phone number
- */
- private AdminContactsPhoneSessionBeanRemote adminPhoneBean;
-
/**
* Administrative phone controller
*/
@Inject
private AddressbookWebRequestHelperController beanHelper;
+ /**
+ * Contact instance
+ */
+ private Contact contact;
/**
* Area code (city dial prefix) for fax number
* Fax number
*/
private Long faxNumber;
+
/**
* Event being fired when a fax number has been unlinked
*/
* Land-line number
*/
private Long landLineNumber;
+
/**
* Event being fired when a land-line number has been unlinked
*/
* Mobile number
*/
private Long mobileNumber;
+
/**
- * Event being fired when admin unlinks mobile from contact
+ * Event being fired when administrator unlinks mobile from contact
*/
@Inject
@Any
private Event<ObservableAdminUnlinkedMobileNumberEvent> mobileNumberUnlinkedEvent;
+
/**
* Mobile provider
*/
private MobileProvider mobileProvider;
+ /**
+ * When fax number has been created
+ */
+ private Calendar phoneEntryCreated;
+
+ /**
+ * When fax number has been updated
+ */
+ private Calendar phoneEntryUpdated;
+
+ /**
+ * Phone id (primary key)
+ */
+ private Long phoneId;
+
/**
* Default constructor
*/
*/
public String doLinkMainFaxNumber () {
// Get contact from helper
- Contact contact = this.beanHelper.getContact();
+ Contact targetContact = this.getContact();
// Is all data properly set?
- if (null == contact) {
+ if (null == targetContact) {
// Throw NPE
- throw new NullPointerException("contact is null"); //NOI18N
- } else if (contact.getContactId() == null) {
+ throw new NullPointerException("targetContact is null"); //NOI18N
+ } else if (targetContact.getContactId() == null) {
// Throw it again
- throw new NullPointerException("contact.contactId is null"); //NOI18N
- } else if (contact.getContactId() < 1) {
+ throw new NullPointerException("targetContact.contactId is null"); //NOI18N
+ } else if (targetContact.getContactId() < 1) {
// Is not valid
- throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
} else if (this.getFaxCountry() == null) {
// Throw NPE again
throw new NullPointerException("this.faxCountry is null"); //NOI18N
// Try it again
try {
// Link it, too
- updatedContact = this.adminPhoneBean.linkNewFaxNumberWithContact(contact, number);
+ updatedContact = this.adminContactPhoneBean.linkNewFaxNumberWithContact(targetContact, number);
} catch (final PhoneNumberAlreadyLinkedException ex) {
// Throw again as cause
this.showFacesMessage("form_add_contact_fax:faxNumber", ex); //NOI18N
*/
public String doLinkMainLandLineNumber () {
// Get contact from helper
- Contact contact = this.beanHelper.getContact();
+ Contact targetContact = this.getContact();
// Is all data properly set?
- if (null == contact) {
+ if (null == targetContact) {
// Throw NPE
- throw new NullPointerException("contact is null"); //NOI18N
- } else if (contact.getContactId() == null) {
+ throw new NullPointerException("targetContact is null"); //NOI18N
+ } else if (targetContact.getContactId() == null) {
// Throw it again
- throw new NullPointerException("contact.contactId is null"); //NOI18N
- } else if (contact.getContactId() < 1) {
+ throw new NullPointerException("targetContact.contactId is null"); //NOI18N
+ } else if (targetContact.getContactId() < 1) {
// Is not valid
- throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
} else if (this.getLandLineCountry() == null) {
// Throw NPE again
throw new NullPointerException("this.landLineCountry is null"); //NOI18N
// Try it again
try {
// Link it, too
- updatedContact = this.adminPhoneBean.linkNewLandLineNumberWithContact(contact, number);
+ updatedContact = this.adminContactPhoneBean.linkNewLandLineNumberWithContact(targetContact, number);
} catch (final PhoneNumberAlreadyLinkedException ex) {
// Throw again as cause
this.showFacesMessage("form_add_contact_landLine:landLineNumber", ex); //NOI18N
*/
public String doLinkMainMobileNumber () {
// Get contact from helper
- Contact contact = this.beanHelper.getContact();
+ Contact targetContact = this.getContact();
// Is all data properly set?
- if (null == contact) {
+ if (null == targetContact) {
// Throw NPE
- throw new NullPointerException("contact is null"); //NOI18N
- } else if (contact.getContactId() == null) {
+ throw new NullPointerException("targetContact is null"); //NOI18N
+ } else if (targetContact.getContactId() == null) {
// Throw it again
- throw new NullPointerException("contact.contactId is null"); //NOI18N
- } else if (contact.getContactId() < 1) {
+ throw new NullPointerException("targetContact.contactId is null"); //NOI18N
+ } else if (targetContact.getContactId() < 1) {
// Is not valid
- throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
} else if (this.getMobileProvider() == null) {
// Throw NPE
throw new NullPointerException("this.mobileProvider is null"); //NOI18N
// Try it again
try {
// Link it, too
- updatedContact = this.adminPhoneBean.linkNewMobileNumberWithContact(contact, number);
+ updatedContact = this.adminContactPhoneBean.linkNewMobileNumberWithContact(targetContact, number);
} catch (final PhoneNumberAlreadyLinkedException ex) {
// Throw again as cause
this.showFacesMessage("form_add_contact_mobile:mobileNumber", ex); //NOI18N
return "admin_show_contact"; //NOI18N
}
+ /**
+ * Getter for contact instance
+ * <p>
+ * @return Contact instance
+ */
+ public Contact getContact () {
+ return this.contact;
+ }
+
+ /**
+ * Setter for contact instance
+ * <p>
+ * @param contact Contact instance
+ */
+ public void setContact (final Contact contact) {
+ this.contact = contact;
+ }
+
/**
* Getter for fax area code
* <p>
this.landLineNumber = landLineNumber;
}
-
/**
* Getter for mobile number
* <p>
public void setMobileNumber (final Long mobileNumber) {
this.mobileNumber = mobileNumber;
}
+
/**
* Getter for mobile provider
* <p>
public MobileProvider getMobileProvider () {
return this.mobileProvider;
}
+
/**
* Setter for mobile provider
* <p>
this.mobileProvider = mobileProvider;
}
+ /**
+ * Setter for phone id
+ * <p>
+ * @return Phone id
+ */
+ public Long getPhoneId () {
+ return this.phoneId;
+ }
+
+ /**
+ * Getter for phone id
+ * <p>
+ * @param phoneId Phone id
+ */
+ public void setPhoneId (final Long phoneId) {
+ this.phoneId = phoneId;
+ }
+
/**
* Post-construction method
*/
Context context = new InitialContext();
// Try to lookup the beans
- this.adminPhoneBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminContactPhone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
+ this.adminContactPhoneBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminContactPhone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
} catch (final NamingException e) {
// Throw again
throw new FaceletException(e);
* @return Redirect outcome
*/
public String unlinkFaxContactData () {
+ // Create fax number instance
+ DialableFaxNumber number = this.createFaxNumber();
+
// Is all data set
- if (this.beanHelper.getFaxNumber() == null) {
+ if (number == null) {
// Not set, throw NPE
- throw new NullPointerException("this.beanHelper.faxNumber is null"); //NOI18N
- } else if (this.beanHelper.getFaxNumber().getPhoneId() == null) {
+ throw new NullPointerException("number is null"); //NOI18N
+ } else if (number.getPhoneId() == null) {
// Throw NPE again
- throw new NullPointerException("this.beanHelper.faxNumber.phoneId is null"); //NOI18N
- } else if (this.beanHelper.getFaxNumber().getPhoneId() < 1) {
+ throw new NullPointerException("number.phoneId is null"); //NOI18N
+ } else if (number.getPhoneId() < 1) {
// Invalid number
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.faxNumber.phoneId={0} is not valid", this.beanHelper.getFaxNumber().getPhoneId())); //NOI18N
- } else if (this.beanHelper.getFaxNumber().getPhoneNumber() == null) {
+ throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
+ } else if (number.getPhoneNumber() == null) {
// Throw NPE again
- throw new NullPointerException("this.beanHelper.faxNumber.phoneNumber is null"); //NOI18N
- } else if (this.beanHelper.getFaxNumber().getPhoneNumber() < 1) {
+ throw new NullPointerException("number.phoneNumber is null"); //NOI18N
+ } else if (number.getPhoneNumber() < 1) {
// Throw it again ...
- throw new NullPointerException(MessageFormat.format("this.beanHelper.faxNumber.phoneNumber={0} is not valid.", this.beanHelper.getFaxNumber().getPhoneNumber())); //NOI18N
- } else if (this.beanHelper.getContact() == null) {
+ throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
+ } else if (this.getContact() == null) {
// ... and throw again
- throw new NullPointerException("this.beanHelper.contact is null"); //NOI18N
- } else if (this.beanHelper.getContact().getContactId() == null) {
+ throw new NullPointerException("this.contact is null"); //NOI18N
+ } else if (this.getContact().getContactId() == null) {
// ... and again ...
- throw new NullPointerException("this.beanHelper.contact.contactId is null"); //NOI18N
- } else if (this.beanHelper.getContact().getContactId() < 1) {
+ throw new NullPointerException("this.contact.contactId is null"); //NOI18N
+ } else if (this.getContact().getContactId() < 1) {
// Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.contact.contactId={0} is invalid.", this.beanHelper.getContact().getContactId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
}
// Init contact instance
try {
// Unlink it and return contact without fax instance
- updatedContact = this.adminPhoneBean.unlinkFaxDataFromContact(this.beanHelper.getContact(), this.beanHelper.getFaxNumber());
+ updatedContact = this.adminContactPhoneBean.unlinkFaxDataFromContact(this.getContact(), number);
} catch (final PhoneNumberNotLinkedException ex) {
// Did not work
this.showFacesMessage("form_unlink_contact_fax:faxNumberId", ex); //NOI18N
}
// Fire event
- this.faxNumberUnlinkedEvent.fire(new AdminUnlinkedFaxNumberEvent(updatedContact, this.beanHelper.getFaxNumber()));
+ this.faxNumberUnlinkedEvent.fire(new AdminUnlinkedFaxNumberEvent(updatedContact, number));
// All fine here
return "admin_show_contact"; //NOI18N
* @return Redirect outcome
*/
public String unlinkLandLineContactData () {
+ // Create fax number instance
+ DialableLandLineNumber number = this.createLandLineNumber();
+
// Is all data set
- if (this.beanHelper.getLandLineNumber() == null) {
+ if (number == null) {
// Not set, throw NPE
- throw new NullPointerException("this.beanHelper.landLineNumber is null"); //NOI18N
- } else if (this.beanHelper.getLandLineNumber().getPhoneId() == null) {
+ throw new NullPointerException("number is null"); //NOI18N
+ } else if (number.getPhoneId() == null) {
// Throw NPE again
- throw new NullPointerException("this.beanHelper.landLineNumber.phoneId is null"); //NOI18N
- } else if (this.beanHelper.getLandLineNumber().getPhoneId() < 1) {
+ throw new NullPointerException("number.phoneId is null"); //NOI18N
+ } else if (number.getPhoneId() < 1) {
// Invalid number
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.landLineNumber.phoneId={0} is not valid", this.beanHelper.getLandLineNumber().getPhoneId())); //NOI18N
- } else if (this.beanHelper.getLandLineNumber().getPhoneNumber() == null) {
+ throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
+ } else if (number.getPhoneNumber() == null) {
// Throw NPE again
- throw new NullPointerException("this.beanHelper.landLineNumber.phoneNumber is null"); //NOI18N
- } else if (this.beanHelper.getLandLineNumber().getPhoneNumber() < 1) {
+ throw new NullPointerException("number.phoneNumber is null"); //NOI18N
+ } else if (number.getPhoneNumber() < 1) {
// Throw it again ...
- throw new NullPointerException(MessageFormat.format("this.beanHelper.landLineNumber.phoneNumber={0} is not valid.", this.beanHelper.getLandLineNumber().getPhoneNumber())); //NOI18N
- } else if (this.beanHelper.getContact() == null) {
+ throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
+ } else if (this.getContact() == null) {
// ... and throw again
- throw new NullPointerException("this.beanHelper.contact is null"); //NOI18N
- } else if (this.beanHelper.getContact().getContactId() == null) {
+ throw new NullPointerException("this.contact is null"); //NOI18N
+ } else if (this.getContact().getContactId() == null) {
// ... and again ...
- throw new NullPointerException("this.beanHelper.contact.contactId is null"); //NOI18N
- } else if (this.beanHelper.getContact().getContactId() < 1) {
+ throw new NullPointerException("this.contact.contactId is null"); //NOI18N
+ } else if (this.getContact().getContactId() < 1) {
// Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.contact.contactId={0} is invalid.", this.beanHelper.getContact().getContactId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
}
// Init contact instance
try {
// Unlink it and return contact without landLine instance
- updatedContact = this.adminPhoneBean.unlinkLandLineDataFromContact(this.beanHelper.getContact(), this.beanHelper.getLandLineNumber());
+ updatedContact = this.adminContactPhoneBean.unlinkLandLineDataFromContact(this.getContact(), number);
} catch (final PhoneNumberNotLinkedException ex) {
// Did not work
this.showFacesMessage("form_unlink_contact_landLine:landLineNumberId", ex); //NOI18N
}
// Fire event
- this.landLineNumberUnlinkedEvent.fire(new AdminUnlinkedLandLineNumberEvent(updatedContact, this.beanHelper.getLandLineNumber()));
+ this.landLineNumberUnlinkedEvent.fire(new AdminUnlinkedLandLineNumberEvent(updatedContact, number));
// All fine here
return "admin_show_contact"; //NOI18N
* @return Redirect outcome
*/
public String unlinkMobileContactData () {
+ // Create fax number instance
+ DialableMobileNumber number = this.createMobileNumber();
+
// Is all data set
- if (this.beanHelper.getMobileNumber() == null) {
+ if (number == null) {
// Not set, throw NPE
- throw new NullPointerException("this.beanHelper.mobileNumber is null"); //NOI18N
- } else if (this.beanHelper.getMobileNumber().getPhoneId() == null) {
+ throw new NullPointerException("number is null"); //NOI18N
+ } else if (number.getPhoneId() == null) {
// Throw NPE again
- throw new NullPointerException("this.beanHelper.mobileNumber.phoneId is null"); //NOI18N
- } else if (this.beanHelper.getMobileNumber().getPhoneId() < 1) {
+ throw new NullPointerException("number.phoneId is null"); //NOI18N
+ } else if (number.getPhoneId() < 1) {
// Invalid number
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.mobileNumber.phoneId={0} is not valid", this.beanHelper.getMobileNumber().getPhoneId())); //NOI18N
- } else if (this.beanHelper.getMobileNumber().getMobileProvider() == null) {
+ throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
+ } else if (number.getMobileProvider() == null) {
// Throw NPE
- throw new NullPointerException("this.beanHelper.mobileNumber.mobileProvider is null"); //NOI18N
- } else if (this.beanHelper.getMobileNumber().getMobileProvider().getProviderId() == null) {
+ throw new NullPointerException("number.mobileProvider is null"); //NOI18N
+ } else if (number.getMobileProvider().getProviderId() == null) {
// ... throw again
- throw new NullPointerException("this.beanHelper.mobileNumber.mobileProvider.providerId is null"); //NOI18N
- } else if (this.beanHelper.getMobileNumber().getMobileProvider().getProviderId() < 1) {
+ throw new NullPointerException("number.mobileProvider.providerId is null"); //NOI18N
+ } else if (number.getMobileProvider().getProviderId() < 1) {
// Id not valid
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.mobileNumber.mobileProvider.providerId={0} is not valid.", this.beanHelper.getMobileNumber().getMobileProvider().getProviderId())); //NOI18N
- } else if (this.beanHelper.getMobileNumber().getPhoneNumber() == null) {
+ throw new IllegalArgumentException(MessageFormat.format("number.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
+ } else if (number.getPhoneNumber() == null) {
// Throw NPE again
- throw new NullPointerException("this.beanHelper.mobileNumber.phoneNumber is null"); //NOI18N
- } else if (this.beanHelper.getMobileNumber().getPhoneNumber() < 1) {
+ throw new NullPointerException("number.phoneNumber is null"); //NOI18N
+ } else if (number.getPhoneNumber() < 1) {
// Throw it again ...
- throw new NullPointerException(MessageFormat.format("this.beanHelper.mobileNumber.phoneNumber={0} is not valid.", this.beanHelper.getMobileNumber().getPhoneNumber())); //NOI18N
- } else if (this.beanHelper.getContact() == null) {
+ throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
+ } else if (this.getContact() == null) {
// ... and throw again
- throw new NullPointerException("this.beanHelper.contact is null"); //NOI18N
- } else if (this.beanHelper.getContact().getContactId() == null) {
+ throw new NullPointerException("this.contact is null"); //NOI18N
+ } else if (this.getContact().getContactId() == null) {
// ... and again ...
- throw new NullPointerException("this.beanHelper.contact.contactId is null"); //NOI18N
- } else if (this.beanHelper.getContact().getContactId() < 1) {
+ throw new NullPointerException("this.contact.contactId is null"); //NOI18N
+ } else if (this.getContact().getContactId() < 1) {
// Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.contact.contactId={0} is invalid.", this.beanHelper.getContact().getContactId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
}
// Init contact instance
try {
// Unlink it and return contact without mobile instance
- updatedContact = this.adminPhoneBean.unlinkMobileDataFromContact(this.beanHelper.getContact(), this.beanHelper.getMobileNumber());
+ updatedContact = this.adminContactPhoneBean.unlinkMobileDataFromContact(this.getContact(), number);
} catch (final PhoneNumberNotLinkedException ex) {
// Did not work
this.showFacesMessage("form_unlink_contact_mobile:mobileNumberId", ex); //NOI18N
}
// Fire event
- this.mobileNumberUnlinkedEvent.fire(new AdminUnlinkedMobileNumberEvent(updatedContact, this.beanHelper.getMobileNumber()));
+ this.mobileNumberUnlinkedEvent.fire(new AdminUnlinkedMobileNumberEvent(updatedContact, number));
// All fine here
return "admin_show_contact"; //NOI18N
* Clears this bean
*/
private void clear () {
- // @TODO Clear all data
+ // Clear all data
+ }
+
+ /**
+ * Creates an instance of a DialableFaxNumber class
+ * <p>
+ * @return DialableFaxNumber class
+ */
+ private DialableFaxNumber createFaxNumber () {
+ // Instanciate it
+ DialableFaxNumber number = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+
+ // Set all other fields
+ number.setPhoneEntryCreated(this.getPhoneEntryCreated());
+ number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
+
+ // Is id number there?
+ if (this.getPhoneId() instanceof Long) {
+ // Set it
+ number.setPhoneId(this.getPhoneId());
+ }
+
+ // Return it
+ return number;
+ }
+
+ /**
+ * Returns an instance of a DialableLandLineNumber from all fields stored in
+ * this bean.
+ * <p>
+ * @return An instance of a DialableLandLineNumber class
+ */
+ private DialableLandLineNumber createLandLineNumber () {
+ // Initialize it
+ DialableLandLineNumber number = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+
+ // Add all other data
+ number.setPhoneEntryCreated(this.getPhoneEntryCreated());
+ number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
+
+ // Is id number set?
+ if (this.getPhoneId() instanceof Long) {
+ // Set it
+ number.setPhoneId(this.getPhoneId());
+ }
+
+ // Return it
+ return number;
+ }
+
+ /**
+ * Returns an instance of a DialableMobileNumber from all fields stored in
+ * this bean.
+ * <p>
+ * @return An instance of a DialableMobileNumber class
+ */
+ private DialableMobileNumber createMobileNumber () {
+ // Initialize it
+ DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+
+ // Add all other data
+ number.setPhoneEntryCreated(this.getPhoneEntryCreated());
+ number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
+
+ // Is id number set?
+ if (this.getPhoneId() instanceof Long) {
+ // Set it
+ number.setPhoneId(this.getPhoneId());
+ }
+
+ // Return it
+ return number;
+ }
+
+ /**
+ * Getter for phone entry created
+ * <p>
+ * @param faxNumberEntryCreated Phone entry created
+ */
+ @SuppressWarnings ("ReturnOfDateField")
+ private Calendar getPhoneEntryCreated () {
+ return this.phoneEntryCreated;
+ }
+
+ /**
+ * Setter for phone entry created
+ * <p>
+ * @param phoneEntryCreated Phone entry created
+ */
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ private void setPhoneEntryCreated (final Calendar phoneEntryCreated) {
+ this.phoneEntryCreated = phoneEntryCreated;
+ }
+
+ /**
+ * Getter for phone entry updated
+ * <p>
+ * @return Phone entry updated
+ */
+ @SuppressWarnings ("ReturnOfDateField")
+ private Calendar getPhoneEntryUpdated () {
+ return this.phoneEntryUpdated;
+ }
+
+ /**
+ * Setter for phone entry updated
+ * <p>
+ * @param phoneEntryUpdated Phone entry updated
+ */
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ private void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) {
+ this.phoneEntryUpdated = phoneEntryUpdated;
}
}
*/
private final Map<DialableNumber, List<Contact>> contacts;
+ /**
+ * fax number
+ */
+ private DialableFaxNumber faxNumber;
+
+ /**
+ * land-line number
+ */
+ private DialableLandLineNumber landLineNumber;
+
+ /**
+ * Chosen mobile number
+ */
+ private DialableMobileNumber mobileNumber;
+
/**
* Default constructor
*/
*/
public List<Contact> allCurrentFaxNumberContacts () {
// Get id
- DialableFaxNumber faxNumber = this.beanHelper.getFaxNumber();
+ DialableFaxNumber number = this.getFaxNumber();
// Is cache there?
- if (this.contacts.containsKey(faxNumber)) {
+ if (this.contacts.containsKey(number)) {
// Return cached version
- return this.contacts.get(faxNumber);
+ return this.contacts.get(number);
} else {
// Ask bean
List<Contact> list = new LinkedList<>();
// "Walk" through all contacts
for (final Contact contact : this.contactController.allContacts()) {
// Is mobile instance the same?
- if (Objects.equals(contact.getContactFaxNumber(), faxNumber)) {
+ if (Objects.equals(contact.getContactFaxNumber(), number)) {
// Found one
list.add(contact);
}
}
// Store result in cache
- this.contacts.put(faxNumber, list);
+ this.contacts.put(number, list);
// Return now-cached list
return list;
*/
public List<Contact> allCurrentLandLineNumberContacts () {
// Get id
- DialableLandLineNumber landLineNumber = this.beanHelper.getLandLineNumber();
+ DialableLandLineNumber number = this.getLandLineNumber();
// Is cache there?
- if (this.contacts.containsKey(landLineNumber)) {
+ if (this.contacts.containsKey(number)) {
// Return cached version
- return this.contacts.get(landLineNumber);
+ return this.contacts.get(number);
} else {
// Ask bean
List<Contact> list = new LinkedList<>();
// "Walk" through all contacts
for (final Contact contact : this.contactController.allContacts()) {
// Is mobile instance the same?
- if (Objects.equals(contact.getContactLandLineNumber(), landLineNumber)) {
+ if (Objects.equals(contact.getContactLandLineNumber(), number)) {
// Found one
list.add(contact);
}
}
// Store result in cache
- this.contacts.put(landLineNumber, list);
+ this.contacts.put(number, list);
// Return now-cached list
return list;
*/
public List<Contact> allCurrentMobileNumberContacts () {
// Get id
- DialableMobileNumber mobileNumber = this.beanHelper.getMobileNumber();
+ DialableMobileNumber number = this.getMobileNumber();
// Is cache there?
- if (this.contacts.containsKey(mobileNumber)) {
+ if (this.contacts.containsKey(number)) {
// Return cached version
- return this.contacts.get(mobileNumber);
+ return this.contacts.get(number);
} else {
// Ask bean
List<Contact> list = new LinkedList<>();
// "Walk" through all contacts
for (final Contact contact : this.contactController.allContacts()) {
// Is mobile instance the same?
- if (Objects.equals(contact.getContactMobileNumber(), mobileNumber)) {
+ if (Objects.equals(contact.getContactMobileNumber(), number)) {
// Found one
list.add(contact);
}
}
// Store result in cache
- this.contacts.put(mobileNumber, list);
+ this.contacts.put(number, list);
// Return now-cached list
return list;
}
}
+ /**
+ * Getter for chosen fax number
+ * <p>
+ * @return fax number
+ */
+ public DialableFaxNumber getFaxNumber () {
+ return this.faxNumber;
+ }
+
+ /**
+ * Setter for chosen fax number
+ * <p>
+ * @param faxNumber fax number
+ */
+ public void setFaxNumber (final DialableFaxNumber faxNumber) {
+ this.faxNumber = faxNumber;
+ }
+
+ /**
+ * Getter for chosen land-line number
+ * <p>
+ * @return land-line number
+ */
+ public DialableLandLineNumber getLandLineNumber () {
+ return this.landLineNumber;
+ }
+
+ /**
+ * Setter for chosen land-line number
+ * <p>
+ * @param landLineNumber land-line number
+ */
+ public void setLandLineNumber (final DialableLandLineNumber landLineNumber) {
+ this.landLineNumber = landLineNumber;
+ }
+
+ /**
+ * Getter for chosen mobile number
+ * <p>
+ * @return mobile number
+ */
+ public DialableMobileNumber getMobileNumber () {
+ return this.mobileNumber;
+ }
+
+ /**
+ * Setter for chosen mobile number
+ * <p>
+ * @param mobileNumber mobile number
+ */
+ public void setMobileNumber (final DialableMobileNumber mobileNumber) {
+ this.mobileNumber = mobileNumber;
+ }
+
/**
* Clears this bean
*/
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.events.contact.created.CreatedContactEvent;
import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
-import org.mxchange.jphone.events.helper.fax.created.HelperCreatedFaxNumberEvent;
-import org.mxchange.jphone.events.helper.fax.created.ObservableHelperCreatedFaxNumberEvent;
-import org.mxchange.jphone.events.helper.landline.created.HelperCreatedLandLineNumberEvent;
-import org.mxchange.jphone.events.helper.landline.created.ObservableHelperCreatedLandLineNumberEvent;
+import org.mxchange.jphone.events.fax.created.CreatedFaxNumberEvent;
+import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
+import org.mxchange.jphone.events.landline.created.CreatedLandLineNumberEvent;
+import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent;
import org.mxchange.jphone.events.mobile.created.CreatedMobileNumberEvent;
import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
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.helper.created.HelperCreatedUserEvent;
-import org.mxchange.jusercore.events.user.helper.created.ObservableHelperCreatedUserEvent;
+import org.mxchange.jusercore.events.user.created.CreatedUserEvent;
+import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
import org.mxchange.jusercore.model.user.User;
/**
*/
@Any
@Inject
- private Event<ObservableHelperCreatedFaxNumberEvent> faxNumberCreatedEvent;
+ private Event<ObservableCreatedFaxNumberEvent> faxNumberCreatedEvent;
/**
* Land-line number
*/
@Any
@Inject
- private Event<ObservableHelperCreatedLandLineNumberEvent> landLineNumberCreatedEvent;
+ private Event<ObservableCreatedLandLineNumberEvent> landLineNumberCreatedEvent;
/**
* Mobile number
*/
@Any
@Inject
- private Event<ObservableHelperCreatedUserEvent> userCreatedEvent;
+ private Event<ObservableCreatedUserEvent> userCreatedEvent;
/**
* Default constructor
}
// Fire event
- this.faxNumberCreatedEvent.fire(new HelperCreatedFaxNumberEvent(this.getFaxNumber()));
+ this.faxNumberCreatedEvent.fire(new CreatedFaxNumberEvent(this.getFaxNumber()));
}
/**
}
// Fire event
- this.landLineNumberCreatedEvent.fire(new HelperCreatedLandLineNumberEvent(this.getLandLineNumber()));
+ this.landLineNumberCreatedEvent.fire(new CreatedLandLineNumberEvent(this.getLandLineNumber()));
}
/**
this.setPhoneInstances(userContact);
// Fire event
- this.userCreatedEvent.fire(new HelperCreatedUserEvent(this.getUser()));
+ this.userCreatedEvent.fire(new CreatedUserEvent(this.getUser()));
}
/**
@Inject
private AddressbookWebRequestHelperController beanHelper;
+ /**
+ * Contact instance
+ */
+ private Contact contact;
+
/**
* Regular contact controller
*/
private AddressbookContactWebSessionController contactController;
/**
- * Event being fired when admin has deleted user
+ * Event being fired when administrator has deleted user
*/
@Inject
@Any
@Any
private Event<ObservableAdminUpdatedUserDataEvent> updatedUserDataEvent;
+ /**
+ * User instance
+ */
+ private User user;
+
/**
* General user EJB
*/
* @return Redirect outcome
*/
public String addUser () {
- // Get contact from bean helper to "cache" it locally
- Contact contact = this.beanHelper.getContact();
-
// As the form cannot validate the data (required="true"), check it here
if (this.getUserName() == null) {
// Throw NPE
} else if (this.getUserName().isEmpty()) {
// Is empty
throw new IllegalArgumentException("userName is null"); //NOI18N
- } else if (contact == null) {
+ } else if (this.getContact() == null) {
// No contact instance set, so test required fields: gender, first name and family name
this.adminContactController.validateContactData();
}
// Create new user instance
- User user = new LoginUser();
+ User newUser = new LoginUser();
// Set user name, CONFIRMED and INVISIBLE
- user.setUserName(this.getUserName());
- user.setUserMustChangePassword(this.getUserMustChangePassword());
- user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
- user.setUserProfileMode(ProfileMode.INVISIBLE);
+ newUser.setUserName(this.getUserName());
+ newUser.setUserMustChangePassword(this.getUserMustChangePassword());
+ newUser.setUserAccountStatus(UserAccountStatus.CONFIRMED);
+ newUser.setUserProfileMode(ProfileMode.INVISIBLE);
// Copy user locale
- user.setUserLocale(this.localizationController.getLocale());
+ newUser.setUserLocale(this.localizationController.getLocale());
// Init instance
Contact userContact;
// Is a contact instance in helper set?
- if (contact instanceof Contact) {
+ if (this.getContact() instanceof Contact) {
// Then use it for contact linking
- userContact = contact;
+ userContact = this.getContact();
} else {
// Create contact instance
userContact = this.contactController.createContactInstance();
}
// Set contact in user
- user.setUserContact(userContact);
+ newUser.setUserContact(userContact);
// Init variable for password
String password = null;
// Is the user name or email address used already?
// @TODO Add password length check
- if (this.userController.isUserNameRegistered(user)) {
+ if (this.userController.isUserNameRegistered(newUser)) {
// User name is already used
- throw new FaceletException(new UserNameAlreadyRegisteredException(user));
- } else if ((contact == null) && (this.contactController.isEmailAddressRegistered(user.getUserContact()))) {
+ throw new FaceletException(new UserNameAlreadyRegisteredException(newUser));
+ } else if ((this.getContact() == null) && (this.contactController.isEmailAddressRegistered(newUser.getUserContact()))) {
// Email address is already used
this.showFacesMessage("admin_add_user:emailAddress", "ERROR_EMAIL_ADDRESS_ALREADY_USED"); //NOI18N
password = UserLoginUtils.createRandomPassword(AddressbookUserWebSessionController.MINIMUM_PASSWORD_LENGTH);
} else if (!this.isSamePasswordEntered()) {
// Both passwords don't match
- throw new FaceletException(new UserPasswordRepeatMismatchException(user));
+ throw new FaceletException(new UserPasswordRepeatMismatchException(newUser));
} else {
// Both match, so get it from this bean
password = this.getUserPassword();
assert (password.length() >= AddressbookUserWebSessionController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N
// Encrypt password and set it
- user.setUserEncryptedPassword(UserLoginUtils.encryptPassword(password));
+ newUser.setUserEncryptedPassword(UserLoginUtils.encryptPassword(password));
try {
// Now, that all is set, call EJB
- if (contact instanceof Contact) {
+ if (this.getContact() instanceof Contact) {
// Link contact with this user
- User updatedUser = this.adminUserBean.linkUser(user);
+ User updatedUser = this.adminUserBean.linkUser(newUser);
// Fire event
this.userLinkedEvent.fire(new AdminLinkedUserEvent(updatedUser));
} else {
// Add new contact
- User updatedUser = this.adminUserBean.addUser(user);
+ User updatedUser = this.adminUserBean.addUser(newUser);
// Fire event
this.addedUserEvent.fire(new AdminAddedUserEvent(updatedUser));
}
// Clear helper
- this.beanHelper.setContact(null);
+ this.setContact(null);
// Clear this bean
this.clear();
throw new NullPointerException(MessageFormat.format("event.createdUser.userId={0} is not valid", event.getCreatedUser().getUserId())); //NOI18N
}
- // Get user instance
- User user = event.getCreatedUser();
-
- // Set all fields here
- this.setUserName(user.getUserName());
- this.setUserLockReason(user.getUserLastLockedReason());
+ // Set whole user
+ this.setUser(event.getCreatedUser());
}
/**
* @return Redirect outcome
*/
public String deleteUserData () {
- // Get user instance into local variable
- User user = this.beanHelper.getUser();
-
// Is the user instance valid and CONFIRMED?
- if (null == user) {
+ if (this.getUser() == null) {
// Throw NPE
throw new NullPointerException("user is null"); //NOI18N
- } else if (user.getUserId() == null) {
+ } else if (this.getUser().getUserId() == null) {
// Throw again
throw new NullPointerException("user.userId is null"); //NOI18N
- } else if (user.getUserId() < 1) {
+ } else if (this.getUser().getUserId() < 1) {
// Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", this.getUser().getUserId())); //NOI18N
}
try {
// All fine, delete it
- this.adminUserBean.deleteUser(user, this.getUserDeleteReason());
+ this.adminUserBean.deleteUser(this.getUser(), this.getUserDeleteReason());
} catch (final UserNotFoundException ex) {
// Should not happen, so throw again
throw new FaceletException(ex);
}
// Fire event
- this.deleteUserEvent.fire(new AdminDeletedUserEvent(user, this.getUserDeleteReason()));
+ this.deleteUserEvent.fire(new AdminDeletedUserEvent(this.getUser(), this.getUserDeleteReason()));
// Redirect
return "admin_list_user"; //NOI18N
* @return Redirect outcome
*/
public String editUserData () {
- // Get user instance
- User user = this.beanHelper.getUser();
-
// Null password means not setting it
String encryptedPassword = null;
// Check if user instance is in helper and valid
- if (null == user) {
+ if (this.getUser() == null) {
// Throw NPE
throw new NullPointerException("beanHelper.user is null"); //NOI18N
- } else if (user.getUserId() == null) {
+ } else if (this.getUser().getUserId() == null) {
// Throw NPE again
throw new NullPointerException("beanHelper.user.userId is null"); //NOI18N
- } else if (user.getUserId() < 1) {
+ } else if (this.getUser().getUserId() < 1) {
// Invalid id
- throw new IllegalStateException(MessageFormat.format("beanHelper.user.userId={0} is invalid", user.getUserId())); //NOI18N
+ throw new IllegalStateException(MessageFormat.format("beanHelper.user.userId={0} is invalid", this.getUser().getUserId())); //NOI18N
} else if (this.getUserName() == null) {
// Not all required fields are set
throw new NullPointerException("this.userName is null"); //NOI18N
// Not same password entered
this.showFacesMessage("form_edit_user:userPassword", "ADMIN_USER_PASSWORD_REPEAT_DIFFERENT"); //NOI18N
return ""; //NOI18N
- } else if ((!Objects.equals(user.getUserName(), this.getUserName())) && (this.userBean.ifUserNameExists(this.getUserName()))) {
+ } else if ((!Objects.equals(this.getUser().getUserName(), this.getUserName())) && (this.userBean.ifUserNameExists(this.getUserName()))) {
// Clear all fields
this.clear();
return ""; //NOI18N
} else if (this.isSamePasswordEntered()) {
// Same password entered, create container
- if ((Objects.equals(user.getUserMustChangePassword(), this.getUserMustChangePassword())) && (UserLoginUtils.ifPasswordMatches(new UserLoginContainer(user, this.getUserPassword())))) {
+ if ((Objects.equals(this.getUser().getUserMustChangePassword(), this.getUserMustChangePassword())) && (UserLoginUtils.ifPasswordMatches(new UserLoginContainer(this.getUser(), this.getUserPassword())))) {
// Clear password fields
this.setUserPassword(null);
this.setUserPasswordRepeat(null);
}
// Set user name and flag
- user.setUserName(this.getUserName());
- user.setUserMustChangePassword(this.getUserMustChangePassword());
+ this.getUser().setUserName(this.getUserName());
+ this.getUser().setUserMustChangePassword(this.getUserMustChangePassword());
// Is a password set?
if (encryptedPassword != null) {
// Set it as well
- user.setUserEncryptedPassword(encryptedPassword);
+ this.getUser().setUserEncryptedPassword(encryptedPassword);
}
// Call EJB for updating user data
- User updatedUser = this.userBean.updateUserData(user);
+ User updatedUser = this.userBean.updateUserData(this.getUser());
// Fire event
this.updatedUserDataEvent.fire(new AdminUpdatedUserDataEvent(updatedUser));
return "admin_list_user"; //NOI18N
}
+ /**
+ * Getter for contact instance
+ * <p>
+ * @return Contact instance
+ */
+ public Contact getContact () {
+ return this.contact;
+ }
+
+ /**
+ * Setter for contact instance
+ * <p>
+ * @param contact Contact instance
+ */
+ public void setContact (final Contact contact) {
+ this.contact = contact;
+ }
+
+ /**
+ * Getter for user instance
+ * <p>
+ * @return User instance
+ */
+ public User getUser () {
+ return this.user;
+ }
+
+ /**
+ * Setter for user instance
+ * <p>
+ * @param user User instance
+ */
+ public void setUser (final User user) {
+ this.user = user;
+ }
+
/**
* Getter for user delete reason
* <p>
Context context = new InitialContext();
// Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
- this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
+ this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+ this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
} catch (final NamingException e) {
// Throw again
throw new FaceletException(e);
* @return Redirect outcome
*/
public String lockUserAccount () {
- // Get user instance
- User user = this.beanHelper.getUser();
-
// Is the user instance valid and CONFIRMED?
- if (null == user) {
+ if (this.getUser() == null) {
// Throw NPE
- throw new NullPointerException("user is null"); //NOI18N
- } else if (user.getUserId() == null) {
+ throw new NullPointerException("this.user is null"); //NOI18N
+ } else if (this.getUser().getUserId() == null) {
// Throw again
- throw new NullPointerException("user.userId is null"); //NOI18N
- } else if (user.getUserId() < 1) {
+ throw new NullPointerException("this.user.userId is null"); //NOI18N
+ } else if (this.getUser().getUserId() < 1) {
// Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
- } else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
+ throw new IllegalArgumentException(MessageFormat.format("this.user.userId={0} is not valid", this.getUser().getUserId())); //NOI18N
+ } else if (this.getUser().getUserAccountStatus() == UserAccountStatus.LOCKED) {
// User account is locked
- throw new FacesException(new UserStatusLockedException(user));
- } else if (user.getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
+ throw new FacesException(new UserStatusLockedException(this.getUser()));
+ } else if (this.getUser().getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
// User account is locked
- throw new FaceletException(new UserStatusUnconfirmedException(user));
+ throw new FaceletException(new UserStatusUnconfirmedException(this.getUser()));
} else if (this.getUserLockReason() == null) {
// Throw NPE again
throw new NullPointerException("this.userLockReason is null"); //NOI18N
String baseUrl = FacesUtils.generateBaseUrl();
// Call EJB to lock account
- updatedUser = this.adminUserBean.lockUserAccount(user, this.getUserLockReason(), baseUrl);
+ updatedUser = this.adminUserBean.lockUserAccount(this.getUser(), this.getUserLockReason(), baseUrl);
} catch (final UserStatusLockedException | UserStatusUnconfirmedException | UserNotFoundException ex) {
// Throw again
throw new FaceletException(ex);
* @return Redirect outcome
*/
public String unlockUserAccount () {
- // Get user instance
- User user = this.beanHelper.getUser();
-
// Is the user instance valid and CONFIRMED?
- if (null == user) {
+ if (this.getUser() == null) {
// Throw NPE
- throw new NullPointerException("user is null"); //NOI18N
- } else if (user.getUserId() == null) {
+ throw new NullPointerException("this.user is null"); //NOI18N
+ } else if (this.getUser().getUserId() == null) {
// Throw again
- throw new NullPointerException("user.userId is null"); //NOI18N
- } else if (user.getUserId() < 1) {
+ throw new NullPointerException("this.user.userId is null"); //NOI18N
+ } else if (this.getUser().getUserId() < 1) {
// Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
- } else if (user.getUserAccountStatus() == UserAccountStatus.CONFIRMED) {
+ throw new IllegalArgumentException(MessageFormat.format("this.user.userId={0} is not valid", this.getUser().getUserId())); //NOI18N
+ } else if (this.getUser().getUserAccountStatus() == UserAccountStatus.CONFIRMED) {
// User account is locked
- throw new FacesException(new UserStatusConfirmedException(user));
- } else if (user.getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
+ throw new FacesException(new UserStatusConfirmedException(this.getUser()));
+ } else if (this.getUser().getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
// User account is locked
- throw new FaceletException(new UserStatusUnconfirmedException(user));
+ throw new FaceletException(new UserStatusUnconfirmedException(this.getUser()));
}
// Init updated user instance
String baseUrl = FacesUtils.generateBaseUrl();
// Call EJB to unlock account
- updatedUser = this.adminUserBean.unlockUserAccount(user, baseUrl);
+ updatedUser = this.adminUserBean.unlockUserAccount(this.getUser(), baseUrl);
} catch (final UserStatusConfirmedException | UserStatusUnconfirmedException | UserNotFoundException ex) {
// Throw again
throw new FaceletException(ex);
*/
private void clear () {
// Clear all data
- // - other data
- this.setUserName(null);
- this.setUserPassword(null);
- this.setUserPasswordRepeat(null);
+ this.setContact(null);
+ this.setUserLockReason(null);
this.setUserMustChangePassword(null);
+ this.setUserName(null);
}
/**
import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent;
import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent;
+import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
Context context = new InitialContext();
// Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+ this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
} catch (final NamingException e) {
// Throw again
throw new FaceletException(e);
import org.mxchange.jcoreee.events.helper.clear.HelperCleanupEvent;
import org.mxchange.jcoreee.events.helper.clear.ObservableHelperCleanupEvent;
import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.user.created.CreatedUserEvent;
+import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
import org.mxchange.jusercore.exceptions.UserStatusLockedException;
import org.mxchange.jusercore.model.user.User;
@Inject
private AddressbookUserWebSessionController userController;
+ /**
+ * Event for when a user instance was created
+ */
+ @Any
+ @Inject
+ private Event<ObservableCreatedUserEvent> userCreatedEvent;
+
/**
* Default constructor
*/
Context context = new InitialContext();
// Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+ this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
} catch (final NamingException e) {
// Throw again
throw new FaceletException(e);
// Debug message
System.out.println(MessageFormat.format("{0}.confirmUserAccount: updatedUser={1}", this.getClass().getSimpleName(), updatedUser)); //NOI18N
- // Set it again in helper
- this.beanHelper.setUser(updatedUser);
-
- // ... and copy it to the controller
- this.beanHelper.copyUserToController();
+ // Fire event
+ this.userCreatedEvent.fire(new CreatedUserEvent(updatedUser));
// Trace message
System.out.println(MessageFormat.format("{0}.confirmUserAccount: EXIT!", this.getClass().getSimpleName())); //NOI18N