]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 21 Apr 2017 20:17:19 +0000 (22:17 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 22 Apr 2017 19:30:12 +0000 (21:30 +0200)
- let's move EJB-lookup into post-construct method and out of constructors as
  this seems to tricker a bug in Glassfish:
  https://github.com/payara/Payara/issues/1035

Signed-off-by: Roland Häder <roland@mxchange.org>
25 files changed:
src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionController.java
src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/country/JobsAdminCountryWebRequestBean.java
src/java/org/mxchange/jjobs/beans/country/JobsCountryWebApplicationBean.java
src/java/org/mxchange/jjobs/beans/email_address/JobsEmailChangeWebSessionBean.java
src/java/org/mxchange/jjobs/beans/features/JobsFeatureWebApplicationBean.java
src/java/org/mxchange/jjobs/beans/gender/JobsGenderWebApplicationBean.java
src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java
src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java
src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java
src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestController.java
src/java/org/mxchange/jjobs/beans/profile/JobsUserProfileWebRequestBean.java
src/java/org/mxchange/jjobs/beans/profilemode/JobsProfileModeWebApplicationBean.java
src/java/org/mxchange/jjobs/beans/register/JobsUserRegisterWebSessionBean.java
src/java/org/mxchange/jjobs/beans/resendlink/JobsResendLinkWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestController.java

index 6a2565d25948b009e449ec5a0c4d439a1d5da9c9..6ed77d52e4c127823860377099ca62a18768ba07 100644 (file)
@@ -20,6 +20,7 @@ import java.text.MessageFormat;
 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;
@@ -31,15 +32,15 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsController;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 import org.mxchange.jjobs.beans.user.JobsUserWebSessionController;
+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;
-import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * A web request bean for confirmation link handling
@@ -69,7 +70,7 @@ public class JobsConfirmationLinkWebRequestBean extends BaseJobsController imple
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * Event being fired when a user has confirmed the account
@@ -88,6 +89,23 @@ public class JobsConfirmationLinkWebRequestBean extends BaseJobsController imple
         * Default constructor
         */
        public JobsConfirmationLinkWebRequestBean () {
+       }
+
+       @Override
+       public String getConfirmationKey () {
+               return this.confirmationKey;
+       }
+
+       @Override
+       public void setConfirmationKey (final String confirmationKey) {
+               this.confirmationKey = confirmationKey;
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
                // Try it
                try {
                        // Get initial context
@@ -101,16 +119,6 @@ public class JobsConfirmationLinkWebRequestBean extends BaseJobsController imple
                }
        }
 
-       @Override
-       public String getConfirmationKey () {
-               return this.confirmationKey;
-       }
-
-       @Override
-       public void setConfirmationKey (final String confirmationKey) {
-               this.confirmationKey = confirmationKey;
-       }
-
        @Override
        public void maybeConfirmUserAccount () {
                // Is the confirmation key set?
index 29a39907de3f91428b228c3af793ef989687633a..9ffc2b85cff8ad21dbb7d91c3c8b198a0cea5d46 100644 (file)
@@ -37,21 +37,21 @@ 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.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.deleted.AdminDeletedContactEvent;
+import org.mxchange.jcontacts.events.contact.deleted.ObservableAdminDeletedContactEvent;
 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.jjobs.beans.BaseJobsController;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 import org.mxchange.jphone.phonenumbers.DialableNumber;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.deleted.ObservableAdminDeletedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * An administrative user controller (bean)
@@ -103,7 +103,7 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        /**
         * General contact EJB
         */
-       private final ContactSessionBeanRemote contactBean;
+       private ContactSessionBeanRemote contactBean;
 
        /**
         * General contact controller
@@ -254,20 +254,6 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
         * Default constructor
         */
        public JobsAdminContactWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup (general)
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-
-                       // Try to lookup (administative)
-                       this.adminContactBean = (AdminContactSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminContact!org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -773,6 +759,20 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup (general)
+                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+
+                       // Try to lookup (administative)
+                       this.adminContactBean = (AdminContactSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminContact!org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
        }
 
        /**
index 4e4557cd3cebf1ee4979771031a685f4fc459bf7..ccde6746d0b39d0c12c6843344238ce38669611e 100644 (file)
@@ -38,15 +38,12 @@ 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.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.deleted.ObservableAdminDeletedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
 import org.mxchange.jjobs.beans.user.JobsUserWebSessionController;
-import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
@@ -59,6 +56,7 @@ import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
+import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -93,12 +91,12 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        /**
         * Remote contact bean
         */
-       private final ContactSessionBeanRemote contactBean;
+       private ContactSessionBeanRemote contactBean;
 
        /**
         * Contact list
         */
-       private final List<Contact> contacts;
+       private final List<Contact> contactList;
 
        /**
         * Country instance
@@ -111,14 +109,14 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        private String emailAddress;
 
        /**
-        * Email address repeated
+        * Email address list
         */
-       private String emailAddressRepeat;
+       private final List<String> emailAddressList;
 
        /**
-        * Email address list
+        * Email address repeated
         */
-       private final List<String> emailAddresses;
+       private String emailAddressRepeat;
 
        /**
         * Family name
@@ -176,29 +174,29 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        private boolean isMobileUnlinked;
 
        /**
-        * Land-line number area code
+        * Mobile number's carrier
         */
-       private Integer landLineAreaCode;
+       private MobileProvider mobileCarrier;
 
        /**
-        * Country instance for land-line number
+        * Mobile number
         */
-       private Country landLineCountry;
+       private Long mobileNumber;
 
        /**
-        * Land-line number
+        * Phone number area code
         */
-       private Long landLineNumber;
+       private Integer phoneAreaCode;
 
        /**
-        * Mobile number
+        * Country instance for phone number
         */
-       private Long mobileNumber;
+       private Country phoneCountry;
 
        /**
-        * Mobile provider
+        * Phone number
         */
-       private MobileProvider mobileProvider;
+       private Long phoneNumber;
 
        /**
         * A list of all selectable contacts
@@ -222,7 +220,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        private JobsUserWebSessionController userController;
 
        /**
-        * Login controller (bean)
+        * Login bean (controller)
         */
        @Inject
        private JobsUserLoginWebSessionController userLoginController;
@@ -236,21 +234,9 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
         * Default constructor
         */
        public JobsContactWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-
                // Init lists/maps
-               this.contacts = new LinkedList<>();
-               this.emailAddresses = new LinkedList<>();
+               this.contactList = new LinkedList<>();
+               this.emailAddressList = new LinkedList<>();
        }
 
        /**
@@ -272,7 +258,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                        throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
                } else if (event.getAddedContact().getContactId() < 1) {
                        // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N //NOI18N
                }
 
                // Clear this bean
@@ -291,6 +277,9 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
         * @param event Event being fired
         */
        public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
+               // Trace message
+               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedUserEvent(): event={0} - CALLED!", event)); //NOI18N
+
                // event should not be null
                if (null == event) {
                        // Throw NPE
@@ -310,35 +299,6 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                this.clear();
        }
 
-       /**
-        * Event observer for deleted contact instance by administrator
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminDeletedContactEvent (@Observes final ObservableAdminDeletedContactEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getDeletedContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.deletedContact is null"); //NOI18N
-               } else if (event.getDeletedContact().getContactId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.deletedContact.contactId is null"); //NOI18N
-               } else if (event.getDeletedContact().getContactId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getDeletedContact(), event.getDeletedContact().getContactId())); //NOI18N
-               }
-
-               // Remove from both lists
-               this.contacts.remove(event.getDeletedContact());
-               this.selectableContacts.remove(event.getDeletedContact());
-
-               // Clear all data
-               this.clear();
-       }
-
        /**
         * Observes events being fired when an administrator has linked a new user
         * with existing contact data.
@@ -389,76 +349,17 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                        throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
                } else if (event.getUpdatedContact().getContactId() < 1) {
                        // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
                }
 
                // Add contact instance only once
                this.uniqueAddContact(event.getUpdatedContact());
 
                // Add email address to list
-               this.emailAddresses.add(event.getUpdatedContact().getContactEmailAddress());
-       }
-
-       /**
-        * 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 user name and email address
-               this.addUserNameEmailAddress(registeredContact);
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Event observer for unlinked mobile contact by administrators
-        * <p>
-        * @param event Unlinked mobile contact event
-        */
-       public void afterAdminUnlinkedMobileContactDataEvent (@Observes final ObservableAdminUnlinkedMobileNumberEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUnlinkedMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.unlinkedMobileNumber is null"); //NOI18N
-               } else if (event.getUnlinkedMobileNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.unlinkedMobileNumber.contactId is null"); //NOI18N
-               } else if (event.getUnlinkedMobileNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedMobileNumber(), event.getUnlinkedMobileNumber().getPhoneId())); //NOI18N
-               }
-
-               // Remove it from list
-               this.removeFromContacts(event.getUnlinkedMobileNumber());
+               this.emailAddressList.add(event.getUpdatedContact().getContactEmailAddress());
 
