import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote;
import org.mxchange.jaddressbookcore.events.addressbook.AddressbookLoadedEvent;
+import org.mxchange.jaddressbookcore.events.addressbook.ObservableAddressbookLoadedEvent;
import org.mxchange.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException;
import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException;
import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook;
import org.mxchange.jaddressbookcore.model.addressbook.entry.AddressbookEntry;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jaddressbookcore.events.addressbook.ObservableAddressbookLoadedEvent;
import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
+import org.mxchange.jusercore.model.user.User;
/**
* An address book bean (controller)
* Default constructor
*/
public AddressbookWebSessionBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Init list
AddressbookWebSessionBean.countSharesList = new ConcurrentHashMap<>(0);
}
}
@Override
+ @SuppressWarnings ("ReturnOfDateField")
public Calendar getAddressbookCreated () {
return this.addressbookCreated;
}
@Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
public void setAddressbookCreated (final Calendar addressbookCreated) {
this.addressbookCreated = addressbookCreated;
}
*/
@PostConstruct
public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+
// Init list
this.usersAddressbooks = new LinkedList<>();
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import org.mxchange.addressbook.beans.helper.AddressbookWebRequestController;
import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
import org.mxchange.jusercore.exceptions.UserStatusLockedException;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
/**
* A web request bean for confirmation link handling
/**
* Remote user bean
*/
- private final UserSessionBeanRemote userBean;
+ private UserSessionBeanRemote userBean;
/**
* User controller
* Default constructor
*/
public AddressbookConfirmationLinkWebRequestBean () {
+ }
+
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
// Try it
try {
// Get initial context
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.add.ObservableAdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jphone.phonenumbers.DialableNumber;
import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
/**
* An administrative user bean (controller)
/**
* Remote contact bean
*/
- private final ContactSessionBeanRemote contactBean;
+ private ContactSessionBeanRemote contactBean;
/**
* General contact controller
* Default constructor
*/
public AddressbookAdminContactWebRequestBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
}
@Override
*/
@PostConstruct
public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
}
@Override
*/
private Date birthday;
- /**
- * Mobile number's carrier
- */
- private MobileProvider mobileCarrier;
-
- /**
- * Mobile number
- */
- private Long mobileNumber;
-
/**
* City
*/
/**
* Remote contact bean
*/
- private final ContactSessionBeanRemote contactBean;
+ private ContactSessionBeanRemote contactBean;
/**
* Contact list
*/
private String houseNumberExtension;
+ /**
+ * Whether a fax entry has been unlinked
+ */
+ private boolean isFaxUnlinked;
+
+ /**
+ * Whether a land-line number has been unlinked
+ */
+ private boolean isLandLineUnlinked;
+
/**
* Whether a mobile entry has been unlinked
*/
private boolean isMobileUnlinked;
/**
- * Whether a fax entry has been unlinked
+ * Mobile number's carrier
*/
- private boolean isFaxUnlinked;
+ private MobileProvider mobileCarrier;
/**
- * Whether a land-line number has been unlinked
+ * Mobile number
*/
- private boolean isLandLineUnlinked;
+ private Long mobileNumber;
/**
* Phone number area code
* Default constructor
*/
public AddressbookContactWebSessionBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Init lists/maps
this.contactList = new LinkedList<>();
this.emailAddressList = new LinkedList<>();
//* NOISY-DEBUG: */ System.out.println("contactController.afterAdminUpdatedContactDataEvent(): EXIT!"); //NOI18N
}
- /**
- * Event observer for new user registrations
- * <p>
- * @param event User registration event
- */
- public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent 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();
- }
-
/**
* Event observer when user confirmed account.
* <p>
this.copyContact(event.getLoggedInUser().getUserContact());
}
+ /**
+ * Event observer for new user registrations
+ * <p>
+ * @param event User registration event
+ */
+ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent 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
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
public List<Contact> allContacts () {
this.birthday = birthday;
}
- @Override
- public MobileProvider getMobileCarrier () {
- return this.mobileCarrier;
- }
-
- @Override
- public void setMobileCarrier (final MobileProvider mobileCarrier) {
- this.mobileCarrier = mobileCarrier;
- }
-
- @Override
- public Long getMobileNumber () {
- return this.mobileNumber;
- }
-
- @Override
- public void setMobileNumber (final Long mobileNumber) {
- this.mobileNumber = mobileNumber;
- }
-
@Override
public String getCity () {
return this.city;
this.houseNumberExtension = houseNumberExtension;
}
+ @Override
+ public MobileProvider getMobileCarrier () {
+ return this.mobileCarrier;
+ }
+
+ @Override
+ public void setMobileCarrier (final MobileProvider mobileCarrier) {
+ this.mobileCarrier = mobileCarrier;
+ }
+
+ @Override
+ public Long getMobileNumber () {
+ return this.mobileNumber;
+ }
+
+ @Override
+ public void setMobileNumber (final Long mobileNumber) {
+ this.mobileNumber = mobileNumber;
+ }
+
@Override
public Integer getPhoneAreaCode () {
return this.phoneAreaCode;
}
/**
- * Post-initialization of this class
+ * Post-construction method
*/
@PostConstruct
public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+
// Get full email address list for reducing EJB calls
this.emailAddressList.addAll(this.contactBean.getEmailAddressList());
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.faces.view.facelets.FaceletException;
* Default constructor
*/
public AddressbookContactPhoneWebSessionBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the beans
- this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminphone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Init lists/maps
this.contacts = new HashMap<>(10);
}
}
}
+ @PostConstruct
+ public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup the beans
+ this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminphone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+ }
+
/**
* Clears this bean
*/
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import org.mxchange.jcountry.data.CountryData;
import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
import org.mxchange.jcountry.events.AdminAddedCountryEvent;
-import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
/**
* An administrative country bean
* Default constructor
*/
public AddressbookAdminCountryWebRequestBean () {
- // Try this
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the bean
- this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
- } catch (final NamingException ex) {
- // Continue to throw
- throw new FaceletException(ex);
- }
}
@Override
this.countryPhoneCode = countryPhoneCode;
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ // Try this
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup the bean
+ this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
+ } catch (final NamingException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+ }
+
/**
* Clears this bean's data. This should be called after a form has been
* submitted and the processing of the form was successful.
* Default constructor
*/
public AddressbookCountryWebApplicationBean () {
- // Try this
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the bean
- this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
- } catch (final NamingException ex) {
- // Continue to throw
- throw new FaceletException(ex);
- }
}
/**
}
/**
- * Post-initialization of this class
+ * Post-construction method
*/
@PostConstruct
public void init () {
+ // Try this
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup the bean
+ this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
+ } catch (final NamingException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+
// "Cache" country list as this will not change so often.
this.countryList = this.countryBean.allCountries();
}
import java.text.MessageFormat;
import java.util.List;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
/**
* Remote email change bean
*/
- private final UserEmailChangeSessionBeanRemote emailBean;
+ private UserEmailChangeSessionBeanRemote emailBean;
/**
* Features controller
* Default constructor
*/
public AddressbookEmailChangeWebSessionBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.emailBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/addressbook-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
-
- // Init list
- this.emailAddresses = this.emailBean.allQueuedAddresses();
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
}
@Override
this.emailAddressRepeat = emailAddressRepeat;
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.emailBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/addressbook-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
+
+ // Init list
+ this.emailAddresses = this.emailBean.allQueuedAddresses();
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+ }
+
@Override
public boolean isRequiredChangeEmailAddressSet () {
return ((this.getEmailAddress() != null) &&
*/
package org.mxchange.addressbook.beans.features;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import org.mxchange.addressbook.beans.BaseAddressbookController;
*/
private static final long serialVersionUID = 64_237_512_690_168_674L;
+ /**
+ * Default constructor
+ */
+ public AddressbookFeatureWebApplicationBean () {
+ }
+
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ }
+
@Override
public boolean isFeatureEnabled (final String feature) {
// The parameter must be set
package org.mxchange.addressbook.beans.gender;
import java.util.List;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import org.mxchange.addressbook.beans.BaseAddressbookController;
return genders;
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ }
+
}
package org.mxchange.addressbook.beans.helper;
import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
}
/**
- * Set's all given contact's phone instances: land-line, cellphone and fax
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ }
+
+ /**
+ * Set's all given contact's phone instances: land-line, mobile and fax
* <p>
* @param contact Contact to set phone instances for
*/
// Is cellphone set?
if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
// Yes, then set it in admin controller
- this.adminPhoneController.setCellPhone(contact.getContactMobileNumber());
+ this.adminPhoneController.setMobileNumber(contact.getContactMobileNumber());
}
// Is land-line set?
*/
private Locale locale;
+ /**
+ * Default constructor
+ */
+ public AddressbookLocalizationSessionBean () {
+ }
+
/**
* Event observer for logged-in user
* <p>
import java.util.Collections;
import java.util.List;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
* Default constructor
*/
public AddressbookUserLoginWebSessionBean () {
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userLoginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/addressbook-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
-
- // Also find this
- this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/addressbook-ejb/userPasswordHistory!org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote"); //NOI18N
-
- // Defaul template is guest
- this.baseTemplatePathName = GUEST_BASE_TEMPLATE_NAME;
- } catch (final NamingException ex) {
- // Continue to throw
- throw new FaceletException(ex);
- }
+ // Defaul template is guest
+ this.baseTemplatePathName = GUEST_BASE_TEMPLATE_NAME;
}
/**
return (this.isUserLoggedIn() && this.getLoggedInUser().getUserMustChangePassword());
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.userLoginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/addressbook-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
+
+ // Also find this
+ this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/addressbook-ejb/userPasswordHistory!org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote"); //NOI18N
+ } catch (final NamingException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+ }
+
@Override
public boolean isInvisible () {
// Check on login
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
* Default constructor
*/
public AddressbookAdminMobileProviderWebRequestBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the beans
- this.adminRemoteBean = (AdminMobileProviderSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw it again
- throw new FaceletException(e);
- }
}
@Override
this.providerName = providerName;
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup the beans
+ this.adminRemoteBean = (AdminMobileProviderSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw it again
+ throw new FaceletException(e);
+ }
+ }
+
/**
* Checks whether if the given mobile provider is already created by
* checking both dial prefix and country.
* Default constructor
*/
public AddressbookMobileProviderWebRequestBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the beans
- this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw it again
- throw new FaceletException(e);
- }
}
/**
if (null == event) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getAddedMobileProvider()== null) {
+ } else if (event.getAddedMobileProvider() == null) {
// Throw again ...
throw new NullPointerException("event.addedMobileProvider is null"); //NOI18N
- } else if (event.getAddedMobileProvider().getProviderId()== null) {
+ } else if (event.getAddedMobileProvider().getProviderId() == null) {
// And again ...
throw new NullPointerException("event.addedMobileProvider.providerId is null"); //NOI18N
} else if (event.getAddedMobileProvider().getProviderId() < 1) {
}
/**
- * Initializer method
+ * Post-construction method
*/
@PostConstruct
public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup the beans
+ this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw it again
+ throw new FaceletException(e);
+ }
+
// Init list of mobile providers
this.mobileProviders = this.mobileRemoteBean.allMobileProvider();
}
*/
package org.mxchange.addressbook.beans.phone;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
import javax.naming.NamingException;
import org.mxchange.addressbook.beans.BaseAddressbookController;
import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
/**
* Administrative bean (controller) for phone numbers
*/
private AdminContactsPhoneSessionBeanRemote adminPhoneBean;
- /**
- * Cell phone number
- */
- private DialableMobileNumber cellPhone;
-
/**
* Fax number
*/
*/
private DialableLandLineNumber landLine;
+ /**
+ * Cell phone number
+ */
+ private DialableMobileNumber mobileNumber;
+
/**
* Default constructor
*/
public AddressbookAdminPhoneWebRequestBean () {
- // Try it
- try {
- // Get initial context
- 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
- } catch (final NamingException e) {
- // Throw it again
- throw new FaceletException(e);
- }
- }
-
- @Override
- public DialableMobileNumber getMobileNumber () {
- return this.cellPhone;
- }
-
- @Override
- public void setCellPhone (final DialableMobileNumber cellPhone) {
- this.cellPhone = cellPhone;
}
@Override
this.landLine = landLine;
}
+ @Override
+ public DialableMobileNumber getMobileNumber () {
+ return this.mobileNumber;
+ }
+
+ @Override
+ public void setMobileNumber (final DialableMobileNumber mobileNumber) {
+ this.mobileNumber = mobileNumber;
+ }
+
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ // Try it
+ try {
+ // Get initial context
+ 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
+ } catch (final NamingException e) {
+ // Throw it again
+ throw new FaceletException(e);
+ }
+ }
+
}
* <p>
* @param cellPhone Dialable cellphone number instance
*/
- void setCellPhone (final DialableMobileNumber cellPhone);
+ void setMobileNumber (final DialableMobileNumber cellPhone);
/**
* Getter for dialable cellphone number instance
package org.mxchange.addressbook.beans.profile;
import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
*/
private static final long serialVersionUID = 187_687_145_286_710L;
+ /**
+ * User controller
+ */
+ @Inject
+ private AddressbookUserWebSessionController userController;
+
/**
* Login controller
*/
private AddressbookUserLoginWebSessionController userLoginController;
/**
- * User controller
+ * Default constructor
*/
- @Inject
- private AddressbookUserWebSessionController userController;
+ public AddressbookUserProfileWebRequestBean () {
+ }
+
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ }
@Override
public boolean isProfileLinkVisibleById (final Long userId) {
*/
package org.mxchange.addressbook.beans.profilemode;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import org.mxchange.addressbook.beans.BaseAddressbookController;
// Return it
return ProfileMode.values();
}
+
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ }
+
}
package org.mxchange.addressbook.beans.register;
import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.UserContact;
import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
import org.mxchange.jusercore.exceptions.DataRepeatMismatchException;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.UserUtils;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
/**
* A web bean for user registration
* Default constructor
*/
public AddressbookUserRegisterWebSessionBean () {
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.registerBean = (UserRegistrationSessionBeanRemote) context.lookup("java:global/addressbook-ejb/register!org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote"); //NOI18N
- } catch (final NamingException ex) {
- // Continue to throw
- throw new FaceletException(ex);
- }
}
@Override
return "user_register_page2"; //NOI18N
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.registerBean = (UserRegistrationSessionBeanRemote) context.lookup("java:global/addressbook-ejb/register!org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote"); //NOI18N
+ } catch (final NamingException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+ }
+
}
package org.mxchange.addressbook.beans.resendlink;
import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
* Default constructor
*/
public AddressbookResendLinkWebSessionBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.emailBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/addressbook-ejb/resendLink!org.mxchange.addressbook.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
}
@Override
this.emailAddress = emailAddress;
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.emailBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/addressbook-ejb/resendLink!org.mxchange.addressbook.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+ }
+
/**
* Clears email address fields so the user has to re-enter them
*/
import java.text.MessageFormat;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
/**
* Administrative user EJB
*/
- private final AdminUserSessionBeanRemote adminUserBean;
+ private AdminUserSessionBeanRemote adminUserBean;
/**
* Bean helper instance
/**
* General user EJB
*/
- private final UserSessionBeanRemote userBean;
+ private UserSessionBeanRemote userBean;
/**
* Regular user controller
* Default constructor
*/
public AddressbookAdminUserWebRequestBean () {
- // Try it
- try {
- // Get initial context
- 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
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
}
@Override
this.userPasswordRepeat = userPasswordRepeat;
}
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void init () {
+ // Try it
+ try {
+ // Get initial context
+ 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
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+ }
+
@Override
public String lockUserAccount (final User user) {
// Is the user instance valid and CONFIRMED?
import org.mxchange.addressbook.beans.localization.AddressbookLocalizationSessionController;
import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
*/
private static final long serialVersionUID = 542_145_347_916L;
- /**
- * Contact EJB
- */
- private ContactSessionBeanRemote contactBean;
-
/**
* General contact controller
*/
/**
* Remote user bean
*/
- private final UserSessionBeanRemote userBean;
+ private UserSessionBeanRemote userBean;
/**
* User id
* Default constructor
*/
public AddressbookUserWebSessionBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-
- // Try to lookup
- this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
}
/**
- * Event observer for newly added users by adminstrator
+ * Event observer for newly added users by administrator
* <p>
* @param event Event being fired
*/
*/
@PostConstruct
public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+
// Initialize user list
this.userList = this.userBean.allUsers();
package org.mxchange.addressbook.beans.user.password;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController;
import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
import org.mxchange.jusercore.model.user.UserUtils;
import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
-import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
/**
* A user password (change) bean (controller)
/**
* Remote user bean
*/
- private final UserSessionBeanRemote userBean;
+ private UserSessionBeanRemote userBean;
/**
* Current password (for confirmation of password change)
* Default constructor
*/
public AddressbookUserPasswordWebRequestBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
}
@Override
this.userPasswordRepeat = userPasswordRepeat;
}
+ /**
+ * Post-initialization of this class
+ */
+ @PostConstruct
+ public void init () {
+ // Try it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+ } catch (final NamingException e) {
+ // Throw again
+ throw new FaceletException(e);
+ }
+ }
+
+ @Override
public boolean isRequiredChangePasswordSet () {
// Is all data set?
return ((this.getUserCurrentPassword() != null) &&
void setUserPasswordRepeat (final String userPasswordRepeat);
/**
- * Changes logged-in user's password. It must not match with current password and should not appear in password history list for X (configurable) entries.
+ * Changes logged-in user's password. It must not match with current
+ * password and should not appear in password history list for X
+ * (configurable) entries.
* <p>
* @return Redirect outcome
*/
String doChangePassword ();
+ /**
+ * Checks if all 3 passwords are set: old password, 2x new password
+ * <p>
+ * @return Whether all passwords are set
+ */
+ boolean isRequiredChangePasswordSet ();
+
}