]> git.mxchange.org Git - jfinancials-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:17:19 +0000 (22:17 +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>
24 files changed:
src/java/org/mxchange/jfinancials/beans/confirmlink/FinancialsConfirmationLinkWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebApplicationBean.java
src/java/org/mxchange/jfinancials/beans/email_address/FinancialsEmailChangeWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/features/FinancialsFeatureWebApplicationBean.java
src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationBean.java
src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelper.java
src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java
src/java/org/mxchange/jfinancials/beans/login/FinancialsUserLoginWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestController.java
src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/profilemode/FinancialsProfileModeWebApplicationBean.java
src/java/org/mxchange/jfinancials/beans/register/FinancialsUserRegisterWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/resendlink/FinancialsResendLinkWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestController.java

index 3269e1a2db85db859aa02ff5c03f0601b9948663..296c28c6df4ae6de2109a0375b2dfda147cb4f83 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;
@@ -69,7 +70,7 @@ public class FinancialsConfirmationLinkWebRequestBean extends BaseFinancialsCont
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * Event being fired when a user has confirmed the account
@@ -88,6 +89,13 @@ public class FinancialsConfirmationLinkWebRequestBean extends BaseFinancialsCont
         * Default constructor
         */
        public FinancialsConfirmationLinkWebRequestBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
                // Try it
                try {
                        // Get initial context
index c632274a014c66104dc95bdd1b486353612d2364..b723b6d2b26c13c6308ca5c50cf1c83dc0763bab 100644 (file)
@@ -103,7 +103,7 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsControll
        /**
         * Remote contact bean
         */
-       private final ContactSessionBeanRemote contactBean;
+       private ContactSessionBeanRemote contactBean;
 
        /**
         * General contact controller
@@ -247,17 +247,6 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsControll
         * Default constructor
         */
        public FinancialsAdminContactWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsAdminContactWebRequestBean extends BaseFinancialsControll
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
        }
 
        @Override
index f7e085ce87d748b36fa45d24c0f3d8b7c32d2674..1aeb0cfe7e772959585a6da54d7d3cdcfd53cfc3 100644 (file)
@@ -78,16 +78,6 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
         */
        private Date birthday;
 
-       /**
-        * Mobile number's carrier
-        */
-       private MobileProvider mobileCarrier;
-
-       /**
-        * Mobile number
-        */
-       private Long mobileNumber;
-
        /**
         * City
         */
@@ -101,7 +91,7 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
        /**
         * Remote contact bean
         */
-       private final ContactSessionBeanRemote contactBean;
+       private ContactSessionBeanRemote contactBean;
 
        /**
         * Contact list
@@ -168,20 +158,30 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
         */
        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 FinancialsContactWebSessionBean extends BaseFinancialsController im
         * Default constructor
         */
        public FinancialsContactWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jfinancials-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<>();
@@ -368,43 +356,6 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
                this.emailAddressList.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 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>
@@ -455,6 +406,43 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
                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 () {
@@ -613,26 +601,6 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
                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;
@@ -774,6 +742,26 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
                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;
@@ -835,10 +823,22 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im
        }
 
        /**
-        * 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/jfinancials-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 cc9f9862dc63fe11ba2c5607ef6b2972517ff155..068d03d0a1ec217d58db996834183512c800793a 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 FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll
         * Default constructor
         */
        public FinancialsContactPhoneWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/jfinancials-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,22 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll
                }
        }
 
+       @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/jfinancials-ejb/adminphone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+
+       }
+
        /**
         * Clears this bean
         */
index 6983e06f91aa98a5bd2152033330ef42ac3746fb..94bde72feb117792184799f468dbc79a6a160fe8 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jfinancials.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;
@@ -28,13 +29,13 @@ import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jfinancials.beans.BaseFinancialsController;
 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;