-               // Clear all data
-               this.clear();
+               // Trace message
+               //* NOISY-DEBUG: */ System.out.println("contactController.afterAdminUpdatedContactDataEvent(): EXIT!"); //NOI18N
        }
 
        /**
@@ -511,11 +412,48 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                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 () {
                // Return un-modified list
-               return this.contacts;
+               return this.contactList;
        }
 
        @Override
@@ -526,9 +464,12 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                        throw new FaceletException(new IllegalArgumentException("Not all personal data is set, but createContactInstance() is called.")); //NOI18N
                }
 
+               // Required personal data must be set
+               assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
+
                // Generate phone number
-               DialableLandLineNumber phone = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
-               DialableMobileNumber mobile = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               DialableMobileNumber mobile = new MobileNumber(this.getMobileCarrier(), this.getMobileNumber());
                DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Create new contact
@@ -544,7 +485,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                contact.setContactComment(this.getComment());
 
                // Don't set null or wrong references
-               if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
+               if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
                        // Now the number must be given
                        if (phone.getPhoneAreaCode() == null) {
                                // Is null
@@ -586,14 +527,14 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                }
 
                // Is the provider set?
-               if ((mobile instanceof DialableMobileNumber) && (this.getMobileProvider() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
+               if ((mobile instanceof DialableMobileNumber) && (this.getMobileCarrier() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
                        // Is the number set?
                        if (mobile.getPhoneNumber() == null) {
                                // Is null
-                               throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N
+                               throw new NullPointerException("mobile.phoneNumber is null"); //NOI18N
                        } else if (mobile.getPhoneNumber() < 1) {
                                // Abort here
-                               throw new IllegalArgumentException("mobileNumber.phoneNumber is zero or below."); //NOI18N
+                               throw new IllegalArgumentException("mobile.phoneNumber is zero or below."); //NOI18N
                        }
 
                        // Set mobile number
@@ -615,7 +556,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                        throw new FaceletException("Not all required fields are set."); //NOI18N
                } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
                        // Password not matching
-                       this.showFacesMessage("form_login_change_personal:currentPassword", "ERROR_USER_CURRENT_PASSWORD_MISMATCHING"); //NOI18N
+                       this.showFacesMessage("form_login_change_personal:currentPassword", new UserPasswordMismatchException(this.userLoginController.getLoggedInUser())); //NOI18N
                        return ""; //NOI18N
                }
 
@@ -639,10 +580,10 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                contact.setContactCountry(this.getCountry());
 
                // Update contact's mobile number
-               this.isMobileUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber());
+               this.isMobileUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileCarrier(), this.getMobileNumber());
 
                // Update contact's land-line number
-               this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+               this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
 
                // Update contact's fax number
                this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
@@ -651,7 +592,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
 
                // All fine
-               return "user_contact_data_saved"; //NOI18N
+               return "contact_data_saved"; //NOI18N
        }
 
        @Override
@@ -808,53 +749,53 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        }
 
        @Override
-       public Integer getLandLineAreaCode () {
-               return this.landLineAreaCode;
+       public MobileProvider getMobileCarrier () {
+               return this.mobileCarrier;
        }
 
        @Override
-       public void setLandLineAreaCode (final Integer landLineAreaCode) {
-               this.landLineAreaCode = landLineAreaCode;
+       public void setMobileCarrier (final MobileProvider mobileCarrier) {
+               this.mobileCarrier = mobileCarrier;
        }
 
        @Override
-       public Country getLandLineCountry () {
-               return this.landLineCountry;
+       public Long getMobileNumber () {
+               return this.mobileNumber;
        }
 
        @Override
-       public void setLandLineCountry (final Country landLineCountry) {
-               this.landLineCountry = landLineCountry;
+       public void setMobileNumber (final Long mobileNumber) {
+               this.mobileNumber = mobileNumber;
        }
 
        @Override
-       public Long getLandLineNumber () {
-               return this.landLineNumber;
+       public Integer getPhoneAreaCode () {
+               return this.phoneAreaCode;
        }
 
        @Override
-       public void setLandLineNumber (final Long landLineNumber) {
-               this.landLineNumber = landLineNumber;
+       public void setPhoneAreaCode (final Integer phoneAreaCode) {
+               this.phoneAreaCode = phoneAreaCode;
        }
 
        @Override
-       public Long getMobileNumber () {
-               return this.mobileNumber;
+       public Country getPhoneCountry () {
+               return this.phoneCountry;
        }
 
        @Override
-       public void setMobileNumber (Long mobileNumber) {
-               this.mobileNumber = mobileNumber;
+       public void setPhoneCountry (final Country phoneCountry) {
+               this.phoneCountry = phoneCountry;
        }
 
        @Override
-       public MobileProvider getMobileProvider () {
-               return this.mobileProvider;
+       public Long getPhoneNumber () {
+               return this.phoneNumber;
        }
 
        @Override
-       public void setMobileProvider (final MobileProvider mobileProvider) {
-               this.mobileProvider = mobileProvider;
+       public void setPhoneNumber (final Long phoneNumber) {
+               this.phoneNumber = phoneNumber;
        }
 
        @Override
@@ -888,18 +829,30 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        }
 
        /**
-        * 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.emailAddresses.addAll(this.contactBean.getEmailAddressList());
+               this.emailAddressList.addAll(this.contactBean.getEmailAddressList());
 
                // Get all contacts
                List<Contact> allContacts = this.contactBean.getAllContacts();
 
                // Get full contact list
-               this.contacts.addAll(allContacts);
+               this.contactList.addAll(allContacts);
 
                // Get all users
                List<User> allUsers = this.userController.allUsers();
@@ -948,7 +901,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                }
 
                // Determine it
-               return ((this.emailAddresses instanceof List) && (this.emailAddresses.contains(contact.getContactEmailAddress())));
+               return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(contact.getContactEmailAddress())));
        }
 
        @Override
@@ -989,7 +942,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                this.clear();
 
                // Try to lookup it in visible user list
-               for (final Iterator<Contact> iterator = this.contacts.iterator(); iterator.hasNext();) {
+               for (final Iterator<Contact> iterator = this.contactList.iterator(); iterator.hasNext();) {
                        // Get next user
                        Contact next = iterator.next();
 
@@ -1014,34 +967,6 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                return localContact;
        }
 
-       /**
-        * Event observer when a list with unused mobile numbers is being created
-        * <p>
-        * @param event Event being fired
-        */
-       public void removeMobileNumberFromListEvent (@Observes final AdminRemoveMobileNumberFromListEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getMobileNumberList() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.mobileList is null"); //NOI18N
-               } else if (event.getMobileNumberList().isEmpty()) {
-                       // List is empty, no need to check
-                       return;
-               }
-
-               // Check all entries
-               for (final Contact contact : this.contacts) {
-                       // Is the mobile instance set and in list?
-                       if ((contact.getContactMobileNumber() instanceof DialableMobileNumber) && (event.getMobileNumberList().contains(contact.getContactMobileNumber()))) {
-                               // Found it, so remvoe it from list
-                               event.getMobileNumberList().remove(contact.getContactMobileNumber());
-                       }
-               }
-       }
-
        @Override
        public List<Contact> selectableContacts () {
                return Collections.unmodifiableList(this.selectableContacts);
@@ -1072,13 +997,13 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
         */
        private void addUserNameEmailAddress (final Contact contact) {
                // Make sure the entry is not added yet
-               if (this.emailAddresses.contains(contact.getContactEmailAddress())) {
+               if (this.emailAddressList.contains(contact.getContactEmailAddress())) {
                        // Already added
                        throw new IllegalArgumentException(MessageFormat.format("Email address {0} already added.", contact.getContactEmailAddress())); //NOI18N
                }
 
                // Add email addres
-               this.emailAddresses.add(contact.getContactEmailAddress());
+               this.emailAddressList.add(contact.getContactEmailAddress());
        }
 
        /**
@@ -1101,10 +1026,10 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                // - contact data
                this.setEmailAddress(null);
                this.setEmailAddressRepeat(null);
-               this.setLandLineAreaCode(null);
-               this.setLandLineCountry(null);
-               this.setLandLineNumber(null);
-               this.setMobileProvider(null);
+               this.setPhoneAreaCode(null);
+               this.setPhoneCountry(null);
+               this.setPhoneNumber(null);
+               this.setMobileCarrier(null);
                this.setMobileNumber(null);
                this.setFaxAreaCode(null);
                this.setFaxCountry(null);
@@ -1156,13 +1081,13 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
 
                // - contact data
                if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneAreaCode() > 0)) {
-                       this.setLandLineCountry(phone.getPhoneCountry());
-                       this.setLandLineAreaCode(phone.getPhoneAreaCode());
-                       this.setLandLineNumber(phone.getPhoneNumber());
+                       this.setPhoneCountry(phone.getPhoneCountry());
+                       this.setPhoneAreaCode(phone.getPhoneAreaCode());
+                       this.setPhoneNumber(phone.getPhoneNumber());
                }
 
                if ((mobile instanceof DialableMobileNumber) && (mobile.getMobileProvider() instanceof MobileProvider)) {
-                       this.setMobileProvider(mobile.getMobileProvider());
+                       this.setMobileCarrier(mobile.getMobileProvider());
                        this.setMobileNumber(mobile.getPhoneNumber());
                }
 
@@ -1192,124 +1117,13 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                }
 
                // Remove from general list
-               if (!this.contacts.remove(contact)) {
+               if (!this.contactList.remove(contact)) {
                        // Did not remove contact
                        throw new IllegalStateException(MessageFormat.format("contact {0} was not removed.", contact.getContactId())); //NOI18N
                }
 
                // Remove from other lists
-               this.emailAddresses.remove(contact.getContactEmailAddress());
-       }
-
-       /**
-        * Removes given fax number from all contacts
-        * <p>
-        * @param faxNumber Fax number to remove
-        */
-       private void removeFromContacts (final DialableFaxNumber faxNumber) {
-               // Log message
-               System.out.println(MessageFormat.format("{0}.removeFromContacts: faxNumber={1} - CALLED!", this.getClass().getSimpleName(), faxNumber)); //NOI18N
-
-               // Is it valid?
-               if (null == faxNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
-               }
-
-               // Loop through all contacts
-               for (final Contact contact : this.contacts) {
-                       // Log message
-                       System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1},contact.contactFaxNumber={2}", this.getClass().getSimpleName(), contact, contact.getContactFaxNumber())); //NOI18N
-
-                       // Is the number set?
-                       if (Objects.equals(contact.getContactFaxNumber(), faxNumber)) {
-                               // Log message
-                               System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting faxNumber={1} ...", this.getClass().getSimpleName(), faxNumber)); //NOI18N
-
-                               // Found it
-                               contact.setContactFaxNumber(null);
-                       }
-               }
-       }
-
-       /**
-        * Removes given land-line number from all contacts
-        * <p>
-        * @param landLineNumber Land-line number to remove
-        */
-       private void removeFromContacts (final DialableLandLineNumber landLineNumber) {
-               // Log message
-               System.out.println(MessageFormat.format("{0}.removeFromContacts: landLineNumber={1} - CALLED!", this.getClass().getSimpleName(), landLineNumber)); //NOI18N
-
-               // Is it valid?
-               if (null == landLineNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
-               }
-
-               // Loop through all contacts
-               for (final Contact contact : this.contacts) {
-                       // Log message
-                       System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1},contact.contactLandLineNumber={2}", this.getClass().getSimpleName(), contact, contact.getContactLandLineNumber())); //NOI18N
-
-                       // Is the number set?
-                       if (Objects.equals(contact.getContactLandLineNumber(), landLineNumber)) {
-                               // Log message
-                               System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting landLineNumber={1} ...", this.getClass().getSimpleName(), landLineNumber)); //NOI18N
-
-                               // Found it
-                               contact.setContactLandLineNumber(null);
-                       }
-               }
-       }
-
-       /**
-        * Removes given mobile number from all contacts
-        * <p>
-        * @param mobileNumber Mobile number to remove
-        */
-       private void removeFromContacts (final DialableMobileNumber mobileNumber) {
-               // Log message
-               System.out.println(MessageFormat.format("{0}.removeFromContacts: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
-
-               // Is it valid?
-               if (null == mobileNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
-               }
-
-               // Loop through all contacts
-               for (final Contact contact : this.contacts) {
-                       // Log message
-                       System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1},contact.contactMobileNumber={2}", this.getClass().getSimpleName(), contact, contact.getContactMobileNumber())); //NOI18N
-
-                       // Is the number set?
-                       if (Objects.equals(contact.getContactMobileNumber(), mobileNumber)) {
-                               // Log message
-                               System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting mobileNumber={1} ...", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
-
-                               // Unset it
-                               contact.setContactMobileNumber(null);
-                       }
-               }
+               this.emailAddressList.remove(contact.getContactEmailAddress());
        }
 
        /**
@@ -1332,7 +1146,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                }
 
                // Get iterator from list
-               Iterator<Contact> iterator = this.contacts.iterator();
+               Iterator<Contact> iterator = this.contactList.iterator();
 
                // "Walk" through all entries
                while (iterator.hasNext()) {
@@ -1348,7 +1162,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                }
 
                // Add contact to list
-               this.contacts.add(contact);
+               this.contactList.add(contact);
        }
 
 }
index 0da470abb43313560898ee945a7e5c20e9dd153b..b5e2f81f73f53654279abc4b5ed858fb7d8d0242 100644 (file)
@@ -34,6 +34,11 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 @Local
 public interface JobsContactWebSessionController extends Serializable {
 
+       /**
+        * Minimum password length
+        */
+       public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
+
        /**
         * Returns a list of all found contacts
         * <p>
@@ -82,18 +87,18 @@ public interface JobsContactWebSessionController extends Serializable {
        void setBirthday (final Date birthday);
 
        /**
-        * Getter for mobile provider
+        * Getter for mobile number's carrier
         * <p>
-        * @return Mobile provider
+        * @return Mobile number's carrier
         */
-       MobileProvider getMobileProvider ();
+       MobileProvider getMobileCarrier ();
 
        /**
-        * Setter for mobile provider
+        * Setter for mobile number's carrier prefix
         * <p>
-        * @param mobileProvider Mobile provider
+        * @param mobileCarrier Mobile number's carrier prefix
         */
-       void setMobileProvider (final MobileProvider mobileProvider);
+       void setMobileCarrier (final MobileProvider mobileCarrier);
 
        /**
         * Getter for mobile number
@@ -297,42 +302,42 @@ public interface JobsContactWebSessionController extends Serializable {
         * <p>
         * @return Phone number's area code
         */
-       Integer getLandLineAreaCode ();
+       Integer getPhoneAreaCode ();
 
        /**
         * Setter for phone number's area code
         * <p>
         * @param phoneAreaCode Phone number's area code
         */
-       void setLandLineAreaCode (final Integer phoneAreaCode);
+       void setPhoneAreaCode (final Integer phoneAreaCode);
 
        /**
         * Getter for phone number's country instance
         * <p>
         * @return Phone number's country instance
         */
-       Country getLandLineCountry ();
+       Country getPhoneCountry ();
 
        /**
         * Setter for phone number's country instance
         * <p>
         * @param phoneCountry Phone number's country instance
         */
-       void setLandLineCountry (final Country phoneCountry);
+       void setPhoneCountry (final Country phoneCountry);
 
        /**
         * Getter for phone number
         * <p>
         * @return Phone number
         */
-       Long getLandLineNumber ();
+       Long getPhoneNumber ();
 
        /**
         * Setter for phone number
         * <p>
         * @param phoneNumber Phone number
         */
-       void setLandLineNumber (final Long phoneNumber);
+       void setPhoneNumber (final Long phoneNumber);
 
        /**
         * Street
@@ -387,7 +392,6 @@ public interface JobsContactWebSessionController extends Serializable {
         * Setter for controller type
         * <p>
         * @param controllerType Controller type
-        *
         * @deprecated Don't use this method.
         */
        @Deprecated
index 557c4c59a525278c15aa2cd88c9545ce0320f44b..d0a8d1903f8024935d1009f8a7ccc8646b3a450f 100644 (file)
@@ -244,10 +244,10 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl
                } else if (contact.getContactId() < 1) {
                        // Is not valid
                        throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
-               } else if ((this.adminPhoneController.getChoosenFaxNumber() == null) && (this.adminPhoneController.getPhoneCountry() == null) && ((this.adminPhoneController.getPhoneAreaCode() == null) || (this.adminPhoneController.getPhoneAreaCode() < 1)) && ((this.adminPhoneController.getPhoneNumber() == null) || (this.adminPhoneController.getPhoneNumber() < 1))) {
+               } else if ((this.adminPhoneController.getFaxNumber() == null) && (this.adminPhoneController.getPhoneCountry() == null) && ((this.adminPhoneController.getPhoneAreaCode() == null) || (this.adminPhoneController.getPhoneAreaCode() < 1)) && ((this.adminPhoneController.getPhoneNumber() == null) || (this.adminPhoneController.getPhoneNumber() < 1))) {
                        // All fields are empty
                        throw new NullPointerException("choosenFaxNumber, mobileProvider and phoneNumer are null"); //NOI18N
-               } else if ((this.adminPhoneController.getChoosenFaxNumber() instanceof DialableFaxNumber) && (this.adminPhoneController.getPhoneCountry() instanceof Country) && (this.adminPhoneController.getPhoneAreaCode() instanceof Integer) && (this.adminPhoneController.getPhoneNumber() instanceof Long)) {
+               } else if ((this.adminPhoneController.getFaxNumber() instanceof DialableFaxNumber) && (this.adminPhoneController.getPhoneCountry() instanceof Country) && (this.adminPhoneController.getPhoneAreaCode() instanceof Integer) && (this.adminPhoneController.getPhoneNumber() instanceof Long)) {
                        // All fields are set
                        throw new IllegalStateException("choosenFaxNumber, mobileProvider and phoneNumer are all set"); //NOI18N
                } else if ((this.adminPhoneController.getPhoneCountry() == null) && ((this.adminPhoneController.getPhoneAreaCode() instanceof Integer) || (this.adminPhoneController.getPhoneNumber() instanceof Long))) {
@@ -266,7 +266,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl
 
                // Init instances
                Contact updatedContact;
-               DialableFaxNumber faxNumber = this.adminPhoneController.getChoosenFaxNumber();
+               DialableFaxNumber faxNumber = this.adminPhoneController.getFaxNumber();
 
                // Try it again
                try {
@@ -306,10 +306,10 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl
                } else if (contact.getContactId() < 1) {
                        // Is not valid
                        throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
-               } else if ((this.adminPhoneController.getChoosenLandLineNumber() == null) && (this.adminPhoneController.getPhoneCountry() == null) && ((this.adminPhoneController.getPhoneAreaCode() == null) || (this.adminPhoneController.getPhoneAreaCode() < 1)) && ((this.adminPhoneController.getPhoneNumber() == null) || (this.adminPhoneController.getPhoneNumber() < 1))) {
+               } else if ((this.adminPhoneController.getLandLineNumber() == null) && (this.adminPhoneController.getPhoneCountry() == null) && ((this.adminPhoneController.getPhoneAreaCode() == null) || (this.adminPhoneController.getPhoneAreaCode() < 1)) && ((this.adminPhoneController.getPhoneNumber() == null) || (this.adminPhoneController.getPhoneNumber() < 1))) {
                        // All fields are empty
                        throw new NullPointerException("choosenLandLineNumber, mobileProvider and phoneNumer are null"); //NOI18N
-               } else if ((this.adminPhoneController.getChoosenLandLineNumber() instanceof DialableLandLineNumber) && (this.adminPhoneController.getPhoneCountry() instanceof Country) && (this.adminPhoneController.getPhoneAreaCode() instanceof Integer) && (this.adminPhoneController.getPhoneNumber() instanceof Long)) {
+               } else if ((this.adminPhoneController.getLandLineNumber() instanceof DialableLandLineNumber) && (this.adminPhoneController.getPhoneCountry() instanceof Country) && (this.adminPhoneController.getPhoneAreaCode() instanceof Integer) && (this.adminPhoneController.getPhoneNumber() instanceof Long)) {
                        // All fields are set
                        throw new IllegalStateException("choosenLandLineNumber, mobileProvider and phoneNumer are all set"); //NOI18N
                } else if ((this.adminPhoneController.getPhoneCountry() == null) && ((this.adminPhoneController.getPhoneAreaCode() instanceof Integer) || (this.adminPhoneController.getPhoneNumber() instanceof Long))) {
@@ -328,7 +328,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl
 
                // Init instance
                Contact updatedContact;
-               DialableLandLineNumber landLineNumber = this.adminPhoneController.getChoosenLandLineNumber();
+               DialableLandLineNumber landLineNumber = this.adminPhoneController.getLandLineNumber();
 
                // Try it again
                try {
@@ -368,10 +368,10 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl
                } else if (contact.getContactId() < 1) {
                        // Is not valid
                        throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
-               } else if ((this.adminPhoneController.getChoosenMobileNumber() == null) && (this.adminPhoneController.getMobileProvider() == null) && ((this.adminPhoneController.getPhoneNumber() == null) || (this.adminPhoneController.getPhoneNumber() < 1))) {
+               } else if ((this.adminPhoneController.getMobileNumber() == null) && (this.adminPhoneController.getMobileProvider() == null) && ((this.adminPhoneController.getPhoneNumber() == null) || (this.adminPhoneController.getPhoneNumber() < 1))) {
                        // All fields are empty
                        throw new NullPointerException("choosenMobileNumber, mobileProvider and phoneNumer are null"); //NOI18N
-               } else if ((this.adminPhoneController.getChoosenMobileNumber() instanceof DialableMobileNumber) && (this.adminPhoneController.getMobileProvider() instanceof MobileProvider) && (this.adminPhoneController.getPhoneNumber() instanceof Long)) {
+               } else if ((this.adminPhoneController.getMobileNumber() instanceof DialableMobileNumber) && (this.adminPhoneController.getMobileProvider() instanceof MobileProvider) && (this.adminPhoneController.getPhoneNumber() instanceof Long)) {
                        // All fields are set
                        throw new IllegalStateException("choosenMobileNumber, mobileProvider and phoneNumer are all set"); //NOI18N
                } else if ((this.adminPhoneController.getMobileProvider() == null) && (this.adminPhoneController.getPhoneNumber() instanceof Long)) {
@@ -386,7 +386,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl
 
                // Init instance
                Contact updatedContact;
-               DialableMobileNumber mobileNumber = this.adminPhoneController.getChoosenMobileNumber();
+               DialableMobileNumber mobileNumber = this.adminPhoneController.getMobileNumber();
 
                // Try it again
                try {
index 5905c9dd47894b818bcff25d836ed400e17380fb..af393e61524e3d3a9c44c7a5f54bdcd53ee44efb 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jjobs.beans.country;
 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;
@@ -32,9 +33,9 @@ import org.mxchange.jcountry.data.Country;
 import org.mxchange.jcountry.data.CountryData;
 import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
 import org.mxchange.jcountry.events.AdminAddedCountryEvent;
+import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
 import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
 import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
 
 /**
  * An administrative country bean
@@ -102,17 +103,6 @@ public class JobsAdminCountryWebRequestBean extends BaseJobsController implement
         * Default constructor
         */
        public JobsAdminCountryWebRequestBean () {
-               // Try this
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/jjobs-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
        }
 
        @Override
@@ -226,6 +216,24 @@ public class JobsAdminCountryWebRequestBean extends BaseJobsController implement
                return (!this.allCountries().isEmpty());
        }
 
+       /**
+        * 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/jjobs-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.
index 2a14757faaa1139566390f065a760d6b535f0e15..7fd86a2b9369ed8f180477b2f2836ecaf2f0e539 100644 (file)
@@ -59,17 +59,6 @@ public class JobsCountryWebApplicationBean extends BaseJobsController implements
         * Default constructor
         */
        public JobsCountryWebApplicationBean () {
-               // Try this
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/jjobs-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
        }
 
        /**
@@ -106,10 +95,22 @@ public class JobsCountryWebApplicationBean extends BaseJobsController implements
        }
 
        /**
-        * 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/jjobs-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();
        }
index 3e0a591e1f86f67d37a998ac169ced1edb5d23ad..8742b2c98ead62d01f95cc2ccafb44684234eba1 100644 (file)
@@ -70,7 +70,7 @@ public class JobsEmailChangeWebSessionBean extends BaseJobsController implements
        /**
         * Remote email change bean
         */
-       private final UserEmailChangeSessionBeanRemote emailChangeBean;
+       private UserEmailChangeSessionBeanRemote emailChangeBean;
 
        /**
         * Features controller
@@ -88,17 +88,6 @@ public class JobsEmailChangeWebSessionBean extends BaseJobsController implements
         * Default constructor
         */
        public JobsEmailChangeWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.emailChangeBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/jjobs-ejb/userEmailChange!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -186,6 +175,18 @@ public class JobsEmailChangeWebSessionBean extends BaseJobsController implements
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.emailChangeBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/jjobs-ejb/userEmailChange!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+
                // Init list
                this.emailAddresses = this.emailChangeBean.allQueuedAddresses();
        }
index 636e261704dae40ebe7dfd78a93028a3fba74a3b..ab2e88ab239280937f1fc0258412706744aa6cd5 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jjobs.beans.features;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.jjobs.beans.BaseJobsController;
@@ -34,6 +35,19 @@ public class JobsFeatureWebApplicationBean extends BaseJobsController implements
         */
        private static final long serialVersionUID = 64_237_512_690_168_674L;
 
+       /**
+        * Default constructor
+        */
+       public JobsFeatureWebApplicationBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
        @Override
        public boolean isFeatureEnabled (final String feature) {
                // The parameter must be set
index 96bf39b18400b10d78716a30f25b963d768bfe72..0b254a28644dea3ccd8ad42c65748a7f5f8cf554 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.beans.gender;
 
 import java.util.List;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.jcontacts.contact.gender.Gender;
@@ -58,4 +59,11 @@ public class JobsGenderWebApplicationBean extends BaseJobsController implements
                return genders;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
 }
index 5aaa40e97bec06f1537d3adb59761f0141675232..4079e115e9d8fcfece7b4e5284ffceabb11d4c17 100644 (file)
@@ -255,13 +255,13 @@ public class JobsWebRequestHelperBean extends BaseJobsController implements Jobs
                // Validate user instance
                if (this.getUser() == null) {
                        // Throw NPE
-                       throw new NullPointerException("this.user is null");
+                       throw new NullPointerException("this.user is null"); //NOI18N
                } else if (this.getUser().getUserId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("this.user.userId is null");
+                       throw new NullPointerException("this.user.userId is null"); //NOI18N
                } else if (this.getUser().getUserId() < 1) {
                        // Not valid
-                       throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId()));
+                       throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId())); //NOI18N
                }
 
                // Get contact
