]> git.mxchange.org Git - addressbook-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 29 Aug 2017 19:34:12 +0000 (21:34 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 29 Aug 2017 19:48:40 +0000 (21:48 +0200)
- removed many PostConstruct methods as this was a bad idea anyway as it
  confuses the container while it is wrapping the managed beans into proxy
  objects. @EJB(lookup="full-JNDI-name") does fully replace this many code
- still I kept some there and may have to re-rename the now private method
- removed some JSF-only and some obsolete methods from interface and/or bean
- added GNU header to beans.xml

Signed-off-by: Roland Häder <roland@mxchange.org>
21 files changed:
src/java/org/mxchange/addressbook/beans/business/basicdata/AddressbookAdminBusinessDataWebRequestBean.java
src/java/org/mxchange/addressbook/beans/business/basicdata/AddressbookBusinessDataWebSessionBean.java
src/java/org/mxchange/addressbook/beans/business/employee/AddressbookAdminCompanyEmployeeWebRequestBean.java
src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java
src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java
src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java
src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java
src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookAdminContactPhoneWebRequestBean.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/mobileprovider/AddressbookAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java
src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java
src/java/org/mxchange/addressbook/beans/user/activity/AddressbookUserActivityWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/user/confirmlink/AddressbookConfirmationLinkWebRequestBean.java
src/java/org/mxchange/addressbook/beans/user/login/AddressbookUserLoginWebSessionBean.java
src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java
src/java/org/mxchange/addressbook/beans/user/register/AddressbookUserRegisterWebSessionBean.java
src/java/org/mxchange/addressbook/beans/user/resendlink/AddressbookResendLinkWebSessionBean.java
src/java/org/mxchange/addressbook/validator/business/basicdata/FinancialsCompanyNameValidator.java
web/WEB-INF/beans.xml

index 896b2c4bf5c0871e04e9169b48681b77a92e211d..232971419af1a51aa84250f1165f348185020c85 100644 (file)
  */
 package org.mxchange.addressbook.beans.business.basicdata;
 
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
 import javax.faces.FacesException;
-import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote;
 import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
 import org.mxchange.jcontactsbusiness.employee.Employee;
 import org.mxchange.jcontactsbusiness.events.basicdata.added.AdminAddedBusinessBasicDataEvent;
+import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent;
 import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
 import org.mxchange.jcountry.data.Country;
@@ -41,7 +38,6 @@ import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent;
 
 /**
  * An administrative business contact bean (controller)
@@ -58,8 +54,9 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
        private static final long serialVersionUID = 56_189_028_928_374L;
 
        /**
-        * Remote contact bean
+        * EJB for administrative purposes
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote")
        private AdminBusinessDataSessionBeanRemote adminBusinessDataBean;
 
        /**
@@ -514,22 +511,4 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
                this.landLineNumber = landLineNumber;
        }
 
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.adminBusinessDataBean = (AdminBusinessDataSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
 }
index 71a98bb96626b974198fc68f4c84be0831c66127..de80c145da716611cd7d17b71aff4bab6af75c19 100644 (file)
 package org.mxchange.addressbook.beans.business.basicdata;
 
 import java.text.MessageFormat;
+import java.util.LinkedList;
 import java.util.List;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Observes;
-import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.user.login.AddressbookUserLoginWebSessionController;
 import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote;
@@ -50,18 +47,20 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
        private static final long serialVersionUID = 56_189_028_928_371L;
 
        /**
-        * Remote contact bean
+        * EJB for administrative basic business data purposes
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote", description = "A stateless session bean for administrative purposes.")
        private AdminBusinessDataSessionBeanRemote adminBusinessDataBean;
 
        /**
         * A list of all registered companies (globally)
         */
-       private List<BusinessBasicData> businessContacts;
+       private final List<BusinessBasicData> businessContacts;
 
        /**
-        * Remote contact bean
+        * EJB for general basic business data purposes
         */
+       @EJB (lookup = "java:global/addressbook-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote", description = "A stateless session bean for general purposes.")
        private BusinessDataSessionBeanRemote businessDataBean;
 
        /**
@@ -121,6 +120,9 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
        public AddressbookBusinessDataWebSessionBean () {
                // Call super constructor
                super();
+
+               // Init list
+               this.businessContacts = new LinkedList<>();
        }
 
        /**
@@ -151,6 +153,9 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
                        throw new IllegalArgumentException("event.basicData.companyName is empty");
                }
 
+               // Initialize list
+               this.initializeList();
+
                // Add it to list
                this.businessContacts.add(event.getBasicData());
        }
@@ -162,6 +167,10 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
         */
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<BusinessBasicData> allCompanyBasicData () {
+               // Initialize list
+               this.initializeList();
+
+               // Return it
                return this.businessContacts;
        }
 
@@ -328,27 +337,14 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
        }
 
        /**
-        * Post-initialization of this class
+        * Initializer method
         */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.businessDataBean = (BusinessDataSessionBeanRemote) context.lookup("java:global/addressbook-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N
-
-                       // Try to lookup
-                       this.adminBusinessDataBean = (AdminBusinessDataSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
+       private void initializeList () {
+               // Is the list empty?
+               if (this.businessContacts.isEmpty()) {
+                       // Init user's contact list
+                       this.businessContacts.addAll(this.adminBusinessDataBean.allCompanyBasicData());
                }
-
-               // Init user's contact list
-               this.businessContacts = this.adminBusinessDataBean.allCompanyBasicData();
        }
 
 }
index 250859f1026a87c3171ac77b17a35571224655df..230121f458b9a86c8bce9ce70f0cff4f1bfac74c 100644 (file)
  */
 package org.mxchange.addressbook.beans.business.employee;
 
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 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.addressbook.beans.BaseAddressbookController;
 import org.mxchange.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote;
 
@@ -43,6 +39,7 @@ public class AddressbookAdminCompanyEmployeeWebRequestBean extends BaseAddressbo
        /**
         * EJB for administrative company employee purposes
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminCompanyEmployee!org.mxchange.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote")
        private AdminCompanyEmployeeSessionBeanRemote adminCompanyEmployeeBean;
 
        /**
@@ -53,22 +50,4 @@ public class AddressbookAdminCompanyEmployeeWebRequestBean extends BaseAddressbo
                super();
        }
 
-       /**
-        * Initialization method
-        */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.adminCompanyEmployeeBean = (AdminCompanyEmployeeSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminCompanyEmployee!org.mxchange.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
 }
index ad8679ac46feeaaaed550c49f10cd1c1453433d7..3e8ecd0956b0a4e11535d4580c8d42d7428a7f7f 100644 (file)
@@ -19,20 +19,15 @@ package org.mxchange.addressbook.beans.contact;
 import java.text.MessageFormat;
 import java.util.Date;
 import java.util.Iterator;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
-import javax.faces.context.FacesContext;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
-import org.mxchange.addressbook.beans.helper.AddressbookWebRequestHelperController;
 import org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
@@ -84,14 +79,9 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro
        /**
         * Administrative contact EJB
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminContact!org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote")
        private AdminContactSessionBeanRemote adminContactBean;
 
-       /**
-        * Bean helper instance
-        */
-       @Inject
-       private AddressbookWebRequestHelperController beanHelper;
-
        /**
         * Birth day
         */
@@ -108,8 +98,9 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro
        private String comment;
 
        /**
-        * Remote contact bean
+        * EJB for general contact purposes
         */
+       @EJB (lookup = "java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote")
        private ContactSessionBeanRemote contactBean;
 
        /**
@@ -1047,40 +1038,6 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro
                this.zipCode = zipCode;
        }
 
-       /**
-        * Post-initialization of this class
-        */
-       @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
-
-                       // Try to lookup (administative)
-                       this.adminContactBean = (AdminContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminContact!org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
-       @Override
-       @Deprecated
-       public boolean isPersonalTitleRequired () {
-               // Get context parameter
-               String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_personal_title_enabled"); //NOI18N
-
-               // Is it set?
-               boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
-
-               // Return value
-               return isRequired;
-       }
-
        @Override
        public void validateContactData () {
                if (this.getPersonalTitle() == null) {
index 1a2b1e4267a1ccfaea734d18d59ad900b4c30c67..0e068df8f7d228126b87e4de826e0c2ab5d571d2 100644 (file)
@@ -55,15 +55,4 @@ public interface AddressbookAdminContactWebRequestController extends Serializabl
        @Deprecated
        void setControllerType (final String controllerType);
 
-       /**
-        * Checks/returns whether the personal title (Mr./Mrs.) is required for this
-        * controller.
-        * <p>
-        * @return Whether personal title is required
-        * <p>
-        * @Deprecated Don't use this method
-        */
-       @Deprecated
-       boolean isPersonalTitleRequired ();
-
 }
index 082518f450059e6b98eec751e2b52dbcaea4eb30..754cbbf0ffbd05c95e31275587a6ce338e6bebac 100644 (file)
@@ -42,7 +42,6 @@ import org.mxchange.jcontacts.contact.UserContact;
 import org.mxchange.jcontacts.contact.title.PersonalTitle;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
@@ -94,7 +93,7 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
        private String comment;
 
        /**
-        * Remote contact bean
+        * EJB for general contact purposes
         */
        private ContactSessionBeanRemote contactBean;
 
@@ -1110,41 +1109,12 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
                return (Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat()));
        }
 
-       @Override
-       public Contact lookupContactById (final Long contactId) throws ContactNotFoundException {
-               // Init variable
-               Contact localContact = null;
-
-               // Clear this bean
-               this.clear();
-
-               // Try to lookup it in visible user list
-               for (final Iterator<Contact> iterator = this.contactList.iterator(); iterator.hasNext();) {
-                       // Get next user
-                       Contact next = iterator.next();
-
-                       // Is the user id found?
-                       if (Objects.equals(next.getContactId(), contactId)) {
-                               // Copy to other variable
-                               localContact = next;
-                               break;
-                       }
-               }
-
-               // Is it still null?
-               if (null == localContact) {
-                       // Not visible for the current user
-                       throw new ContactNotFoundException(contactId);
-               }
-
-               // Copy all data to this bean
-               this.copyContact(localContact);
-
-               // Return it
-               return localContact;
-       }
-
-       @Override
+       /**
+        * Returns a list of all selectable contacts for user creation. Contacts
+        * from already existing users are excluded in this list.
+        * <p>
+        * @return A list of all selectable contacts
+        */
        public List<Contact> selectableContacts () {
                return Collections.unmodifiableList(this.selectableContacts);
        }
index 90e5980566c17623403228c5c69a9335eeb50ccc..91fc42765db05a520a12ef10fdf8e0ea566dbff6 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.addressbook.beans.contact;
 import java.io.Serializable;
 import java.util.List;
 import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 
 /**
  * An interface for user beans
@@ -59,18 +58,6 @@ public interface AddressbookContactWebSessionController extends Serializable {
         */
        void updateContactDataFromController (final Contact userContact);
 
-       /**
-        * Tries to lookup contact by given id number. If the user is not found a
-        * proper exceptions are thrown.
-        * <p>
-        * @param contactId Contact id
-        * <p>
-        * @return Contact instance
-        * <p>
-        * @throws ContactNotFoundException If the user is not found
-        */
-       Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
-
        /**
         * Creates an instance from all properties
         * <p>
@@ -133,12 +120,4 @@ public interface AddressbookContactWebSessionController extends Serializable {
         */
        String doChangePersonalContactData ();
 
-       /**
-        * Returns a list of all selectable contacts for user creation. Contacts
-        * from already existing users are excluded in this list.
-        * <p>
-        * @return A list of all selectable contacts
-        */
-       List<Contact> selectableContacts ();
-
 }
