]> git.mxchange.org Git - addressbook-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>
Fri, 21 Apr 2017 20:30:03 +0000 (22: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/addressbook/beans/addressbook/AddressbookWebSessionBean.java
src/java/org/mxchange/addressbook/beans/confirmlink/AddressbookConfirmationLinkWebRequestBean.java
src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java
src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java
src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java
src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestBean.java
src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/email_address/AddressbookEmailChangeWebSessionBean.java
src/java/org/mxchange/addressbook/beans/features/AddressbookFeatureWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/gender/AddressbookGenderWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelper.java
src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java
src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java
src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestBean.java
src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java
src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java
src/java/org/mxchange/addressbook/beans/profile/AddressbookUserProfileWebRequestBean.java
src/java/org/mxchange/addressbook/beans/profilemode/AddressbookProfileModeWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java
src/java/org/mxchange/addressbook/beans/resendlink/AddressbookResendLinkWebSessionBean.java
src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java
src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java
src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java
src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestController.java

index 4fd8efafd9d485da3dbb3f7d9557e0e374794126..967e2cb131c2c173de811449dc85ae7d307781db 100644 (file)
@@ -39,14 +39,14 @@ import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
 import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote;
 import org.mxchange.jaddressbookcore.events.addressbook.AddressbookLoadedEvent;
+import org.mxchange.jaddressbookcore.events.addressbook.ObservableAddressbookLoadedEvent;
 import org.mxchange.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException;
 import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException;
 import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
 import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook;
 import org.mxchange.jaddressbookcore.model.addressbook.entry.AddressbookEntry;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jaddressbookcore.events.addressbook.ObservableAddressbookLoadedEvent;
 import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
+import org.mxchange.jusercore.model.user.User;
 
 /**
  * An address book bean (controller)
@@ -119,18 +119,6 @@ public class AddressbookWebSessionBean extends BaseAddressbookController impleme
         * Default constructor
         */
        public AddressbookWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-
                // Init list
                AddressbookWebSessionBean.countSharesList = new ConcurrentHashMap<>(0);
        }
@@ -297,11 +285,13 @@ public class AddressbookWebSessionBean extends BaseAddressbookController impleme
        }
 
        @Override
+       @SuppressWarnings ("ReturnOfDateField")
        public Calendar getAddressbookCreated () {
                return this.addressbookCreated;
        }
 
        @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
        public void setAddressbookCreated (final Calendar addressbookCreated) {
                this.addressbookCreated = addressbookCreated;
        }
@@ -353,6 +343,18 @@ public class AddressbookWebSessionBean extends BaseAddressbookController impleme
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+
                // Init list
                this.usersAddressbooks = new LinkedList<>();
 
index d7cb4792051432468e08869f5671b9825f93f51e..d64437b480de63d05c36aa8c7e6c3869a1e08125 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;
@@ -33,13 +34,13 @@ import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.helper.AddressbookWebRequestController;
 import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
 import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
 
 /**
  * A web request bean for confirmation link handling
@@ -69,7 +70,7 @@ public class AddressbookConfirmationLinkWebRequestBean extends BaseAddressbookCo
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * User controller
@@ -88,6 +89,13 @@ public class AddressbookConfirmationLinkWebRequestBean extends BaseAddressbookCo
         * Default constructor
         */
        public AddressbookConfirmationLinkWebRequestBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
                // Try it
                try {
                        // Get initial context
index 62482450e9e767a78f66aab2a85bb2eab712be46..0ca0188ae56ec14caa0b998826c7631bf189a2e4 100644 (file)
@@ -39,7 +39,9 @@ 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.update.AdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.phonenumbers.DialableNumber;
@@ -50,8 +52,6 @@ import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
 
 /**
  * An administrative user bean (controller)
@@ -103,7 +103,7 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro
        /**
         * Remote contact bean
         */
-       private final ContactSessionBeanRemote contactBean;
+       private ContactSessionBeanRemote contactBean;
 
        /**
         * General contact controller
@@ -247,17 +247,6 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro
         * Default constructor
         */
        public AddressbookAdminContactWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -733,6 +722,17 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
        }
 
        @Override