@@ -309,7 +309,7 @@ public class JobsWebRequestHelperBean extends BaseJobsController implements Jobs
                // Default key is "unused"
                String messageKey = "CONTACT_IS_UNUSED"; //NOI18N
 
-               // Check user
+               // Check user/recruiter
                boolean isUserContact = this.userController.isContactFound(contact);
 
                // Check user first
index 2bed4bfaf6991ea5ebf5e0bad1beee06090fccea..1cad782bd3a8884220940cd8fa4f71c21ed83db0 100644 (file)
@@ -49,6 +49,12 @@ public class JobsLocalizationSessionBean extends BaseJobsController implements J
         */
        private Locale locale;
 
+       /**
+        * Default constructor
+        */
+       public JobsLocalizationSessionBean () {
+       }
+
        /**
         * Event observer for logged-in user
         * <p>
index 528bbfb60ddbe3bd324ae80e6a0842b648e3ab73..3332d03958bc8bc995b88875d6e93a53a8cf33ef 100644 (file)
@@ -20,6 +20,7 @@ import java.text.MessageFormat;
 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;
@@ -87,11 +88,6 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
         */
        private User loggedInUser;
 
-       /**
-        * Remote register session bean
-        */
-       private UserLoginSessionBeanRemote loginBean;
-
        /**
         * Event fired when user has logged in
         */
