From feea5c403287584863aa7bcae6c5e0e4a7b868c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 3 Sep 2017 17:50:06 +0200 Subject: [PATCH] Please cherry-pick: - removed not needed constructor from converter/validator - reverted `@EJB` annotation in mobile-provider converter as it was not working MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../contact/PizzaContactConverter.java | 6 ---- .../mobile/PizzaMobileNumberConverter.java | 6 ---- .../PizzaMobileProviderConverter.java | 31 +++++++++++++------ .../birthday/PizzaBirthdayValidator.java | 6 ---- .../validator/url/PizzaUrlValidator.java | 6 ---- .../validator/user/PizzaUserIdValidator.java | 6 ---- 6 files changed, 21 insertions(+), 40 deletions(-) diff --git a/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java b/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java index 2cfd87ab..2db3f4cc 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java @@ -43,12 +43,6 @@ public class PizzaContactConverter implements Converter { */ private static ContactSessionBeanRemote CONTACT_BEAN; - /** - * Default constructor - */ - public PizzaContactConverter () { - } - @Override public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the instance there? diff --git a/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java b/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java index 9973054f..aeb56be2 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java @@ -43,12 +43,6 @@ public class PizzaMobileNumberConverter implements Converter { /** * Mobile provider bean */ - @EJB(lookup = "java:global/jfinancials-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote") - private MobileProviderSingletonBeanRemote mobileProviderBean; - - /** - * Default constructor - */ - public PizzaMobileProviderConverter () { - } + 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 PizzaMobileProviderConverter implements Converter { } // Get full list - List providerList = this.mobileProviderBean.allMobileProviders(); + List providerList = this.MOBILE_PROVIDER_BEAN.allMobileProviders(); // Init value MobileProvider provider = null; diff --git a/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java b/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java index 5dbc3fd1..a730a0d8 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java @@ -36,12 +36,6 @@ public class PizzaBirthdayValidator extends BaseDateValidator { */ private static final long serialVersionUID = 28_735_756_819_460L; - /** - * Default constructor - */ - public PizzaBirthdayValidator () { - } - @Override public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { // All accepted, required fields diff --git a/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java b/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java index 101fd758..579d9c08 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java @@ -49,12 +49,6 @@ public class PizzaUrlValidator extends BaseStringValidator { */ private static final long serialVersionUID = 187_536_745_607_193L; - /** - * Default constructor - */ - public PizzaUrlValidator () { - } - @Override public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { // The required field diff --git a/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java b/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java index abde9cee..bb8dda7e 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java @@ -46,12 +46,6 @@ public class PizzaUserIdValidator extends BaseNumberValidator { */ private static final long serialVersionUID = 12_869_569_314_764_690L; - /** - * Default constructor - */ - public PizzaUserIdValidator () { - } - @Override public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { // Is the instance there? -- 2.39.5