index d69694df5347d57e654615f30a3866e020a58745..2e1fe76a0c9cd66a1621ebf6ca6dc57b151e87c0 100644 (file)
@@ -78,16 +78,6 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
         */
        private Date birthday;
 
-       /**
-        * Mobile number's carrier
-        */
-       private MobileProvider mobileCarrier;
-
-       /**
-        * Mobile number
-        */
-       private Long mobileNumber;
-
        /**
         * City
         */
@@ -101,7 +91,7 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
        /**
         * Remote contact bean
         */
-       private final ContactSessionBeanRemote contactBean;
+       private ContactSessionBeanRemote contactBean;
 
        /**
         * Contact list
@@ -168,20 +158,30 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
         */
        private String houseNumberExtension;
 
+       /**
+        * Whether a fax entry has been unlinked
+        */
+       private boolean isFaxUnlinked;
+
+       /**
+        * Whether a land-line number has been unlinked
+        */
+       private boolean isLandLineUnlinked;
+
        /**
         * Whether a mobile entry has been unlinked
         */
        private boolean isMobileUnlinked;
 
        /**
-        * Whether a fax entry has been unlinked
+        * Mobile number's carrier
         */
-       private boolean isFaxUnlinked;
+       private MobileProvider mobileCarrier;
 
        /**
-        * Whether a land-line number has been unlinked
+        * Mobile number
         */
-       private boolean isLandLineUnlinked;
+       private Long mobileNumber;
 
        /**
         * Phone number area code
@@ -234,18 +234,6 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
         * Default constructor
         */
        public AddressbookContactWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-
                // Init lists/maps
                this.contactList = new LinkedList<>();
                this.emailAddressList = new LinkedList<>();
@@ -374,43 +362,6 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
                //* NOISY-DEBUG: */ System.out.println("contactController.afterAdminUpdatedContactDataEvent(): EXIT!"); //NOI18N
        }
 
-       /**
-        * Event observer for new user registrations
-        * <p>
-        * @param event User registration event
-        */
-       public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getRegisteredUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.registeredUser is null"); //NOI18N
-               } else if (event.getRegisteredUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N
-               } else if (event.getRegisteredUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
-               }
-
-               // Get user instance
-               Contact registeredContact = event.getRegisteredUser().getUserContact();
-
-               // Copy all data from registered->user
-               this.copyContact(registeredContact);
-
-               // Add contact instance only once
-               this.uniqueAddContact(registeredContact);
-
-               // Add user name and email address
-               this.addUserNameEmailAddress(registeredContact);
-
-               // Clear all data
-               this.clear();
-       }
-
        /**
         * Event observer when user confirmed account.
         * <p>
@@ -461,6 +412,43 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
                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 () {
@@ -631,26 +619,6 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
                this.birthday = birthday;
        }
 
-       @Override
-       public MobileProvider getMobileCarrier () {
-               return this.mobileCarrier;
-       }
-
-       @Override
-       public void setMobileCarrier (final MobileProvider mobileCarrier) {
-               this.mobileCarrier = mobileCarrier;
-       }
-
-       @Override
-       public Long getMobileNumber () {
-               return this.mobileNumber;
-       }
-
-       @Override
-       public void setMobileNumber (final Long mobileNumber) {
-               this.mobileNumber = mobileNumber;
-       }
-
        @Override
        public String getCity () {
                return this.city;
@@ -792,6 +760,26 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
                this.houseNumberExtension = houseNumberExtension;
        }
 
+       @Override
+       public MobileProvider getMobileCarrier () {
+               return this.mobileCarrier;
+       }
+
+       @Override
+       public void setMobileCarrier (final MobileProvider mobileCarrier) {
+               this.mobileCarrier = mobileCarrier;
+       }
+
+       @Override
+       public Long getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       @Override
+       public void setMobileNumber (final Long mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
        @Override
        public Integer getPhoneAreaCode () {
                return this.phoneAreaCode;
@@ -853,10 +841,22 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
        }
 
        /**
-        * Post-initialization of this class
+        * Post-construction method
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+
                // Get full email address list for reducing EJB calls
                this.emailAddressList.addAll(this.contactBean.getEmailAddressList());
 
index 96219458bbd7f25597cd42c8f4eb34c95efb4dda..faebb4a68507b203d384fea69e3296790b95ee30 100644 (file)
@@ -22,6 +22,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Observes;
 import javax.faces.view.facelets.FaceletException;
@@ -80,18 +81,6 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro
         * Default constructor
         */
        public AddressbookContactPhoneWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminphone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-
                // Init lists/maps
                this.contacts = new HashMap<>(10);
        }