@@ -115,6 +111,11 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
         */
        private boolean userLoggedIn;
 
+       /**
+        * Remote register session bean
+        */
+       private UserLoginSessionBeanRemote userLoginBean;
+
        /**
         * Event fired when user has logged in
         */
@@ -143,22 +144,8 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
         * Default constructor
         */
        public JobsUserLoginWebSessionBean () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.loginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/jjobs-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
-
-                       // Also find this
-                       this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/jjobs-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;
        }
 
        /**
@@ -215,7 +202,7 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
 
                try {
                        // Call bean
-                       User confirmedUser = this.loginBean.validateUserAccountStatus(container);
+                       User confirmedUser = this.userLoginBean.validateUserAccountStatus(container);
 
                        // All fine here so set it here
                        this.setLoggedInUser(confirmedUser);
@@ -337,6 +324,29 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J
                return ((this.isUserLoggedIn()) && (Objects.equals(this.getLoggedInUser().getUserMustChangePassword(), Boolean.TRUE)));
        }
 
+       /**
+        * 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/jjobs-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
+
+                       // Also find this
+                       this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/jjobs-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);
+               }
+       }
+
        @Override
        public boolean isInvisible () {
                // Check on login
index 4df138957918db0f57750c1f30ba273b0096f68f..bc7c8c4726e07b80f733cc0ef0954b705a36ca65 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jjobs.beans.mobileprovider;
 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;
@@ -93,17 +94,6 @@ public class JobsAdminMobileProviderWebRequestBean extends BaseJobsController im
         * Default constructor
         */
        public JobsAdminMobileProviderWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminRemoteBean = (AdminMobileProviderSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -176,6 +166,24 @@ public class JobsAdminMobileProviderWebRequestBean extends BaseJobsController im
                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/jjobs-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.
index a6406fe3a431fb909f18e2aef35444387b72d274..e47377ce70ac2c0d841c67e7e020bec21bcf4dab 100644 (file)
@@ -59,17 +59,6 @@ public class JobsMobileProviderWebRequestBean extends BaseJobsController impleme
         * Default constructor
         */
        public JobsMobileProviderWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/jjobs-ejb/mobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
        }
 
        /**
@@ -83,10 +72,10 @@ public class JobsMobileProviderWebRequestBean extends BaseJobsController impleme
                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) {
@@ -105,10 +94,22 @@ public class JobsMobileProviderWebRequestBean extends BaseJobsController impleme
        }
 
        /**
-        * 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/jjobs-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();
        }
index a1480619462cc7cbfba45837c202c24f0b4dcbd4..387eb8a0c309c5602bcf01a9c61e68aa5ba18348 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jjobs.beans.phone;
 import java.text.MessageFormat;
 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;
@@ -86,17 +87,17 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
        private JobsWebRequestHelperController beanHelper;
 
        /**
-        * Choosen fax number
+        *  fax number
         */
        private DialableFaxNumber choosenFaxNumber;
 
        /**
-        * Choosen land-line number
+        *  land-line number
         */
        private DialableLandLineNumber choosenLandLineNumber;
 
        /**
-        * Choosen mobile number
+        *  mobile number
         */
        private DialableMobileNumber choosenMobileNumber;
 