index 58d2a9af3dab84421895f564b178f5a642aff6f3..772bff39d0de2dd30d69e5949cf465745705315c 100644 (file)
@@ -18,19 +18,14 @@ package org.mxchange.addressbook.beans.contact.phone;
 
 import java.text.MessageFormat;
 import java.util.Calendar;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
-import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
-import org.mxchange.addressbook.beans.helper.AddressbookWebRequestHelperController;
 import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestController;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
@@ -86,6 +81,7 @@ public class AddressbookAdminContactPhoneWebRequestBean extends BaseAddressbookC
        /**
         * Administrative EJB for phone number
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminContactPhone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote")
        private AdminContactsPhoneSessionBeanRemote adminContactPhoneBean;
 
        /**
@@ -115,12 +111,6 @@ public class AddressbookAdminContactPhoneWebRequestBean extends BaseAddressbookC
        @Inject
        private AddressbookAdminPhoneWebRequestController adminPhoneController;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private AddressbookWebRequestHelperController beanHelper;
-
        /**
         * Contact instance
         */
@@ -783,24 +773,6 @@ public class AddressbookAdminContactPhoneWebRequestBean extends BaseAddressbookC
                this.phoneId = phoneId;
        }
 
-       /**
-        * Post-construction method
-        */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminContactPhoneBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminContactPhone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
        /**
         * Unlinks fax data with current contact
         * <p>
index bb6c7d34682c351fd1841f5acd8c11aa28c1c7c4..2d0fdfcf540d514b4ce2a0f36008e58e3f8f3af2 100644 (file)
@@ -28,7 +28,6 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController;
-import org.mxchange.addressbook.beans.helper.AddressbookWebRequestHelperController;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
@@ -58,12 +57,6 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private AddressbookWebRequestHelperController beanHelper;
-
        /**
         * General contact controller
         */