@@ -199,6 +188,21 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro
                }
        }
 
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the beans
+                       this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminphone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
        /**
         * Clears this bean
         */
index 28991e3aeed32628d7f7bef305fe65f4ffd5e240..3ed5fb321c76a087a8b4fb50efcee2b8db592ca8 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.addressbook.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;
@@ -33,8 +34,8 @@ 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.exceptions.CountryAlreadyAddedException;
 import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
 
 /**
  * An administrative country bean
@@ -102,17 +103,6 @@ public class AddressbookAdminCountryWebRequestBean extends BaseAddressbookContro
         * Default constructor
         */
        public AddressbookAdminCountryWebRequestBean () {
-               // Try this
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
        }
 
        @Override
@@ -215,6 +205,24 @@ public class AddressbookAdminCountryWebRequestBean extends BaseAddressbookContro
                this.countryPhoneCode = countryPhoneCode;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               // Try this
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the bean
+                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
        /**
         * Clears this bean's data. This should be called after a form has been
         * submitted and the processing of the form was successful.
index 5265fe0e75c96cf35aefe10b6cd1d249aec3c594..68366ba028d77b1161ed2025a3f52e9e9f9be79c 100644 (file)
@@ -59,17 +59,6 @@ public class AddressbookCountryWebApplicationBean extends BaseAddressbookControl
         * Default constructor
         */
        public AddressbookCountryWebApplicationBean () {
-               // Try this
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
        }
 
        /**
@@ -106,10 +95,22 @@ public class AddressbookCountryWebApplicationBean extends BaseAddressbookControl
        }
 
        /**
-        * Post-initialization of this class
+        * Post-construction method
         */
        @PostConstruct
        public void init () {
+               // Try this
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the bean
+                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+
                // "Cache" country list as this will not change so often.
                this.countryList = this.countryBean.allCountries();
        }
index 0f3dbf1fdad6eb2b9436a38728b759fed0f9f160..cc88e1101f30cbcb38b3ed0ebe61e0589e86728d 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.addressbook.beans.email_address;
 import java.text.MessageFormat;
 import java.util.List;
 import java.util.Objects;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
@@ -69,7 +70,7 @@ public class AddressbookEmailChangeWebSessionBean extends BaseAddressbookControl
        /**
         * Remote email change bean
         */
-       private final UserEmailChangeSessionBeanRemote emailBean;
+       private UserEmailChangeSessionBeanRemote emailBean;
 
        /**
         * Features controller
@@ -87,20 +88,6 @@ public class AddressbookEmailChangeWebSessionBean extends BaseAddressbookControl
         * Default constructor
         */
        public AddressbookEmailChangeWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.emailBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/addressbook-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
-
-                       // Init list
-                       this.emailAddresses = this.emailBean.allQueuedAddresses();
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -177,6 +164,27 @@ public class AddressbookEmailChangeWebSessionBean extends BaseAddressbookControl
                this.emailAddressRepeat = emailAddressRepeat;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.emailBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/addressbook-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