+import org.mxchange.jfinancials.beans.BaseFinancialsController;
 
 /**
  * An administrative country bean
@@ -102,17 +103,6 @@ public class FinancialsAdminCountryWebRequestBean extends BaseFinancialsControll
         * Default constructor
         */
        public FinancialsAdminCountryWebRequestBean () {
-               // Try this
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsAdminCountryWebRequestBean extends BaseFinancialsControll
                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/jfinancials-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 af4bef91f95c950a617f79a2f27a15d669a561b4..aae836a10fc69ecd88cb76a1575c8f2d98581d18 100644 (file)
@@ -59,17 +59,6 @@ public class FinancialsCountryWebApplicationBean extends BaseFinancialsControlle
         * Default constructor
         */
        public FinancialsCountryWebApplicationBean () {
-               // Try this
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsCountryWebApplicationBean extends BaseFinancialsControlle
        }
 
        /**
-        * 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/jfinancials-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 145bfcd2d3c5481828f7e7082543e2cd080caced..99a501b2eef230f38fd76f5ff8ce92ca7a4a8495 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jfinancials.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 FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle
        /**
         * Remote email change bean
         */
-       private final UserEmailChangeSessionBeanRemote emailBean;
+       private UserEmailChangeSessionBeanRemote emailBean;
 
        /**
         * Features controller
@@ -87,20 +88,6 @@ public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle
         * Default constructor
         */
        public FinancialsEmailChangeWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.emailBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle
                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/jfinancials-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 2411781bc16abcc8c642bbe4898c39cbd5e425cf..03e96e1848ae221c5c1e99a8461edca464c07606 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jfinancials.beans.features;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.jfinancials.beans.BaseFinancialsController;
@@ -34,6 +35,19 @@ public class FinancialsFeatureWebApplicationBean extends BaseFinancialsControlle
         */
        private static final long serialVersionUID = 64_237_512_690_168_674L;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsFeatureWebApplicationBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
        @Override
        public boolean isFeatureEnabled (final String feature) {
                // The parameter must be set
index 0883dbfa66b28f48aa504655cdfff9c14cff863a..ab11759036ad0ca09cc93d52ada4d7f72ead1ba0 100644 (file)
 package org.mxchange.jfinancials.beans.gender;
 
 import java.util.List;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
-import org.mxchange.jfinancials.beans.BaseFinancialsController;
 import org.mxchange.jcontacts.contact.gender.Gender;
 import org.mxchange.jcontacts.contact.gender.GenderUtils;
+import org.mxchange.jfinancials.beans.BaseFinancialsController;
 
 /**
  * A gender bean
@@ -58,4 +59,11 @@ public class FinancialsGenderWebApplicationBean extends BaseFinancialsController
                return genders;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
 }
index ba4166189125c4521e1350f0041ead4c42f71832..d496d36973efee92b1af45492d9e92be32021041 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jfinancials.beans.helper;
 
 import java.text.MessageFormat;
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -175,6 +176,13 @@ public class FinancialsWebRequestHelper implements FinancialsWebRequestControlle
                this.user = user;
        }
 
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
        /**
         * Set's all given contact's phone instances: land-line, mobile and fax
         * <p>
@@ -196,7 +204,7 @@ public class FinancialsWebRequestHelper implements FinancialsWebRequestControlle
                // Is mobile 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 16f669f799e98f88fa41ab2f560dcfbb63f29fd7..ca7e927fc8a1aab7b10a7a792ec6644f3106667d 100644 (file)
@@ -49,6 +49,12 @@ public class FinancialsLocalizationSessionBean extends BaseFinancialsController
         */
        private Locale locale;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsLocalizationSessionBean () {
+       }
+
        /**
         * Event observer for logged-in user
         * <p>
index edeca07b516c449106be70c099c8aa9bdf2b482f..8d6917e3b62a6daf03857add2ab17e4044b74a54 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 FinancialsUserLoginWebSessionBean extends BaseFinancialsController
         * Default constructor
         */
        public FinancialsUserLoginWebSessionBean () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userLoginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
-
-                       // Also find this
-                       this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsUserLoginWebSessionBean extends BaseFinancialsController
                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/jfinancials-ejb/login!org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote"); //NOI18N
+
+                       // Also find this
+                       this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/jfinancials-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 bc9b36136873d0568beb18e1b6fc0cb34291c251..6f6b8f64913a42361e79aee637e5061540c0818e 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jfinancials.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;
@@ -28,8 +29,8 @@ import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jfinancials.beans.BaseFinancialsController;
 import org.mxchange.jcountry.data.Country;
+import org.mxchange.jfinancials.beans.BaseFinancialsController;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
 import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
@@ -93,17 +94,6 @@ public class FinancialsAdminMobileProviderWebRequestBean extends BaseFinancialsC
         * Default constructor
         */
        public FinancialsAdminMobileProviderWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminRemoteBean = (AdminMobileProviderSessionBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsAdminMobileProviderWebRequestBean extends BaseFinancialsC
                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/jfinancials-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 43f3684b3a81b00a597a36e8879b5a85cc23fd53..202abaa47a2295bd43a3033a4feccbd3f8b9fcf1 100644 (file)
@@ -59,17 +59,6 @@ public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsContro
         * Default constructor
         */
        public FinancialsMobileProviderWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsMobileProviderWebRequestBean extends BaseFinancialsContro
                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 FinancialsMobileProviderWebRequestBean extends BaseFinancialsContro
        }
 
        /**
-        * 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/jfinancials-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 715ea6ea8953d47edfc35e1f1466880bb36a72fb..87420a225d6ff23acb7d6f0d41d9f7c691d1ec23 100644 (file)
  */
 package org.mxchange.jfinancials.beans.phone;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jfinancials.beans.BaseFinancialsController;
 import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jfinancials.beans.BaseFinancialsController;
 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 FinancialsAdminPhoneWebRequestBean extends BaseFinancialsController
         */
        private AdminContactsPhoneSessionBeanRemote adminPhoneBean;
 
-       /**
-        * Cell phone number
-        */
-       private DialableMobileNumber cellPhone;
-
        /**
         * Fax number
         */
@@ -62,31 +58,15 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsController
         */
        private DialableLandLineNumber landLine;
 
+       /**
+        * Cell phone number
+        */
+       private DialableMobileNumber mobileNumber;
+
        /**
         * Default constructor
         */
        public FinancialsAdminPhoneWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminPhoneBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsAdminPhoneWebRequestBean extends BaseFinancialsController
                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/jfinancials-ejb/admincontactphone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
 }
index a93da68d6a1a5e4b65b32de6af1c0ba1015e6b88..821d521fc085d53163f278ebd41f25a7381685e3 100644 (file)
@@ -36,7 +36,7 @@ public interface FinancialsAdminPhoneWebRequestController extends Serializable {
         * <p>
         * @param cellPhone Dialable mobile number instance
         */
-       void setCellPhone (final DialableMobileNumber cellPhone);
+       void setMobileNumber (final DialableMobileNumber cellPhone);
 
        /**
         * Getter for dialable mobile number instance
index 29a1f54e702b76228926fd6d69a2de916c96a2f2..795bd32eee5382dae6c4d48003b4083a1c24d79b 100644 (file)
 package org.mxchange.jfinancials.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;
 import javax.inject.Named;
 import org.mxchange.jfinancials.beans.BaseFinancialsController;
+import org.mxchange.jfinancials.beans.login.FinancialsUserLoginWebSessionController;
+import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
-import org.mxchange.jfinancials.beans.login.FinancialsUserLoginWebSessionController;
-import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController;
 
 /**
  * A web request bean for user profiles
@@ -42,6 +43,12 @@ public class FinancialsUserProfileWebRequestBean extends BaseFinancialsControlle
         */
        private static final long serialVersionUID = 187_687_145_286_710L;
 
+       /**
+        * User controller
+        */
+       @Inject
+       private FinancialsUserWebSessionController userController;
+
        /**
         * Login controller
         */
@@ -49,10 +56,17 @@ public class FinancialsUserProfileWebRequestBean extends BaseFinancialsControlle
        private FinancialsUserLoginWebSessionController userLoginController;
 
        /**
-        * User controller
+        * Default constructor
         */
-       @Inject
-       private FinancialsUserWebSessionController userController;
+       public FinancialsUserProfileWebRequestBean () {
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
 
        @Override
        public boolean isProfileLinkVisibleById (final Long userId) {
index 57655b26d6ba1990e87103559a1d4c7623a032c2..7e59be69a76eb4bd7a19a9b759ac6476e17a242e 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jfinancials.beans.profilemode;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.jfinancials.beans.BaseFinancialsController;
@@ -46,4 +47,12 @@ public class FinancialsProfileModeWebApplicationBean extends BaseFinancialsContr
                // Return it
                return ProfileMode.values();
        }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
 }
index 2ded159e0e547d389886c0849f780442c8bd5eb8..dc85ef50249628aa66bbf394e361ddc2cd49d314 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jfinancials.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;
@@ -98,16 +99,6 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll
         * Default constructor
         */
        public FinancialsUserRegisterWebSessionBean () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.registerBean = (UserRegistrationSessionBeanRemote) context.lookup("java:global/jfinancials-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 FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll
                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/jfinancials-ejb/register!org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
 }
index 843dbb541eec924be03ea6b092c02d8b980acced..2414d935e753b32b0ce4a3eb3a646199689cf082 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jfinancials.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 FinancialsResendLinkWebSessionBean extends BaseFinancialsController
         * Default constructor
         */
        public FinancialsResendLinkWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.emailBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/resendLink!org.mxchange.jfinancials.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -152,6 +142,24 @@ public class FinancialsResendLinkWebSessionBean extends BaseFinancialsController
                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/jfinancials-ejb/resendLink!org.mxchange.jfinancials.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 030e32ebec7b9084ae3684d2d68d4bd5f607e601..86542dae5d30e6c8d107120c0d8ec58a9569515d 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jfinancials.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 FinancialsAdminUserWebRequestBean extends BaseFinancialsController
        /**
         * Administrative user EJB
         */
-       private final AdminUserSessionBeanRemote adminUserBean;
+       private AdminUserSessionBeanRemote adminUserBean;
 
        /**
         * Bean helper instance
@@ -112,7 +113,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsController
        /**
         * General user EJB
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * Regular user controller
@@ -157,18 +158,6 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsController
         * Default constructor
         */
        public FinancialsAdminUserWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-                       this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -441,6 +430,25 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsController
                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/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+                       this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
        @Override
        public String lockUserAccount (final User user) {
                // Is the user instance valid and CONFIRMED?
index 29d95c4fd3c60dcf99bc53b3f232f8dfb0e01c0a..151c641ea17507357b41c8868781f14aa9a624c3 100644 (file)
@@ -33,7 +33,6 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
 import org.mxchange.jfinancials.beans.BaseFinancialsController;
 import org.mxchange.jfinancials.beans.contact.FinancialsContactWebSessionController;
 import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
@@ -70,11 +69,6 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * Contact EJB
-        */
-       private ContactSessionBeanRemote contactBean;
-
        /**
         * General contact controller
         */
@@ -103,7 +97,7 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * User id
@@ -158,24 +152,10 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple
         * Default constructor
         */
        public FinancialsUserWebSessionBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jfinancials-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
         */
@@ -566,6 +546,18 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple
         */
        @PostConstruct
        public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+
                // Initialize user list
                this.userList = this.userBean.allUsers();
 
index fc0f235a680a1967c7c0e529805e670da454d4cc..38cdc506066af47e4865aef6bb8a2a78cfa6269f 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jfinancials.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;
@@ -26,8 +27,11 @@ import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jfinancials.beans.BaseFinancialsController;
 import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jfinancials.beans.BaseFinancialsController;
+import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
+import org.mxchange.jfinancials.beans.login.FinancialsUserLoginWebSessionController;
+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;
@@ -37,9 +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.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
-import org.mxchange.jfinancials.beans.login.FinancialsUserLoginWebSessionController;
-import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
 
 /**
  * A user password (change) bean (controller)
@@ -64,7 +65,7 @@ public class FinancialsUserPasswordWebRequestBean extends BaseFinancialsControll
        /**
         * Remote user bean
         */
-       private final UserSessionBeanRemote userBean;
+       private UserSessionBeanRemote userBean;
 
        /**
         * Current password (for confirmation of password change)
@@ -98,17 +99,6 @@ public class FinancialsUserPasswordWebRequestBean extends BaseFinancialsControll
         * Default constructor
         */
        public FinancialsUserPasswordWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
        }
 
        @Override
@@ -227,6 +217,25 @@ public class FinancialsUserPasswordWebRequestBean extends BaseFinancialsControll
                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/jfinancials-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 72c4de4db672927eef57111fc61237bcad1d6d20..9d47fbeeacfdd99e5014d4bdc808e8d45af36bdd 100644 (file)
@@ -70,10 +70,19 @@ public interface FinancialsUserPasswordWebRequestController extends Serializable
        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 ();
+
 }