]> git.mxchange.org Git - addressbook-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sun, 3 Sep 2017 15:50:06 +0000 (17:50 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 9 Sep 2017 20:12:40 +0000 (22:12 +0200)
- removed not needed constructor from converter/validator
- reverted `@EJB` annotation in mobile-provider converter as it was not working

Signed-off-by: Roland Häder <roland@mxchange.org>
14 files changed:
src/java/org/mxchange/addressbook/converter/business/basicdata/AddressbookBusinessContactConverter.java
src/java/org/mxchange/addressbook/converter/business/company_employee/AddressbookCompanyEmployeeConverter.java
src/java/org/mxchange/addressbook/converter/business/headquarters/AddressbookCompanyHeadquartersConverter.java
src/java/org/mxchange/addressbook/converter/contact/AddressbookContactConverter.java
src/java/org/mxchange/addressbook/converter/country/AddressbookCountryConverter.java
src/java/org/mxchange/addressbook/converter/fax/AddressbookFaxNumberConverter.java
src/java/org/mxchange/addressbook/converter/landline/AddressbookLandLineNumberConverter.java
src/java/org/mxchange/addressbook/converter/mobile/AddressbookMobileNumberConverter.java
src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java
src/java/org/mxchange/addressbook/converter/user/AddressbookUserConverter.java
src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java
src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java
src/java/org/mxchange/addressbook/validator/url/AddressbookUrlValidator.java
src/java/org/mxchange/addressbook/validator/user/AddressbookUserIdValidator.java

index 9e866c364d67086e09e72f7c96234b9003b74f00..dcc32fd374558cb6a3472b78b32d528f18f74125 100644 (file)
@@ -43,12 +43,6 @@ public class AddressbookBusinessContactConverter implements Converter<BusinessBa
         */
        private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookBusinessContactConverter () {
-       }
-
        @Override
        public BusinessBasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index e4eaecd4755e52b19f0bb81b852a3a10777d5df1..7efd4749756623d77b52cd9d7e3b8113b5f71a12 100644 (file)
@@ -43,12 +43,6 @@ public class AddressbookCompanyEmployeeConverter implements Converter<Employee>
         */
        private static CompanyEmployeeSessionBeanRemote COMPANY_EMPLOYEE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookCompanyEmployeeConverter () {
-       }
-
        @Override
        public Employee getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 4526fb858dc3b411bf1a16cddd379637073bd057..23796ff56944eec98c9350427f5424c717fb53ce 100644 (file)
@@ -43,12 +43,6 @@ public class AddressbookCompanyHeadquartersConverter implements Converter<Headqu
         */
        private static CompanyHeadquartersSessionBeanRemote COMPANY_HEADQUARTERS_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookCompanyHeadquartersConverter () {
-       }
-
        @Override
        public HeadquartersData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 240af7dffaef9d9aaff0b9007c2673bbe88e32cd..d7aa83eae023ef606fb223df749161afc7ba55c7 100644 (file)
@@ -43,12 +43,6 @@ public class AddressbookContactConverter implements Converter<Contact> {
         */
        private static ContactSessionBeanRemote CONTACT_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookContactConverter () {
-       }
-
        @Override
        public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 15df38e1c4506db02596a6ee001b73ec5a851e66..0d489d51833c0a3bb21af6daf14412dc075e16b9 100644 (file)
@@ -44,12 +44,6 @@ public class AddressbookCountryConverter implements Converter<Country> {
         */
        private static CountrySingletonBeanRemote COUNTRY_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookCountryConverter () {
-       }
-
        @Override
        public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index c58556f99ed0090e7c5c3c3f6fb12d2ce613a0b5..3cc35cb4dae75abc3a76cc956086b0ec0dca845a 100644 (file)
@@ -43,12 +43,6 @@ public class AddressbookFaxNumberConverter implements Converter<DialableFaxNumbe
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookFaxNumberConverter () {
-       }
-
        @Override
        public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index cd918ead2813fdbb99f39aceec19903b0e3d5f75..4f273938970434ac706755e57cecfdd0d7a52610 100644 (file)
@@ -43,12 +43,6 @@ public class AddressbookLandLineNumberConverter implements Converter<DialableLan
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookLandLineNumberConverter () {
-       }
-
        @Override
        public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index c56efdc1c87e82f87759750fc130eecc97f146a7..80a3c75649411b59fb573a9c5d8f5f334fe9e546 100644 (file)
@@ -43,12 +43,6 @@ public class AddressbookMobileNumberConverter implements Converter<DialableMobil
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookMobileNumberConverter () {
-       }
-
        @Override
        public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 3183523afd53fd1a6500dd8b4b46e1631ac9ee5a..7d6b71ccfec39ed98e6e286a937ffdb123b67349 100644 (file)
@@ -18,11 +18,15 @@ package org.mxchange.addressbook.converter.mobileprovider;
 
 import java.util.List;
 import java.util.Objects;
-import javax.ejb.EJB;
+import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
 
@@ -37,17 +41,24 @@ public class AddressbookMobileProviderConverter implements Converter<MobileProvi
        /**
         * Mobile provider bean
         */
-       @EJB(lookup = "java:global/addressbook-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
-       private MobileProviderSingletonBeanRemote mobileProviderBean;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookMobileProviderConverter () {
-       }
+       private static MobileProviderSingletonBeanRemote MOBILE_PROVIDER_BEAN;
 
        @Override
        public MobileProvider getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Is the instance there?
+               if (MOBILE_PROVIDER_BEAN == null) {
+                       try {
+                               // Not yet, attempt lookup
+                               Context initial = new InitialContext();
+
+                               // Lookup EJB
+                               MOBILE_PROVIDER_BEAN = (MobileProviderSingletonBeanRemote) initial.lookup("java:global/jfinancials-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote");
+                       } catch (final NamingException ex) {
+                               // Throw it again
+                               throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                       }
+               }
+
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
                        // Warning message
@@ -58,7 +69,7 @@ public class AddressbookMobileProviderConverter implements Converter<MobileProvi
                }
 
                // Get full list
-               List<MobileProvider> providerList = this.mobileProviderBean.allMobileProviders();
+               List<MobileProvider> providerList = this.MOBILE_PROVIDER_BEAN.allMobileProviders();
 
                // Init value
                MobileProvider provider = null;
index f47729c3da7974004801c0a47f40ced01d39d27b..56b9ba70a8cb71bd28f6ef22e46f62959bcbb7c3 100644 (file)
@@ -42,12 +42,6 @@ public class AddressbookUserConverter implements Converter<User> {
         */
        private static UserSessionBeanRemote USER_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookUserConverter () {
-       }
-
        @Override
        public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index ae26fc0045bfa61f3b462e89793cfdb42b383b24..b68420fe76249ce169e8fe9ba36fa9161ccc2a07 100644 (file)
@@ -36,12 +36,6 @@ public class AddressbookBirthdayValidator extends BaseDateValidator {
         */
        private static final long serialVersionUID = 28_735_756_819_460L;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookBirthdayValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // All accepted, required fields
index f11e40a773f14059510310d7b3758dcb9b77e72b..9b2b278023b3963071c4a3308d4af0bd84587ea5 100644 (file)
@@ -57,12 +57,6 @@ public class AddressbookEmailAddressValidator extends BaseStringValidator {
         */
        private static final long serialVersionUID = 187_536_745_607_192L;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookEmailAddressValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?
index 43b9daab53d489cb19d74d425fbb06626ea8ff7e..ac0266492ad156072875b6c8a98692187332b9b2 100644 (file)
@@ -49,12 +49,6 @@ public class AddressbookUrlValidator extends BaseStringValidator {
         */
        private static final long serialVersionUID = 187_536_745_607_193L;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookUrlValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // The required field
index 7c4aac1d1da1a17da83a34922e1b52d3f38ba8a1..2ea1d7177e9d6bf515c07fcee6ebd3e78345b068 100644 (file)
@@ -46,12 +46,6 @@ public class AddressbookUserIdValidator extends BaseNumberValidator {
         */
        private static final long serialVersionUID = 12_869_569_314_764_690L;
 
-       /**
-        * Default constructor
-        */
-       public AddressbookUserIdValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?