index 9fe7798944d27403c41f93fd5b2a7cf97205c01b..b4cabfe7b38c2bad8a0a50befa86d90e85eb90cd 100644 (file)
@@ -19,16 +19,13 @@ package org.mxchange.addressbook.beans.country;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jcountry.data.CountryData;
@@ -66,6 +63,7 @@ public class AddressbookAdminCountryWebRequestBean extends BaseAddressbookContro
        /**
         * Remote country EJB
         */
+       @EJB (lookup = "java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote")
        private CountrySingletonBeanRemote countryBean;
 
        /**
@@ -263,24 +261,6 @@ 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 beaffd4a96a7c37cb2929f63894929838e224a19..467625e745f6c19a8d85b89daf9c6a77524c4452 100644 (file)
@@ -19,16 +19,13 @@ package org.mxchange.addressbook.beans.mobileprovider;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
@@ -55,6 +52,7 @@ public class AddressbookAdminMobileProviderWebRequestBean extends BaseAddressboo
        /**
         * Remote EJB for mobile providers (administrative)
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote")
        private AdminMobileProviderSessionBeanRemote adminRemoteBean;
 
        /**
@@ -208,24 +206,6 @@ 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 bafe654df60dac82359542b4b8f02c22bdaca30a..011b7a661a8e0088b87136d0e4a1f8e86b2eeb10 100644 (file)
@@ -20,19 +20,14 @@ import java.text.MessageFormat;
 import java.util.Calendar;
 import java.util.List;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
-import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
-import org.mxchange.addressbook.beans.helper.AddressbookWebRequestHelperController;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
@@ -86,14 +81,9 @@ public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookControll
        /**
         * Remote EJB for phone number (administrative)
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminPhone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote")
        private AdminPhoneSessionBeanRemote adminPhoneBean;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private AddressbookWebRequestHelperController beanHelper;
-
        /**
         * fax number
         */
