]> git.mxchange.org Git - jfinancials-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>
Sun, 3 Sep 2017 15:50:06 +0000 (17:50 +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/jfinancials/converter/business/basicdata/FinancialsBusinessContactConverter.java
src/java/org/mxchange/jfinancials/converter/business/company_employee/FinancialsCompanyEmployeeConverter.java
src/java/org/mxchange/jfinancials/converter/business/headquarters/FinancialsCompanyHeadquartersConverter.java
src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java
src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java
src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java
src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java
src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java
src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java
src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java
src/java/org/mxchange/jfinancials/validator/birthday/FinancialsBirthdayValidator.java
src/java/org/mxchange/jfinancials/validator/emailaddress/FinancialsEmailAddressValidator.java
src/java/org/mxchange/jfinancials/validator/url/FinancialsUrlValidator.java
src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java

index cec53b3489f2082a2812853e4c8afeb0d120bd9e..0d40d3ccd00c6a15d64edf9bd964e8c147cb714e 100644 (file)
@@ -43,12 +43,6 @@ public class FinancialsBusinessContactConverter implements Converter<BusinessBas
         */
        private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsBusinessContactConverter () {
-       }
-
        @Override
        public BusinessBasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 1ca1397fc74b7d409532257e1de709d16d852c8c..f2c377e0574453d98f39195247ecc67e007e76c6 100644 (file)
@@ -43,12 +43,6 @@ public class FinancialsCompanyEmployeeConverter implements Converter<Employee> {
         */
        private static CompanyEmployeeSessionBeanRemote COMPANY_EMPLOYEE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsCompanyEmployeeConverter () {
-       }
-
        @Override
        public Employee getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index a5e95756650efd9f831b978eca1a7f630902ef97..f61e8df8bd50cc846244b421ba6d01acd463d242 100644 (file)
@@ -43,12 +43,6 @@ public class FinancialsCompanyHeadquartersConverter implements Converter<Headqua
         */
        private static CompanyHeadquartersSessionBeanRemote COMPANY_HEADQUARTERS_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsCompanyHeadquartersConverter () {
-       }
-
        @Override
        public HeadquartersData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 01b36fcda4fcca88ab4289a49621bc0e116512bf..9e176743ab91aee6d8769706db6e28d1e6461f31 100644 (file)
@@ -43,12 +43,6 @@ public class FinancialsContactConverter implements Converter<Contact> {
         */
        private static ContactSessionBeanRemote CONTACT_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsContactConverter () {
-       }
-
        @Override
        public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 953527bf3ea7958b71a855ca639292e2d7e42355..af1eb5218ade066ccd5c189af78b322efb3a6171 100644 (file)
@@ -44,12 +44,6 @@ public class FinancialsCountryConverter implements Converter<Country> {
         */
        private static CountrySingletonBeanRemote COUNTRY_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsCountryConverter () {
-       }
-
        @Override
        public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 64da22316c89d18d09c44f2e91f8485e08d5e780..9d18d3149bd423f4552750e3bc49d9a4baecd765 100644 (file)
@@ -43,12 +43,6 @@ public class FinancialsFaxNumberConverter implements Converter<DialableFaxNumber
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsFaxNumberConverter () {
-       }
-
        @Override
        public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 13d0b2d7c84893fafffb064454b2b39799cc8992..8535c65514624e8a45d56083aeb0b0d847c90c81 100644 (file)
@@ -43,12 +43,6 @@ public class FinancialsLandLineNumberConverter implements Converter<DialableLand
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsLandLineNumberConverter () {
-       }
-
        @Override
        public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 6a398593dc0e489e9f79db75f12e4e948c8dc432..7b539938da4039afdb6909a8aecaa4564a51e411 100644 (file)
@@ -43,12 +43,6 @@ public class FinancialsMobileNumberConverter implements Converter<DialableMobile
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsMobileNumberConverter () {
-       }
-
        @Override
        public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index a86619c37c2b6b90f4c080cda4b069a9d01ecdd1..f8579d5d2521ebdb844fbd8e889f4d3d83ec854f 100644 (file)
@@ -18,11 +18,15 @@ package org.mxchange.jfinancials.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.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
 
@@ -37,17 +41,24 @@ public class FinancialsMobileProviderConverter implements Converter<MobileProvid
        /**
         * Mobile provider bean
         */
-       @EJB(lookup = "java:global/jfinancials-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
-       private MobileProviderSingletonBeanRemote mobileProviderBean;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsMobileProviderConverter () {
-       }
+       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 FinancialsMobileProviderConverter implements Converter<MobileProvid
                }
 
                // Get full list
-               List<MobileProvider> providerList = this.mobileProviderBean.allMobileProviders();
+               List<MobileProvider> providerList = this.MOBILE_PROVIDER_BEAN.allMobileProviders();
 
                // Init value
                MobileProvider provider = null;
index ac63fe6d78f23997a7fac1e8df5438b6f06a0c00..890056a4ea54a6a627e156f1ec22be82a38bb39d 100644 (file)
@@ -42,12 +42,6 @@ public class FinancialsUserConverter implements Converter<User> {
         */
        private static UserSessionBeanRemote USER_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsUserConverter () {
-       }
-
        @Override
        public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 14b69664524bee166028b6f16a9c5a7e8470354b..c6d9e87830928c9a701574312204285cf0b2c4e2 100644 (file)
@@ -36,12 +36,6 @@ public class FinancialsBirthdayValidator extends BaseDateValidator {
         */
        private static final long serialVersionUID = 28_735_756_819_460L;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsBirthdayValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // All accepted, required fields
index e9a0a2aeca6c0b7b23a761649b524c53eeab431f..59afe55821fafc2a7431debd146225633a51b655 100644 (file)
@@ -57,12 +57,6 @@ public class FinancialsEmailAddressValidator extends BaseStringValidator {
         */
        private static final long serialVersionUID = 187_536_745_607_192L;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsEmailAddressValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?
index 8e367ff16207f76d2e38a2f1644a4175bf2a70f4..3ceefbe1b35def2049cd789fb7804ac5aaab1c74 100644 (file)
@@ -49,12 +49,6 @@ public class FinancialsUrlValidator extends BaseStringValidator {
         */
        private static final long serialVersionUID = 187_536_745_607_193L;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsUrlValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // The required field
index da0ccdab10a16890d41d31764cf2f6aebf3e1528..94e5414e1a617ac59d1074ecf3d639fa30f51fce 100644 (file)
@@ -46,12 +46,6 @@ public class FinancialsUserIdValidator extends BaseNumberValidator {
         */
        private static final long serialVersionUID = 12_869_569_314_764_690L;
 
-       /**
-        * Default constructor
-        */
-       public FinancialsUserIdValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?