*/
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?
*/
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?
*/
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?
*/
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?
*/
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?
*/
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?
*/
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?
*/
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?
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;
/**
* 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
}
// Get full list
- List<MobileProvider> providerList = this.mobileProviderBean.allMobileProviders();
+ List<MobileProvider> providerList = this.MOBILE_PROVIDER_BEAN.allMobileProviders();
// Init value
MobileProvider provider = null;
*/
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?
*/
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
*/
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?
*/
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
*/
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?