+
+                       // Init list
+                       this.emailAddresses = this.emailBean.allQueuedAddresses();
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
        @Override
        public boolean isRequiredChangeEmailAddressSet () {
                return ((this.getEmailAddress() != null) &&
index d0dc07b544dad5db534010ac6bfcee545bf477c9..09ddd617de8742025c6eb47603dc035add66d611 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.beans.features;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
@@ -34,6 +35,19 @@ public class AddressbookFeatureWebApplicationBean extends BaseAddressbookControl
         */
        private static final long serialVersionUID = 64_237_512_690_168_674L;
 
+       /**
+        * Default constructor
+        */
+       public AddressbookFeatureWebApplicationBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
        @Override
        public boolean isFeatureEnabled (final String feature) {
                // The parameter must be set
index 048441ec5400831d8c6de18a3a208a7dd6fabb5d..5e6c65c488e3316a9aaff1a17300022c9efcfa19 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.beans.gender;
 
 import java.util.List;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
@@ -58,4 +59,11 @@ public class AddressbookGenderWebApplicationBean extends BaseAddressbookControll
                return genders;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
 }
index 71392464ec717882dbe4ec3c78edf30ffff41005..347f5301f799ea1ec47b465cf120d3ace41abc59 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.beans.helper;
 
 import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -176,7 +177,14 @@ public class AddressbookWebRequestHelper implements AddressbookWebRequestControl
        }
 
        /**
-        * Set's all given contact's phone instances: land-line, cellphone and fax
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
+       /**
+        * Set's all given contact's phone instances: land-line, mobile and fax
         * <p>
         * @param contact Contact to set phone instances for
         */
@@ -196,7 +204,7 @@ public class AddressbookWebRequestHelper implements AddressbookWebRequestControl
                // Is cellphone set?
                if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
                        // Yes, then set it in admin controller
-                       this.adminPhoneController.setCellPhone(contact.getContactMobileNumber());
+                       this.adminPhoneController.setMobileNumber(contact.getContactMobileNumber());
                }
 
                // Is land-line set?
index 4b8dbb84a5d14c41d748332ee72083ee1dc76f13..11bb92d7d62eacac6beb095d27a477476b5641ce 100644 (file)
@@ -49,6 +49,12 @@ public class AddressbookLocalizationSessionBean extends BaseAddressbookControlle
         */
        private Locale locale;
 
+       /**
+        * Default constructor
+        */
+       public AddressbookLocalizationSessionBean () {
+       }
+
        /**
         * Event observer for logged-in user
         * <p>
index 43ad2912ef2a7d151875d274492c2f585a9ecd7b..d2d405bb1d1cb5ccab1bfe894720b0c5da824915 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;
@@ -136,22 +137,8 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
         * Default constructor
         */
        public AddressbookUserLoginWebSessionBean () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userLoginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/addressbook-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
-
-                       // Also find this
-                       this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/addressbook-ejb/userPasswordHistory!org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote"); //NOI18N
-
-                       // Defaul template is guest
-                       this.baseTemplatePathName = GUEST_BASE_TEMPLATE_NAME;
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
+               // Defaul template is guest
+               this.baseTemplatePathName = GUEST_BASE_TEMPLATE_NAME;
        }
 
        /**
@@ -324,6 +311,26 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
                return (this.isUserLoggedIn() && this.getLoggedInUser().getUserMustChangePassword());
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.userLoginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/addressbook-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
+
+                       // Also find this
+                       this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/addressbook-ejb/userPasswordHistory!org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
        @Override
        public boolean isInvisible () {
                // Check on login
index b8b98152ee6d02e350ee2a2ab2b6f62b2f4df2d3..3cdee2aab3a854738193aca843a866e0410c02ad 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.addressbook.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 AddressbookAdminMobileProviderWebRequestBean extends BaseAddressboo
         * Default constructor
         */
        public AddressbookAdminMobileProviderWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminRemoteBean = (AdminMobileProviderSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -176,6 +166,24 @@ public class AddressbookAdminMobileProviderWebRequestBean extends BaseAddressboo
                this.providerName = providerName;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the beans
+                       this.adminRemoteBean = (AdminMobileProviderSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
        /**
         * Checks whether if the given mobile provider is already created by
         * checking both dial prefix and country.
index 90f094f6287de9c726980cc0754391a5ebc76700..2b2f8b54321dcfdc78a043c3377402d49db1c992 100644 (file)
@@ -59,17 +59,6 @@ public class AddressbookMobileProviderWebRequestBean extends BaseAddressbookCont
         * Default constructor
         */
        public AddressbookMobileProviderWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
        }
 
        /**
@@ -83,10 +72,10 @@ public class AddressbookMobileProviderWebRequestBean extends BaseAddressbookCont
                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 AddressbookMobileProviderWebRequestBean extends BaseAddressbookCont
        }
 
        /**
-        * Initializer method
+        * Post-construction method
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the beans
+                       this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+
                // Init list of mobile providers
                this.mobileProviders = this.mobileRemoteBean.allMobileProvider();
        }
index df484bcf724c9ab76987dfd27a7845415d3da3d0..2d3811ac42748aad415d25c547ad7e03189c264a 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.beans.phone;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Named;
@@ -24,9 +25,9 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 
 /**
  * Administrative bean (controller) for phone numbers
@@ -47,11 +48,6 @@ public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookControll
         */
        private AdminContactsPhoneSessionBeanRemote adminPhoneBean;
 
-       /**
-        * Cell phone number
-        */
-       private DialableMobileNumber cellPhone;
-
        /**
         * Fax number
         */
@@ -62,31 +58,15 @@ public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookControll
         */
        private DialableLandLineNumber landLine;
 
+       /**
+        * Cell phone number
+        */
+       private DialableMobileNumber mobileNumber;
+
        /**
         * Default constructor
         */
        public AddressbookAdminPhoneWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminPhoneBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/admincontactphone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
-       }
-
-       @Override
-       public DialableMobileNumber getMobileNumber () {
-               return this.cellPhone;
-       }
-
-       @Override
-       public void setCellPhone (final DialableMobileNumber cellPhone) {
-               this.cellPhone = cellPhone;
        }
 
        @Override