@@ -914,24 +904,6 @@ public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookControll
                this.phoneNumber = phoneNumber;
        }
 
-       /**
-        * Post-construction method
-        */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminPhone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
-       }
-
        /**
         * Returns an instance of a DialableFaxNumber from all fields stored in this
         * bean.
index ac9e4f015b7e03ab78641a6f306a7428ec39ca82..14b428e7364149dd88d424d2cb5759f588c66af9 100644 (file)
@@ -35,7 +35,6 @@ import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.contact.AddressbookAdminContactWebRequestController;
 import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController;
-import org.mxchange.addressbook.beans.helper.AddressbookWebRequestHelperController;
 import org.mxchange.addressbook.beans.localization.AddressbookLocalizationSessionController;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcoreee.utils.FacesUtils;
@@ -101,12 +100,6 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle
         */
        private AdminUserSessionBeanRemote adminUserBean;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private AddressbookWebRequestHelperController beanHelper;
-
        /**
         * Contact instance
         */
index 7d8407f179d434ef3c2714c5f1ee5ec678c632d3..79bc7eea50675e0988af24a53c2f94a8e4b9134f 100644 (file)
@@ -27,13 +27,11 @@ import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.event.Observes;
 import javax.faces.view.facelets.FaceletException;
-import javax.inject.Inject;
 import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