@@ -107,13 +108,13 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
        @Any
        private Event<AdminDeletedFaxNumberEvent> faxNumberDeletedEvent;
 
-
        /**
         * Event being fired when an administrator has updated fax number
         */
        @Inject
        @Any
        private Event<AdminUpdatedFaxNumberEvent> faxNumberUpdatedEvent;
+
        /**
         * Event being fired when an administrator has deleted land-line number
         */
@@ -127,6 +128,7 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
        @Inject
        @Any
        private Event<AdminUpdatedLandLineNumberEvent> landLineNumberUpdatedEvent;
+
        /**
         * Event being fired when an administrator has deleted mobile number
         */
@@ -196,18 +198,6 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
        public JobsAdminPhoneWebRequestBean () {
                // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
                // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
-
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminPhone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -560,36 +550,36 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
        }
 
        @Override
-       public DialableFaxNumber getChoosenFaxNumber () {
+       public DialableFaxNumber getFaxNumber () {
                // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
                // System.out.println(MessageFormat.format("{0}: Returning this.choosenFaxNumber={1}, caller: {2}", this.getClass().getSimpleName(), this.choosenFaxNumber, caller));
                return this.choosenFaxNumber;
        }
 
        @Override
-       public void setChoosenFaxNumber (final DialableFaxNumber choosenFaxNumber) {
+       public void setFaxNumber (final DialableFaxNumber choosenFaxNumber) {
                // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
                // System.out.println(MessageFormat.format("{0}: Settin choosenFaxNumber={1}, previous: this.choosenFaxNumber={2}, caller: {3}", this.getClass().getSimpleName(), choosenFaxNumber, this.choosenFaxNumber, caller));
                this.choosenFaxNumber = choosenFaxNumber;
        }
 
        @Override
-       public DialableLandLineNumber getChoosenLandLineNumber () {
+       public DialableLandLineNumber getLandLineNumber () {
                return this.choosenLandLineNumber;
        }
 
        @Override
-       public void setChoosenLandLineNumber (final DialableLandLineNumber choosenLandLineNumber) {
+       public void setLandLineNumber (final DialableLandLineNumber choosenLandLineNumber) {
                this.choosenLandLineNumber = choosenLandLineNumber;
        }
 
        @Override
-       public DialableMobileNumber getChoosenMobileNumber () {
+       public DialableMobileNumber getMobileNumber () {
                return this.choosenMobileNumber;
        }
 
        @Override
-       public void setChoosenMobileNumber (final DialableMobileNumber choosenMobileNumber) {
+       public void setMobileNumber (final DialableMobileNumber choosenMobileNumber) {
                this.choosenMobileNumber = choosenMobileNumber;
        }
 
@@ -633,4 +623,22 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
                this.phoneNumber = phoneNumber;
        }
 
+       /**
+        * Post-construction method
+        */
+       @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/jjobs-ejb/adminPhone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
 }
index fe80c73fc7a194a80fce3856ec8edd6ebcb3b9c7..2cdc389eaecef39587bda4358443083f3e03210d 100644 (file)
@@ -126,44 +126,44 @@ public interface JobsAdminPhoneWebRequestController extends Serializable {
        /**
         * Getter for choosen fax number
         * <p>
-        * @return Choosen fax number
+        * @return  fax number
         */
-       DialableFaxNumber getChoosenFaxNumber ();
+       DialableFaxNumber getFaxNumber ();
 
        /**
         * Setter for choosen fax number
         * <p>
-        * @param choosenFaxNumber Choosen fax number
+        * @param choosenFaxNumber  fax number
         */
-       void setChoosenFaxNumber (final DialableFaxNumber choosenFaxNumber);
+       void setFaxNumber (final DialableFaxNumber choosenFaxNumber);
 
        /**
         * Getter for choosen land-line number
         * <p>
-        * @return Choosen land-line number
+        * @return  land-line number
         */
-       DialableLandLineNumber getChoosenLandLineNumber ();
+       DialableLandLineNumber getLandLineNumber ();
 
        /**
         * Setter for choosen land-line number
         * <p>
-        * @param choosenLandLineNumber Choosen land-line number
+        * @param choosenLandLineNumber  land-line number
         */
-       void setChoosenLandLineNumber (final DialableLandLineNumber choosenLandLineNumber);
+       void setLandLineNumber (final DialableLandLineNumber choosenLandLineNumber);
 
        /**
         * Getter for choosen mobile number
         * <p>
-        * @return Choosen mobile number
+        * @return  mobile number
         */
-       DialableMobileNumber getChoosenMobileNumber ();
+       DialableMobileNumber getMobileNumber ();
 
        /**
         * Setter for choosen mobile number
         * <p>
-        * @param choosenMobileNumber Choosen mobile number
+        * @param choosenMobileNumber  mobile number
         */
-       void setChoosenMobileNumber (final DialableMobileNumber choosenMobileNumber);
+       void setMobileNumber (final DialableMobileNumber choosenMobileNumber);
 
        /**
         * Getter for phone area code
index eabc4738af0672abc8492e80ff402b42c3a90284..34bb6c51f432685e69ee592ec01551bb0cefabc2 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.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;
@@ -54,6 +55,19 @@ public class JobsUserProfileWebRequestBean extends BaseJobsController implements
        @Inject
        private JobsUserLoginWebSessionController userLoginController;
 
+       /**
+        * Default constructor
+        */
+       public JobsUserProfileWebRequestBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
        @Override
        public boolean isProfileLinkVisibleById (final Long userId) {
                // Init user instance
index 31dfe760d7bb08bcb71cede6f9d19b5fc1efd66c..524699bdeb1b7e167887a67ae325f1ecf25175cf 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jjobs.beans.profilemode;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.jjobs.beans.BaseJobsController;
@@ -46,4 +47,12 @@ public class JobsProfileModeWebApplicationBean extends BaseJobsController implem
                // Return it
                return ProfileMode.values();
        }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
 }
index ae0983f9d44a6a6d663bc180efcf1deb6f8e1f86..80744e16267146aadb8d849b442a858284c3f6e0 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.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;
@@ -34,6 +35,7 @@ import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
 import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
 import org.mxchange.jjobs.beans.user.JobsAdminUserWebRequestController;
 import org.mxchange.jjobs.beans.user.JobsUserWebSessionController;
+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;
@@ -42,7 +44,6 @@ import org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote;
 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
@@ -98,16 +99,6 @@ public class JobsUserRegisterWebSessionBean extends BaseJobsController implement
         * Default constructor
         */
        public JobsUserRegisterWebSessionBean () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.registerBean = (UserRegistrationSessionBeanRemote) context.lookup("java:global/jjobs-ejb/register!org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
        }
 
        @Override
@@ -258,4 +249,21 @@ public class JobsUserRegisterWebSessionBean extends BaseJobsController implement
                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/jjobs-ejb/register!org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
 }
index d06de530ddf9a0a55a3dc23d65bc786f3f7cc24c..12917c9b6578ef4e4d0e66925a82f61c47001718 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jjobs.beans.resendlink;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
@@ -29,6 +30,7 @@ import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
 import org.mxchange.jjobs.beans.user.JobsUserWebSessionController;
+import org.mxchange.jusercore.events.resendlink.ObservableUserResendLinkAccountEvent;
 import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent;
 import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -36,7 +38,6 @@ 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.status.UserAccountStatus;
-import org.mxchange.jusercore.events.resendlink.ObservableUserResendLinkAccountEvent;
 
 /**
  * A web session bean for resending confirmation link
@@ -60,7 +61,7 @@ public class JobsResendLinkWebSessionBean extends BaseJobsController implements
        /**
         * EJB for resending confirmation link
         */
-       private ResendLinkSessionBeanRemote emailBean;
+       private ResendLinkSessionBeanRemote resendLinkBean;
 
        /**
         * Localization controller
@@ -85,17 +86,6 @@ public class JobsResendLinkWebSessionBean extends BaseJobsController implements
         * Default constructor
         */
        public JobsResendLinkWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.emailBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/jjobs-ejb/resendLink!org.mxchange.jjobs.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -146,7 +136,7 @@ public class JobsResendLinkWebSessionBean extends BaseJobsController implements
                        String baseUrl = FacesUtils.generateBaseUrl();
 
                        // Call EJB and return redirect target
-                       this.emailBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
+                       this.resendLinkBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
                } catch (final UserNotFoundException ex) {
                        // User not found
                        this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_NOT_FOUND"); //NOI18N
@@ -177,6 +167,24 @@ public class JobsResendLinkWebSessionBean extends BaseJobsController implements
                this.emailAddress = emailAddress;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.resendLinkBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/jjobs-ejb/resendLink!org.mxchange.jjobs.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
         */
index 5bd05b9a86efa6bd803b338f286daa311f6b65a4..a8f992fbbd71c7a58f49f473656906b1fca7b642 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.user;
 
 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;
@@ -95,7 +96,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
        /**
         * Administrative user EJB
         */
-       private final AdminUserSessionBeanRemote adminUserBean;
+       private AdminUserSessionBeanRemote adminUserBean;
 
        /**
         * Bean helper
@@ -132,7 +133,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
        /**
         * General user EJB
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * Regular user controller
@@ -196,18 +197,6 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
         * Default constructor
         */
        public JobsAdminUserWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-                       this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -531,6 +520,25 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
                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/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+                       this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/jjobs-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?
index f9ea8067cdb717c5f5180e99fb561f74c3bd70a4..e9817e6c24473b667be7ebcb6e2c03478c52ea11 100644 (file)
@@ -94,7 +94,7 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * User id
@@ -149,17 +149,6 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs
         * Default constructor
         */
        public JobsUserWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jrecruiter-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        /**
@@ -677,6 +666,18 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-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();
 
index 755219246491532f32e6a51764d623b46cc028d9..7aeadf35efc2e6eb7d00980df76d6bc1c09b935d 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.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;
@@ -30,15 +31,16 @@ import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
 import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
+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.exceptions.UserStatusLockedException;
 import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
 import org.mxchange.jusercore.model.user.User;
 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) controller (bean)
@@ -63,10 +65,15 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
+
+       /**
+        * Current password (for confirmation of password change)
+        */
+       private String userCurrentPassword;
 
        /**
-        * Login controller (bean)
+        * Login bean (controller)
         */
        @Inject
        private JobsUserLoginWebSessionController userLoginController;
@@ -92,17 +99,6 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
         * Default constructor
         */
        public JobsUserPasswordWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -115,58 +111,47 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
                        // Not all required fields are set
                        throw new FaceletException("Not all required fields are set."); //NOI18N
                } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
+                       // Password not matching
+                       throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
+               } else if (!this.featureController.isFeatureEnabled("change_user_password")) { //NOI18N
+                       // Editing is not allowed
+                       throw new IllegalStateException("User tried to change password."); //NOI18N
+               } else if (!UserUtils.ifPasswordMatches(this.getUserCurrentPassword(), this.userLoginController.getLoggedInUser())) {
                        // Password mismatches
-                       this.showFacesMessage("form_user_change_password:userCurrentPassword", "ERROR_USER_CURRENT_PASSWORD_MISMATCHING"); //NOI18N
+                       this.showFacesMessage("form_user_change_password:userCurrentPassword", "Entered current password does not matched stored password."); //NOI18N
 
                        // Clear bean
-                       this.userLoginController.setUserCurrentPassword(null);
                        this.clear();
 
                        // No redirect
                        return ""; //NOI18N
-               } else if (!this.featureController.isFeatureEnabled("change_user_password")) { //NOI18N
-                       // Editing is not allowed
-                       throw new IllegalStateException("User tried to change password."); //NOI18N
                } else if (!Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())) {
                        // Both entered passwords don't match
-                       this.showFacesMessage("form_user_change_password:userPasswordRepeat", "ERROR_USER_NEW_PASSWORDS_MISMATCH"); //NOI18N
+                       this.showFacesMessage("form_user_change_password:userPasswordRepeat", "Entered new passwords mismatch."); //NOI18N
 
                        // Clear bean
-                       this.userLoginController.setUserCurrentPassword(null);
                        this.clear();
 
                        // No redirect
                        return ""; //NOI18N
-               } else if (Objects.equals(this.userLoginController.getUserCurrentPassword(), this.getUserPassword())) {
+               } else if (Objects.equals(this.getUserCurrentPassword(), this.getUserPassword())) {
                        // New password matches current
-                       this.showFacesMessage("form_user_change_password:userPassword", "ERROR_USER_NEW_PASSWORD_SAME_AS_CURRENT"); //NOI18N
+                       this.showFacesMessage("form_user_change_password:userPassword", "Entered new password is same as current password."); //NOI18N
 
                        // Clear bean
-                       this.userLoginController.setUserCurrentPassword(null);
                        this.clear();
 
                        // No redirect
                        return ""; //NOI18N
                } else if (this.userLoginController.isPasswordInHistory(this.getUserPassword())) {
                        // Is already in list (to old passwords are ignored)
-                       this.showFacesMessage("form_user_change_password:userPassword", "ERROR_USER_NEW_PASSWORD_ALREADY_ENTERED"); //NOI18N
+                       this.showFacesMessage("form_user_change_password:userPassword", "Entered new password is has already been used some time ago."); //NOI18N
 
                        // Clear bean
-                       this.userLoginController.setUserCurrentPassword(null);
                        this.clear();
 
                        // No redirect
                        return ""; //NOI18N
-               } else if (this.isWeakPassword(this.getUserPassword())) {
-                       // Password is to weak
-                       this.showFacesMessage("form_user_change_password:userPassword", "ERROR_USER_PASSWORD_TO_WEAK"); //NOI18N
-
-                       // Clear bean
-                       this.userLoginController.setUserCurrentPassword(null);
-                       this.clear();
-
-                       // Skip it
-                       return ""; //NOI18N
                }
 
                // Get user instance
