]> git.mxchange.org Git - pizzaservice-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 20:20:42 +0000 (22:20 +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/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java
src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaAdminBusinessDataWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaBusinessDataWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/business/employee/PizzaAdminCompanyEmployeeWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/contact/phone/PizzaAdminContactPhoneWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/phone/PizzaContactPhoneWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminPhoneWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/activity/PizzaUserActivityWebApplicationBean.java
src/java/org/mxchange/pizzaapplication/beans/user/confirmlink/PizzaConfirmationLinkWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/login/PizzaUserLoginWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/password/PizzaUserPasswordWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/register/PizzaUserRegisterWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/resendlink/PizzaResendLinkWebSessionBean.java
web/WEB-INF/beans.xml

index b67bc4d9721b30f7474311ac159b5accf35b850f..182268750c7d3f0e2ad4fe20a767768f650d9188 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 80ef320d59226776300006ec9f5e10aeb3cd6119..5e75a178a4567ecde73b5955522d3f076c266ae5 100644 (file)
  */
 package org.mxchange.pizzaapplication.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.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote;
 import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
@@ -58,8 +54,9 @@ public class PizzaAdminBusinessDataWebRequestBean extends BasePizzaController im
        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 PizzaAdminBusinessDataWebRequestBean extends BasePizzaController im
                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/pizzaservice-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
 }
index c59eb9b4c9f078d4b2e62eb10ab1d8513fb60fd2..ce4be2b4ee7bd9d499358909210ae908629ad2ec 100644 (file)
 package org.mxchange.pizzaapplication.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.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote;
 import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote;
@@ -50,18 +47,20 @@ public class PizzaBusinessDataWebSessionBean extends BasePizzaController impleme
        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 PizzaBusinessDataWebSessionBean extends BasePizzaController impleme
        public PizzaBusinessDataWebSessionBean () {
                // Call super constructor
                super();
+
+               // Init list
+               this.businessContacts = new LinkedList<>();
        }
 
        /**
@@ -151,6 +153,9 @@ public class PizzaBusinessDataWebSessionBean extends BasePizzaController impleme
                        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 PizzaBusinessDataWebSessionBean extends BasePizzaController impleme
         */
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<BusinessBasicData> allCompanyBasicData () {
+               // Initialize list
+               this.initializeList();
+
+               // Return it
                return this.businessContacts;
        }
 
@@ -328,27 +337,14 @@ public class PizzaBusinessDataWebSessionBean extends BasePizzaController impleme
        }
 
        /**
-        * 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/pizzaservice-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N
-
-                       // Try to lookup
-                       this.adminBusinessDataBean = (AdminBusinessDataSessionBeanRemote) context.lookup("java:global/pizzaservice-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 b86cf11dca8fec7248865c77a96e5958e3b94bb1..23ff913a1924382d6205771cc62be1bee31da12c 100644 (file)
  */
 package org.mxchange.pizzaapplication.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.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
 
@@ -43,6 +39,7 @@ public class PizzaAdminCompanyEmployeeWebRequestBean extends BasePizzaController
        /**
         * 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 PizzaAdminCompanyEmployeeWebRequestBean extends BasePizzaController
                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/pizzaservice-ejb/adminCompanyEmployee!org.mxchange.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
 }
index 1637ecc19cd22d534fad18b4845ae149b13f769d..e5349b11c1292d696a8fa1fd7fd8c41d14e67994 100644 (file)
@@ -19,18 +19,14 @@ package org.mxchange.pizzaapplication.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.jcontacts.contact.AdminContactSessionBeanRemote;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
@@ -53,7 +49,6 @@ import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 
 /**
  * Administrative user bean (controller)
@@ -84,14 +79,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        /**
         * Administrative contact EJB
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminContact!org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote")
        private AdminContactSessionBeanRemote adminContactBean;
 
-       /**
-        * Bean helper instance
-        */
-       @Inject
-       private PizzaWebRequestHelperController beanHelper;
-
        /**
         * Birth day
         */