-import org.mxchange.addressbook.beans.helper.AddressbookWebRequestHelperController;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
 import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
@@ -68,12 +66,6 @@ public class AddressbookUserActivityWebApplicationBean extends BaseAddressbookCo
         */
        private static final long serialVersionUID = 192_586_376_717_856_904L;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private AddressbookWebRequestHelperController beanHelper;
-
        /**
         * User instance
         */
index 720f64305343c07f5155a2f08447e89ecee0f7db..85c793f4a7340f0757a06550fbf4e921074f3cd3 100644 (file)
@@ -31,7 +31,6 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
-import org.mxchange.addressbook.beans.helper.AddressbookWebRequestHelperController;
 import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
 import org.mxchange.jcoreee.events.helper.clear.HelperCleanupEvent;
 import org.mxchange.jcoreee.events.helper.clear.ObservableHelperCleanupEvent;
@@ -60,12 +59,6 @@ public class AddressbookConfirmationLinkWebRequestBean extends BaseAddressbookCo
         */
        private static final long serialVersionUID = 57_637_182_796_370L;
 
-       /**
-        * Bean helper instance
-        */
-       @Inject
-       private AddressbookWebRequestHelperController beanHelper;
-
        /**
         * Event being fired when a bean helper should be cleaned
         */
index f2d0782d6070383b99708eb994d2404fa7259a7e..ff6b4beb0b6329e72512fd590a5282ecff7481e5 100644 (file)
@@ -20,18 +20,14 @@ import java.text.MessageFormat;
 import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
 import javax.faces.context.FacesContext;
-import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -107,6 +103,7 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
        /**
         * Remote register session-scoped bean
         */
+       @EJB (lookup = "java:global/addressbook-ejb/userLogin!org.mxchange.juserlogincore.model.user.login.UserLoginSessionBeanRemote")
        private UserLoginSessionBeanRemote userLoginBean;
 
        /**
@@ -131,6 +128,7 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
        /**
         * EJB for user's password history
         */
+       @EJB (lookup = "java:global/addressbook-ejb/userPasswordHistory!org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote")
        private UserPasswordHistorySessionBeanRemote userPasswordHistoryBean;
 
        /**
@@ -341,29 +339,6 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle
                return ((this.isUserLoggedIn()) && (Objects.equals(this.getLoggedInUser().getUserMustChangePassword(), Boolean.TRUE)));
        }
 
-       /**
-        * Post-construction method
-        */
-       @PostConstruct
-       public void init () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.userLoginBean = (UserLoginSessionBeanRemote) context.lookup("java:global/addressbook-ejb/userLogin!org.mxchange.juserlogincore.model.user.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);
-               }
-       }
-
        @Override
        public boolean isInvisible () {
                // Check on login
index 278849e19cd961ad375b7773b62fe99bc9f46979..9bc315798dde680afd04073de95439eca44c2810 100644 (file)
 package org.mxchange.addressbook.beans.user.password;
 
 import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController;
 import org.mxchange.addressbook.beans.user.login.AddressbookUserLoginWebSessionController;
@@ -65,6 +62,7 @@ public class AddressbookUserPasswordWebRequestBean extends BaseAddressbookContro
        /**
         * Remote user bean
         */
+       @EJB (lookup = "java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
        private UserSessionBeanRemote userBean;
 
        /**
@@ -179,7 +177,7 @@ public class AddressbookUserPasswordWebRequestBean extends BaseAddressbookContro
                        PasswordHistory passwordHistory = this.userBean.updateUserPassword(user, baseUrl);
 
                        // Fire event
-                       this.userUpdatedPasswordEvent.fire(new UpdatedUserPasswordEvent(passwordHistory,this.getUserPassword()));
+                       this.userUpdatedPasswordEvent.fire(new UpdatedUserPasswordEvent(passwordHistory, this.getUserPassword()));
                } catch (final UserNotFoundException | UserStatusUnconfirmedException | UserStatusLockedException ex) {
                        // Clear bean
                        this.clear();
@@ -249,24 +247,6 @@ 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?
index 785070ef44a05e4e9c15aa275170d4b90e0d83a0..98a2bc29db436d612894036a6789b0d36ab422e5 100644 (file)
  */
 package org.mxchange.addressbook.beans.user.register;
 
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController;
 import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController;
@@ -72,6 +69,20 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro
        @Inject
        private AddressbookAdminUserWebRequestController adminUserController;
 
+       /**
+        * An event being fired when a user name should be cleared
+        */
+       @Inject
+       @Any
+       private Event<ObservableClearUserNameEvent> clearUserNameEvent;
+
+       /**
+        * An event being fired when a user password should be cleared
+        */
+       @Inject
+       @Any
+       private Event<ObservableClearUserPasswordEvent> clearUserPasswordEvent;
+
        /**
         * Contact controller
         */
@@ -87,6 +98,7 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro
        /**
         * Remote register session-scoped bean
         */
+       @EJB (lookup = "java:global/addressbook-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote")
        private UserRegistrationSessionBeanRemote registerBean;
 
        /**
@@ -102,20 +114,6 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro
        @Any
        private Event<ObservableUpdatedUserPasswordEvent> userPasswordChangedEvent;
 
-       /**
-        * An event being fired when a user name should be cleared
-        */
-       @Inject
-       @Any
-       private Event<ObservableClearUserNameEvent> clearUserNameEvent;
-
-       /**
-        * An event being fired when a user password should be cleared
-        */
-       @Inject
-       @Any
-       private Event<ObservableClearUserPasswordEvent> clearUserPasswordEvent;
-
        /**
         * An event being fired when a new user has registered
         */
@@ -325,21 +323,4 @@ 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/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
-       }
-
 }