@@ -176,7 +161,6 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
                String encryptedPassword = UserUtils.encryptPassword(this.getUserPassword());
 
                // Set it in user
-               user.setUserMustChangePassword(Boolean.FALSE);
                user.setUserEncryptedPassword(encryptedPassword);
 
                try {
@@ -190,7 +174,6 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
                        this.userUpdatedPasswordEvent.fire(new UpdatedUserPasswordEvent(passwordHistory));
                } catch (final UserNotFoundException | UserStatusUnconfirmedException | UserStatusLockedException ex) {
                        // Clear bean
-                       this.userLoginController.setUserCurrentPassword(null);
                        this.clear();
 
                        // Throw again
@@ -201,7 +184,17 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
                this.clear();
 
                // Return outcome
-               return "user_data_saved"; //NOI18N
+               return "login_data_saved"; //NOI18N
+       }
+
+       @Override
+       public String getUserCurrentPassword () {
+               return this.userCurrentPassword;
+       }
+
+       @Override
+       public void setUserCurrentPassword (final String userCurrentPassword) {
+               this.userCurrentPassword = userCurrentPassword;
        }
 
        @Override
@@ -224,11 +217,29 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement
                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/jjobs-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.userLoginController.getUserCurrentPassword() != null) &&
-                               (!this.userLoginController.getUserCurrentPassword().isEmpty()) &&
+               return ((this.getUserCurrentPassword() != null) &&
+                               (!this.getUserCurrentPassword().isEmpty()) &&
                                (this.getUserPassword() != null) &&
                                (!this.getUserPassword().isEmpty()) &&
                                (this.getUserPasswordRepeat() != null) &&
index 734c267d384d0e983cfe685553d7e88cf0647227..fcfd0f12c6ad2d81ecb3cddd3705943bb19c9fe6 100644 (file)
@@ -41,6 +41,20 @@ public interface JobsUserPasswordWebRequestController extends Serializable {
         */
        void setUserPassword (final String userPassword);
 
+       /**
+        * Getter for current clear-text user password
+        * <p>
+        * @return Current clear-text user password
+        */
+       String getUserCurrentPassword ();
+
+       /**
+        * Setter for current clear-text user password
+        * <p>
+        * @param userCurrentPassword Current clear-text user password
+        */
+       void setUserCurrentPassword (final String userCurrentPassword);
+
        /**
         * Getter for clear-text user password repeated
         * <p>
@@ -55,13 +69,6 @@ public interface JobsUserPasswordWebRequestController extends Serializable {
         */
        void setUserPasswordRepeat (final String userPasswordRepeat);
 
-       /**
-        * Checks whether all required "password-change fields" are set.
-        * <p>
-        * @return Whether the required fields are set
-        */
-       boolean isRequiredChangePasswordSet ();
-
        /**
         * Changes logged-in user's password. It must not match with current
         * password and should not appear in password history list for X
@@ -71,4 +78,11 @@ public interface JobsUserPasswordWebRequestController extends Serializable {
         */
        String doChangePassword ();
 
+       /**
+        * Checks if all 3 passwords are set: old password, 2x new password
+        * <p>
+        * @return Whether all passwords are set
+        */
+       boolean isRequiredChangePasswordSet ();
+
 }