@@ -109,4 +89,32 @@ public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookControll
                this.landLine = landLine;
        }
 
+       @Override
+       public DialableMobileNumber getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       @Override
+       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the beans
+                       this.adminPhoneBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/admincontactphone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
 }
index 7e068bc5b92dd0abfb3cd585c4bf66cf754dbbce..79730853a5f66e46669fa53e9c841f21f55043b4 100644 (file)
@@ -36,7 +36,7 @@ public interface AddressbookAdminPhoneWebRequestController extends Serializable
         * <p>
         * @param cellPhone Dialable cellphone number instance
         */
-       void setCellPhone (final DialableMobileNumber cellPhone);
+       void setMobileNumber (final DialableMobileNumber cellPhone);
 
        /**
         * Getter for dialable cellphone number instance
index 569f63d6ea7e6444fb5c0ea138e2547f7310b9b1..1aae30fc7c9cad02a300d1c43ba35ac64f7215db 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.beans.profile;
 
 import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
@@ -42,6 +43,12 @@ public class AddressbookUserProfileWebRequestBean extends BaseAddressbookControl
         */
        private static final long serialVersionUID = 187_687_145_286_710L;
 
+       /**
+        * User controller
+        */
+       @Inject
+       private AddressbookUserWebSessionController userController;
+
        /**
         * Login controller
         */
@@ -49,10 +56,17 @@ public class AddressbookUserProfileWebRequestBean extends BaseAddressbookControl
        private AddressbookUserLoginWebSessionController userLoginController;
 
        /**
-        * User controller
+        * Default constructor
         */
-       @Inject
-       private AddressbookUserWebSessionController userController;
+       public AddressbookUserProfileWebRequestBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
 
        @Override
        public boolean isProfileLinkVisibleById (final Long userId) {
index 8292e882473416cd6c4f455341e375c1ccc72291..b0ee1649c24e7646bfbee062118b349cd75a89c1 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.beans.profilemode;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
@@ -46,4 +47,12 @@ public class AddressbookProfileModeWebApplicationBean extends BaseAddressbookCon
                // Return it
                return ProfileMode.values();
        }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
 }
index b0b38d7809af137a6c904c91ac57ea7164c313e3..6ff49fe3b6004403995c2ad0357e05ed171325a0 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.beans.register;
 
 import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
@@ -34,6 +35,7 @@ import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.UserContact;
 import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.exceptions.DataRepeatMismatchException;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
@@ -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 AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro
         * Default constructor
         */
        public AddressbookUserRegisterWebSessionBean () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.registerBean = (UserRegistrationSessionBeanRemote) context.lookup("java:global/addressbook-ejb/register!org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
        }
 
        @Override
@@ -224,4 +215,21 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro
                return "user_register_page2"; //NOI18N
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.registerBean = (UserRegistrationSessionBeanRemote) context.lookup("java:global/addressbook-ejb/register!org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
 }
index 21e9e05adb199d753ba9d1c7d46685b74d36f06e..2da5a7b7ac7b88488916b5cace7bd9195a9ce5e8 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.beans.resendlink;
 
 import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