index 3f77190ac5447f3877f6d2b00a62eea03ceafdf5..6d926c15a6bbaaa72846618176b990c4c25fdca3 100644 (file)
 package org.mxchange.addressbook.beans.user.resendlink;
 
 import java.util.Locale;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
-import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
 import org.mxchange.addressbook.beans.localization.AddressbookLocalizationSessionController;
 import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
@@ -76,6 +72,7 @@ public class AddressbookResendLinkWebSessionBean extends BaseAddressbookControll
        /**
         * EJB for resending confirmation link
         */
+       @EJB (lookup = "java:global/addressbook-ejb/userResendConfirmationLink!org.mxchange.juserlogincore.model.user.resendlink.ResendLinkSessionBeanRemote")
        private ResendLinkSessionBeanRemote resendLinkBean;
 
        /**
@@ -214,6 +211,14 @@ public class AddressbookResendLinkWebSessionBean extends BaseAddressbookControll
                this.emailAddress = emailAddress;
        }
 
+       /**
+        * Clears email address fields so the user has to re-enter them
+        */
+       private void clear () {
+               // Clear fields
+               this.setEmailAddress(null);
+       }
+
        /**
         * Getter for locale instance
         * <p>
@@ -232,30 +237,4 @@ public class AddressbookResendLinkWebSessionBean extends BaseAddressbookControll
                this.locale = locale;
        }
 
-       /**
-        * Post-construction method
-        */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.resendLinkBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/addressbook-ejb/userResendConfirmationLink!org.mxchange.juserlogincore.model.user.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
-        */
-       private void clear () {
-               // Clear fields
-               this.setEmailAddress(null);
-       }
-
 }
index 4943b513b7112fdb9b32d2bc27a5687d0f5b5830..fa63003b39cf7be6924ef204775476bfc1e0e2a4 100644 (file)
@@ -85,7 +85,7 @@ public class FinancialsCompanyNameValidator extends BaseStringValidator {
                                Context initialContext = new InitialContext();
 
                                // ... and user controller
-                               FinancialsCompanyNameValidator.BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N
+                               FinancialsCompanyNameValidator.BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initialContext.lookup("java:global/addressbook-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N
                        } catch (final NamingException ex) {
                                // Continue to throw it
                                throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
index 0f4e2aab0e708698686e988a1a5ce99eb3702041..604563e42f59448924cb5ce7458e8e34eabe8cc1 100644 (file)
@@ -1,4 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2016, 2017 Roland Häder
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"