]> git.mxchange.org Git - jjobs-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 16:49:44 +0000 (18:49 +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/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java
src/java/org/mxchange/jjobs/converter/business/company_employee/JobsCompanyEmployeeConverter.java
src/java/org/mxchange/jjobs/converter/business/headquarters/JobsCompanyHeadquartersConverter.java
src/java/org/mxchange/jjobs/converter/contact/JobsContactConverter.java
src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java
src/java/org/mxchange/jjobs/converter/fax/JobsFaxNumberConverter.java
src/java/org/mxchange/jjobs/converter/landline/JobsLandLineNumberConverter.java
src/java/org/mxchange/jjobs/converter/mobile/JobsMobileNumberConverter.java
src/java/org/mxchange/jjobs/converter/mobileprovider/JobsMobileProviderConverter.java
src/java/org/mxchange/jjobs/converter/user/JobsUserConverter.java
src/java/org/mxchange/jjobs/validator/birthday/JobsBirthdayValidator.java
src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java
src/java/org/mxchange/jjobs/validator/url/JobsUrlValidator.java
src/java/org/mxchange/jjobs/validator/user/JobsUserIdValidator.java

index 441c73cec5bca0a05acc4091d55ccb479b532358..9cbf1eb7020571f285d1e306d50fdfd1aef244a2 100644 (file)
@@ -43,12 +43,6 @@ public class JobsBusinessContactConverter implements Converter<BusinessBasicData
         */
        private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsBusinessContactConverter () {
-       }
-
        @Override
        public BusinessBasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index a99aad2cdfcc58cf9436ede2a000e12784c177ee..0dba0f04dbad1f9ec2e292b312c96a4e97a1e9ec 100644 (file)
@@ -43,12 +43,6 @@ public class JobsCompanyEmployeeConverter implements Converter<Employee> {
         */
        private static CompanyEmployeeSessionBeanRemote COMPANY_EMPLOYEE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsCompanyEmployeeConverter () {
-       }
-
        @Override
        public Employee getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 4f3b82e999aff165ab7309cec08a5cb90f4b27d9..64e770ebac4a5b303b1881ad27a0b10a2c968d37 100644 (file)
@@ -43,12 +43,6 @@ public class JobsCompanyHeadquartersConverter implements Converter<HeadquartersD
         */
        private static CompanyHeadquartersSessionBeanRemote COMPANY_HEADQUARTERS_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsCompanyHeadquartersConverter () {
-       }
-
        @Override
        public HeadquartersData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 8f26ade9c3c07fca2e5184cc4ab9ba089d1991b2..446a5a2eb8ae53d6abc8d486b32b53014653536a 100644 (file)
@@ -43,12 +43,6 @@ public class JobsContactConverter implements Converter<Contact> {
         */
        private static ContactSessionBeanRemote CONTACT_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsContactConverter () {
-       }
-
        @Override
        public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 69e3a8c4bf781ec0c1f32d92f6b9f0d4bc3555e5..0ab11920e551c838799c3a7b4304cf8fcbbe09ca 100644 (file)
@@ -44,12 +44,6 @@ public class JobsCountryConverter implements Converter<Country> {
         */
        private static CountrySingletonBeanRemote COUNTRY_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsCountryConverter () {
-       }
-
        @Override
        public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index a469d940ccc4e73ce319cf7dd9d514e01d956aaf..ebfaeeb650d2c26169b0db639e23271e42a32633 100644 (file)
@@ -43,12 +43,6 @@ public class JobsFaxNumberConverter implements Converter<DialableFaxNumber> {
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsFaxNumberConverter () {
-       }
-
        @Override
        public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 398c117eeff8392c9d9cea32e498617a4277671f..ec321022201751e2911dacf0dd227581e6dd6a7a 100644 (file)
@@ -43,12 +43,6 @@ public class JobsLandLineNumberConverter implements Converter<DialableLandLineNu
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsLandLineNumberConverter () {
-       }
-
        @Override
        public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index 8f75fb7e0833547815d8a7aab2c08a2605329eae..0bcec1275c4c5dd96f95433e9e6d92a2f15c922c 100644 (file)
@@ -43,12 +43,6 @@ public class JobsMobileNumberConverter implements Converter<DialableMobileNumber
         */
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsMobileNumberConverter () {
-       }
-
        @Override
        public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index c1bb742f41b0686d0a31ec9057495136091dbcda..e16422334c5d5b15262583f2ba2bef2dd8018cee 100644 (file)
@@ -18,11 +18,15 @@ package org.mxchange.jjobs.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 JobsMobileProviderConverter implements Converter<MobileProvider> {
        /**
         * Mobile provider bean
         */
-       @EJB(lookup = "java:global/jjobs-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
-       private MobileProviderSingletonBeanRemote mobileProviderBean;
-
-       /**
-        * Default constructor
-        */
-       public JobsMobileProviderConverter () {
-       }
+       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 JobsMobileProviderConverter implements Converter<MobileProvider> {
                }
 
                // Get full list
-               List<MobileProvider> providerList = this.mobileProviderBean.allMobileProviders();
+               List<MobileProvider> providerList = this.MOBILE_PROVIDER_BEAN.allMobileProviders();
 
                // Init value
                MobileProvider provider = null;
index ed606e483f1f110f0a69826d1ceaf692a131865f..49226c81f3d68eb3bc8656041ed6aeb25925a5ca 100644 (file)
@@ -42,12 +42,6 @@ public class JobsUserConverter implements Converter<User> {
         */
        private static UserSessionBeanRemote USER_BEAN;
 
-       /**
-        * Default constructor
-        */
-       public JobsUserConverter () {
-       }
-
        @Override
        public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
index f30e8beba1e5916bb27d1e695f462c9fdd0c43ec..14d7603f939d932ab255e3931c196b7152161ee0 100644 (file)
@@ -36,12 +36,6 @@ public class JobsBirthdayValidator extends BaseDateValidator {
         */
        private static final long serialVersionUID = 28_735_756_819_460L;
 
-       /**
-        * Default constructor
-        */
-       public JobsBirthdayValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // All accepted, required fields
index 0c99d953b620d44c7e21911b59222bcc458ebb12..1b015cccdceedd76e7c0e27cd5302fd2ad95c199 100644 (file)
@@ -57,12 +57,6 @@ public class JobsEmailAddressValidator extends BaseStringValidator {
         */
        private static final long serialVersionUID = 187_536_745_607_192L;
 
-       /**
-        * Default constructor
-        */
-       public JobsEmailAddressValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?
index e2be843554f9ae6f0990297cb5d50d016af2d8b3..9afaf9dec812962783a01a638ceb813670ecd158 100644 (file)
@@ -49,12 +49,6 @@ public class JobsUrlValidator extends BaseStringValidator {
         */
        private static final long serialVersionUID = 187_536_745_607_193L;
 
-       /**
-        * Default constructor
-        */
-       public JobsUrlValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // The required field
index 4c6b0420a6d49c34e9e73538c2369013a42f0826..d005666ff8ad46f14245a1b5a20a346b83a09288 100644 (file)
@@ -46,12 +46,6 @@ public class JobsUserIdValidator extends BaseNumberValidator {
         */
        private static final long serialVersionUID = 12_869_569_314_764_690L;
 
-       /**
-        * Default constructor
-        */
-       public JobsUserIdValidator () {
-       }
-
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?