@@ -74,17 +75,6 @@ public class AddressbookResendLinkWebSessionBean extends BaseAddressbookControll
         * Default constructor
         */
        public AddressbookResendLinkWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.emailBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/addressbook-ejb/resendLink!org.mxchange.addressbook.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -152,6 +142,24 @@ public class AddressbookResendLinkWebSessionBean extends BaseAddressbookControll
                this.emailAddress = emailAddress;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.emailBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/addressbook-ejb/resendLink!org.mxchange.addressbook.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
        /**
         * Clears email address fields so the user has to re-enter them
         */
index 1bd9b687d9ad516d90a1ed240ccc6c124e8c17d8..78f07c3c682fe461645930bf72203a7bce1dfce4 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.addressbook.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;
@@ -88,7 +89,7 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
        /**
         * Administrative user EJB
         */
-       private final AdminUserSessionBeanRemote adminUserBean;
+       private AdminUserSessionBeanRemote adminUserBean;
 
        /**
         * Bean helper instance
@@ -112,7 +113,7 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
        /**
         * General user EJB
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * Regular user controller
@@ -157,18 +158,6 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
         * Default constructor
         */
        public AddressbookAdminUserWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-                       this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -441,6 +430,25 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
                this.userPasswordRepeat = userPasswordRepeat;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+                       this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
        @Override
        public String lockUserAccount (final User user) {
                // Is the user instance valid and CONFIRMED?
index 07d12cf2d6033a6ec059e21481b741c7b16b8b62..26f9dd104d75a216057d66f26ab83653f373113a 100644 (file)
@@ -38,7 +38,6 @@ import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplication
 import org.mxchange.addressbook.beans.localization.AddressbookLocalizationSessionController;
 import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
 import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
 import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
 import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
@@ -70,11 +69,6 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * Contact EJB
-        */
-       private ContactSessionBeanRemote contactBean;
-
        /**
         * General contact controller
         */
@@ -103,7 +97,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * User id
@@ -158,24 +152,10 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
         * Default constructor
         */
        public AddressbookUserWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        /**
-        * Event observer for newly added users by adminstrator
+        * Event observer for newly added users by administrator
         * <p>
         * @param event Event being fired
         */
@@ -602,6 +582,18 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+
                // Initialize user list
                this.userList = this.userBean.allUsers();
 
index 04f61277a4e9cc87db46fe25c5c9ef79b2b6cba1..63e0de0f566245cc242cf8e4487e70e41c576a71 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.beans.user.password;
 
 import java.util.Objects;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
@@ -30,6 +31,7 @@ import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController;
 import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
 import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
 import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
@@ -39,7 +41,6 @@ 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) bean (controller)
@@ -64,7 +65,7 @@ public class AddressbookUserPasswordWebRequestBean extends BaseAddressbookContro
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * Current password (for confirmation of password change)
@@ -98,17 +99,6 @@ public class AddressbookUserPasswordWebRequestBean extends BaseAddressbookContro
         * Default constructor
         */
        public AddressbookUserPasswordWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -227,6 +217,25 @@ public class AddressbookUserPasswordWebRequestBean extends BaseAddressbookContro
                this.userPasswordRepeat = userPasswordRepeat;
        }
 
+       /**
+        * Post-initialization of this class
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
        public boolean isRequiredChangePasswordSet () {
                // Is all data set?
                return ((this.getUserCurrentPassword() != null) &&
index 01fc52a5ce1ae185457dd926bf55ad19d42944a6..c8bfd45f217bf552df2edc680731c32f813e39aa 100644 (file)
@@ -70,10 +70,19 @@ public interface AddressbookUserPasswordWebRequestController extends Serializabl
        void setUserPasswordRepeat (final String userPasswordRepeat);
 
        /**
-        * Changes logged-in user's password. It must not match with current password and should not appear in password history list for X (configurable) entries.
+        * Changes logged-in user's password. It must not match with current
+        * password and should not appear in password history list for X
+        * (configurable) entries.
         * <p>
         * @return Redirect outcome
         */
        String doChangePassword ();
 
+       /**
+        * Checks if all 3 passwords are set: old password, 2x new password
+        * <p>
+        * @return Whether all passwords are set
+        */
+       boolean isRequiredChangePasswordSet ();
+
 }