@@ -108,8 +98,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        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 PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                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/pizzaservice-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-
-                       // Try to lookup (administative)
-                       this.adminContactBean = (AdminContactSessionBeanRemote) context.lookup("java:global/pizzaservice-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 boolean isRequiredPersonalDataSet () {
                return ((this.getPersonalTitle() != null) &&
index 2daa988fa87904d72d4a80798b4f16410b55a169..4556208cefd8121d12eb5d518bbfe3c0eca1cf0f 100644 (file)
@@ -55,17 +55,6 @@ public interface PizzaAdminContactWebRequestController extends Serializable {
        @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 ();
-
        /**
         * Checks whether all required personal data is set
         * <p>
index 5c01b27eddb99915bf6c70e763a6b401f39ff3da..d1d275bb00dd0f4778da35d9b8d38e1d5d4886f4 100644 (file)
@@ -39,7 +39,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 PizzaContactWebSessionBean extends BasePizzaController implements P
        private String comment;
 
        /**
-        * Remote contact bean
+        * EJB for general contact purposes
         */
        private ContactSessionBeanRemote contactBean;
 
@@ -1110,41 +1109,12 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                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 4a79b73e1ba104e704aa5895eb1c490396918bf7..2215979cb8cadde9a11248fb70e571284da0d6c9 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.pizzaapplication.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 PizzaContactWebSessionController 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 PizzaContactWebSessionController 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 66de22a1672c668446e9f753e7bebcd7d4b1dcab..d5fe16d5f33ac757794b15a02c432ee82b21aad0 100644 (file)
@@ -18,17 +18,13 @@ package org.mxchange.pizzaapplication.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.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
@@ -61,7 +57,6 @@ import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 import org.mxchange.pizzaapplication.beans.phone.PizzaAdminPhoneWebRequestController;
 
 /**
@@ -86,6 +81,7 @@ public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaController im
        /**
         * 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 PizzaAdminContactPhoneWebRequestBean extends BasePizzaController im
        @Inject
        private PizzaAdminPhoneWebRequestController adminPhoneController;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private PizzaWebRequestHelperController beanHelper;
-
        /**
         * Contact instance
         */
@@ -783,24 +773,6 @@ public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaController im
                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/pizzaservice-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 a221b7372b53ce81580846e1aabd2b922cdfc202..197c32221f6619778200dc77483fcf4bd15eade2 100644 (file)
@@ -42,7 +42,6 @@ import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
 import org.mxchange.pizzaapplication.beans.contact.PizzaContactWebSessionController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 
 /**
  * A general contact bean (controller)
@@ -58,12 +57,6 @@ public class PizzaContactPhoneWebSessionBean extends BasePizzaController impleme
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private PizzaWebRequestHelperController beanHelper;
-
        /**
         * General contact controller
         */
index bd276b212b0c0d00b54fcb1f54390fc8d9e8055f..540e481d731f695eb5f50e5cf476a620f619931e 100644 (file)
@@ -19,16 +19,13 @@ package org.mxchange.pizzaapplication.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.jcountry.data.Country;
 import org.mxchange.jcountry.data.CountryData;
 import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
@@ -66,6 +63,7 @@ public class PizzaAdminCountryWebRequestBean extends BasePizzaController impleme
        /**
         * Remote country EJB
         */
+       @EJB (lookup = "java:global/addressbook-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote")
        private CountrySingletonBeanRemote countryBean;
 
        /**
@@ -263,24 +261,6 @@ public class PizzaAdminCountryWebRequestBean extends BasePizzaController impleme
                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/pizzaservice-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 6fe58d02137d2b039c7230abd94b55152a87fba8..fc0074b8c6c57aa9b48c1f013a4f7a2ce651073f 100644 (file)
@@ -19,16 +19,13 @@ package org.mxchange.pizzaapplication.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.jcountry.data.Country;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
@@ -55,6 +52,7 @@ public class PizzaAdminMobileProviderWebRequestBean extends BasePizzaController
        /**
         * Remote EJB for mobile providers (administrative)
         */
+       @EJB (lookup = "java:global/addressbook-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote")
        private AdminMobileProviderSessionBeanRemote adminRemoteBean;
 
        /**
@@ -211,24 +209,6 @@ public class PizzaAdminMobileProviderWebRequestBean extends BasePizzaController
                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/pizzaservice-ejb/adminMobileProvider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
-       }
-
        /**
         * Clears this bean
         */
index 23b6dc07cbd459311ee1773f82466b1ee58f7ce2..7fb54b35ad0079904bf16add7fcc9df20113638e 100644 (file)
@@ -20,17 +20,13 @@ 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.jcountry.data.Country;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
@@ -62,7 +58,6 @@ import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 
 /**
  * Administrative bean (controller) for phone numbers
@@ -86,14 +81,9 @@ public class PizzaAdminPhoneWebRequestBean extends BasePizzaController implement
        /**
         * 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 PizzaWebRequestHelperController beanHelper;
-
        /**
         * fax number
         */
@@ -914,24 +904,6 @@ public class PizzaAdminPhoneWebRequestBean extends BasePizzaController implement
                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/pizzaservice-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 df865996caabf359451e2dfa50a65c67d11e9a99..0812807ed9ebb75fb7b097efc5ecfe1d5a619282 100644 (file)
@@ -66,7 +66,6 @@ import org.mxchange.juserlogincore.login.UserLoginUtils;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
 import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController;
 import org.mxchange.pizzaapplication.beans.contact.PizzaContactWebSessionController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 import org.mxchange.pizzaapplication.beans.localization.PizzaLocalizationSessionController;
 
 /**
@@ -101,12 +100,6 @@ public class PizzaAdminUserWebRequestBean extends BasePizzaController implements
         */
        private AdminUserSessionBeanRemote adminUserBean;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private PizzaWebRequestHelperController beanHelper;
-
        /**
         * Contact instance
         */
index 27fa7d9b7eca956e387c45838c9e94fbd01b2fb8..aa34d6efb92f845d57d718a6993a03d161dcc912 100644 (file)
@@ -27,7 +27,6 @@ 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;
@@ -52,7 +51,6 @@ import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredE
 import org.mxchange.juserlogincore.events.resendlink.ObservableUserResendLinkAccountEvent;
 import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 
 /**
  * A controller (bean) for user activity log
@@ -68,12 +66,6 @@ public class PizzaUserActivityWebApplicationBean extends BasePizzaController imp
         */
        private static final long serialVersionUID = 192_586_376_717_856_904L;
 
-       /**
-        * Bean helper
-        */
-       @Inject
-       private PizzaWebRequestHelperController beanHelper;
-
        /**
         * User instance
         */
index ad0a09e37ac17a5c5d975c10f51e8208c420bc79..cedd80763f5780b26b1cdfe699f5ed0c1823c0e2 100644 (file)
@@ -43,7 +43,6 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent;
 import org.mxchange.juserlogincore.events.confirmation.UserConfirmedAccountEvent;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController;
 
 /**
@@ -60,12 +59,6 @@ public class PizzaConfirmationLinkWebRequestBean extends BasePizzaController imp
         */
        private static final long serialVersionUID = 57_637_182_796_370L;
 
-       /**
-        * Bean helper instance
-        */
-       @Inject
-       private PizzaWebRequestHelperController beanHelper;
-
        /**
         * Event being fired when a bean helper should be cleaned
         */
index a2e82bfa72497381a1731bb59064c47a8bfa17f0..dc5d2d6da475930526db95430e42ca0289ca730e 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.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
 import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
@@ -114,6 +110,7 @@ public class PizzaUserLoginWebSessionBean extends BasePizzaController implements
        /**
         * Remote register session-scoped bean
         */
+       @EJB (lookup = "java:global/addressbook-ejb/userLogin!org.mxchange.juserlogincore.model.user.login.UserLoginSessionBeanRemote")
        private UserLoginSessionBeanRemote userLoginBean;
 
        /**
@@ -138,6 +135,7 @@ public class PizzaUserLoginWebSessionBean extends BasePizzaController implements
        /**
         * EJB for user's password history
         */
+       @EJB (lookup = "java:global/addressbook-ejb/userPasswordHistory!org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote")
        private UserPasswordHistorySessionBeanRemote userPasswordHistoryBean;
 
        /**
@@ -348,29 +346,6 @@ public class PizzaUserLoginWebSessionBean extends BasePizzaController implements
                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/jrecruiter-ejb/userLogin!org.mxchange.juserlogincore.model.user.login.UserLoginSessionBeanRemote"); //NOI18N
-
-                       // Also find this
-                       this.userPasswordHistoryBean = (UserPasswordHistorySessionBeanRemote) context.lookup("java:global/jrecruiter-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 898747ae4f15c64228fdedadeb90225bef600d78..c2d3eb52723da242ffa37f1c47b76d80b7c232d9 100644 (file)
 package org.mxchange.pizzaapplication.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.jcoreee.utils.FacesUtils;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
@@ -65,6 +62,7 @@ public class PizzaUserPasswordWebRequestBean extends BasePizzaController impleme
        /**
         * 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 PizzaUserPasswordWebRequestBean extends BasePizzaController impleme
                        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 PizzaUserPasswordWebRequestBean extends BasePizzaController impleme
                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/pizzaservice-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 7bfdc12a6390a2dbd6228f518d3c678d41eb2f8a..5bb99dd63cac85b4d1c62eeeb5c1abad4473e2f1 100644 (file)
  */
 package org.mxchange.pizzaapplication.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.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.UserContact;
 import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent;
+import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent;
 import org.mxchange.jusercore.exceptions.DataRepeatMismatchException;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
@@ -68,6 +67,20 @@ public class PizzaUserRegisterWebSessionBean extends BasePizzaController impleme
        @Inject
        private PizzaAdminUserWebRequestController 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
         */
@@ -83,6 +96,7 @@ public class PizzaUserRegisterWebSessionBean extends BasePizzaController impleme
        /**
         * Remote register session-scoped bean
         */
+       @EJB (lookup = "java:global/addressbook-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote")
        private UserRegistrationSessionBeanRemote registerBean;
 
        /**
@@ -303,21 +317,4 @@ public class PizzaUserRegisterWebSessionBean extends BasePizzaController impleme
                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/pizzaservice-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
-       }
-
 }
index 6e63b789b1f4191159dff66c343de74d5af6ffe4..66ef8003533490bdb7e6b933e62ad1b2a9115920 100644 (file)
 package org.mxchange.pizzaapplication.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.jcoreee.events.locale.ObservableLocaleChangeEvent;
 import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
@@ -76,6 +72,7 @@ public class PizzaResendLinkWebSessionBean extends BasePizzaController implement
        /**
         * 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 PizzaResendLinkWebSessionBean extends BasePizzaController implement
                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 PizzaResendLinkWebSessionBean extends BasePizzaController implement
                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/pizzaservice-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 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"