* A list of all registered companies (globally)
*/
@Inject
- @NamedCache (cacheName = "basicDataCache", managementEnabled = true)
- private transient Cache<Long, BusinessBasicData> basicDataCache;
+ @NamedCache (cacheName = "basicDataCache")
+ private Cache<Long, BusinessBasicData> basicDataCache;
/**
* EJB for general basic business data purposes
* List of all company employees
*/
@Inject
- @NamedCache (cacheName = "companyEmployeeCache", managementEnabled = true)
- private transient Cache<Long, Employee> companyEmployeeCache;
+ @NamedCache (cacheName = "companyEmployeeCache")
+ private Cache<Long, Employee> companyEmployeeCache;
/**
* Default constructor
* Contact list
*/
@Inject
- @NamedCache (cacheName = "contactsCache", managementEnabled = true)
- private transient Cache<Long, Contact> contactsCache;
+ @NamedCache (cacheName = "contactsCache")
+ private Cache<Long, Contact> contactsCache;
/**
* Country instance
* Email address list
*/
@Inject
- @NamedCache (cacheName = "emailAddressCache", managementEnabled = true)
- private transient Cache<Long, String> emailAddressCache;
+ @NamedCache (cacheName = "emailAddressCache")
+ private Cache<Long, String> emailAddressCache;
/**
* Email address repeated
* relationship (one contact, many numbers).
*/
@Inject
- @NamedCache (cacheName = "contactsPhoneCache", managementEnabled = true)
- private transient Cache<DialableNumber, List<Contact>> contactsPhoneCache;
+ @NamedCache (cacheName = "contactsPhoneCache")
+ private Cache<DialableNumber, List<Contact>> contactsPhoneCache;
/**
* fax number
* List of all countries
*/
@Inject
- @NamedCache (cacheName = "countryCache", managementEnabled = true)
- private transient Cache<Long, Country> countryCache;
+ @NamedCache (cacheName = "countryCache")
+ private Cache<Long, Country> countryCache;
/**
* Default constructor
import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController;
import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController;
import org.mxchange.jfinancials.beans.user.FinancialsAdminUserWebRequestController;
+import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController;
import org.mxchange.jphone.events.fax.created.CreatedFaxNumberEvent;
import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
import org.mxchange.jphone.events.landline.created.CreatedLandLineNumberEvent;
import org.mxchange.jusercore.events.user.created.CreatedUserEvent;
import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController;
/**
* A general helper for beans
* "Cached" list of mobile providers
*/
@Inject
- @NamedCache (cacheName = "mobileProviderCache", managementEnabled = true)
- private transient Cache<Long, MobileProvider> mobileProviderCache;
+ @NamedCache (cacheName = "mobileProviderCache")
+ private Cache<Long, MobileProvider> mobileProviderCache;
/**
* Default constructor
* All fax numbers
*/
@Inject
- @NamedCache (cacheName = "faxNumberCache", managementEnabled = true)
- private transient Cache<Long, DialableFaxNumber> faxNumberCache;
+ @NamedCache (cacheName = "faxNumberCache")
+ private Cache<Long, DialableFaxNumber> faxNumberCache;
/**
* All land-line numbers
*/
@Inject
- @NamedCache (cacheName = "landLineNumberCache", managementEnabled = true)
- private transient Cache<Long, DialableLandLineNumber> landLineNumberCache;
+ @NamedCache (cacheName = "landLineNumberCache")
+ private Cache<Long, DialableLandLineNumber> landLineNumberCache;
/**
* All mobile numbers
*/
@Inject
- @NamedCache (cacheName = "mobileNumberCache", managementEnabled = true)
- private transient Cache<Long, DialableMobileNumber> mobileNumberCache;
+ @NamedCache (cacheName = "mobileNumberCache")
+ private Cache<Long, DialableMobileNumber> mobileNumberCache;
/**
* General EJB for phone numbers
* A list of all user profiles
*/
@Inject
- @NamedCache (cacheName = "userCache", managementEnabled = true)
- private transient Cache<Long, User> userCache;
+ @NamedCache (cacheName = "userCache")
+ private Cache<Long, User> userCache;
/**
* User id
* User name list
*/
@Inject
- @NamedCache (cacheName = "userNameCache", managementEnabled = true)
- private transient Cache<Long, String> userNameCache;
+ @NamedCache (cacheName = "userNameCache")
+ private Cache<Long, String> userNameCache;
/**
* User password (clear-text from web form)
* "Cache" for activity log per user
*/
@Inject
- @NamedCache (cacheName = "userActivityCache", managementEnabled = true)
- private transient Cache<User, List<LogableUserActivity>> userActivityCache;
+ @NamedCache (cacheName = "userActivityCache")
+ private Cache<User, List<LogableUserActivity>> userActivityCache;
/**
* Default constructor
* Local list of already queued email addresses
*/
@Inject
- @NamedCache (cacheName = "queuedEmailCache", managementEnabled = true)
- private transient Cache<String, Boolean> queuedEmailCache;
+ @NamedCache (cacheName = "queuedEmailCache")
+ private Cache<String, Boolean> queuedEmailCache;
/**
* Login controller (bean)
*/
package org.mxchange.jfinancials.converter.business.basicdata;
-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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote;
import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataNotFoundException;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "BusinessContactConverter", managed = true)
+@FacesConverter (value = "BusinessContactConverter")
public class FinancialsBusinessContactConverter implements Converter<BusinessBasicData> {
/**
* Business contact EJB
*/
- @EJB (lookup = "java:global/jfinancials-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote")
- private BusinessDataSessionBeanRemote basicDataBean;
+ private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN;
/**
* Default constructor
@Override
public BusinessBasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (BASIC_DATA_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(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
Long contactId = Long.valueOf(submittedValue);
// Try to get user instance from it
- businessContact = this.basicDataBean.findBasicDataById(contactId);
+ businessContact = BASIC_DATA_BEAN.findBasicDataById(contactId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jfinancials.converter.business.company_employee;
-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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote;
import org.mxchange.jcontactsbusiness.employee.Employee;
import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoundException;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "CompanyEmployeeConverter", managed = true)
+@FacesConverter (value = "CompanyEmployeeConverter")
public class FinancialsCompanyEmployeeConverter implements Converter<Employee> {
/**
* CompanyEmployee EJB
*/
- @EJB (lookup = "java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote")
- private CompanyEmployeeSessionBeanRemote companyEmployeeBean;
+ private static CompanyEmployeeSessionBeanRemote COMPANY_EMPLOYEE_BEAN;
/**
* Default constructor
@Override
public Employee getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (COMPANY_EMPLOYEE_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ COMPANY_EMPLOYEE_BEAN = (CompanyEmployeeSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(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
Long employeeId = Long.valueOf(submittedValue);
// Try to get user instance from it
- companyEmployee = this.companyEmployeeBean.findCompanyEmployeeById(employeeId);
+ companyEmployee = COMPANY_EMPLOYEE_BEAN.findCompanyEmployeeById(employeeId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jfinancials.converter.business.headquarters;
-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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcontactsbusiness.exceptions.headquarters.CompanyHeadquartersNotFoundException;
import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersSessionBeanRemote;
import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "CompanyHeadquartersConverter", managed = true)
+@FacesConverter (value = "CompanyHeadquartersConverter")
public class FinancialsCompanyHeadquartersConverter implements Converter<HeadquartersData> {
/**
* CompanyEmployee EJB
*/
- @EJB (lookup = "java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersSessionBeanRemote")
- private CompanyHeadquartersSessionBeanRemote companyHeadquartersBean;
+ private static CompanyHeadquartersSessionBeanRemote COMPANY_HEADQUARTERS_BEAN;
/**
* Default constructor
@Override
public HeadquartersData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (COMPANY_HEADQUARTERS_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ COMPANY_HEADQUARTERS_BEAN = (CompanyHeadquartersSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(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
Long headquartersId = Long.valueOf(submittedValue);
// Try to get user instance from it
- companyHeadquarters = this.companyHeadquartersBean.findCompanyHeadquartersById(headquartersId);
+ companyHeadquarters = COMPANY_HEADQUARTERS_BEAN.findCompanyHeadquartersById(headquartersId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jfinancials.converter.contact;
-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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "ContactConverter", managed = true)
+@FacesConverter (value = "ContactConverter")
public class FinancialsContactConverter implements Converter<Contact> {
/**
* Contact EJB
*/
- @EJB (lookup = "java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote")
- private ContactSessionBeanRemote contactBean;
+ private static ContactSessionBeanRemote CONTACT_BEAN;
/**
* Default constructor
@Override
public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (CONTACT_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ CONTACT_BEAN = (ContactSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(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
Long contactId = Long.valueOf(submittedValue);
// Try to get user instance from it
- contact = this.contactBean.findContactById(contactId);
+ contact = this.CONTACT_BEAN.findContactById(contactId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "CountryConverter", managed = true)
+@FacesConverter (value = "CountryConverter")
public class FinancialsCountryConverter implements Converter<Country> {
/**
* Country bean
*/
- @EJB (lookup = "java:global/jfinancials-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote")
- private CountrySingletonBeanRemote countryBean;
+ private static CountrySingletonBeanRemote COUNTRY_BEAN;
/**
* Default constructor
@Override
public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (COUNTRY_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ COUNTRY_BEAN = (CountrySingletonBeanRemote) initial.lookup("java:global/jfinancials-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(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<Country> countryList = this.countryBean.allCountries();
+ List<Country> countryList = COUNTRY_BEAN.allCountries();
// Init value
Country country = null;
*/
package org.mxchange.jfinancials.converter.fax;
-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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "FaxNumberConverter", managed = true)
+@FacesConverter (value = "FaxNumberConverter")
public class FinancialsFaxNumberConverter implements Converter<DialableFaxNumber> {
/**
* Phone EJB
*/
- @EJB(lookup = "java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote")
- private PhoneSessionBeanRemote phoneBean;
+ private static PhoneSessionBeanRemote PHONE_BEAN;
/**
* Default constructor
@Override
public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (PHONE_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ }
+ }
+
// Log message
// @TODO Not possible here: this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: context={1},component={2},submittedValue={3} - CALLED!", this.getClass().getSimpleName(), context, component, submittedValue)); //NOI18N
// Log message
// @TODO Not possible here: this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject: faxNumberId={1}", this.getClass().getSimpleName(), faxNumberId)); //NOI18N
// Try to get mobile instance from it
- faxNumber = this.phoneBean.findFaxNumberById(faxNumberId);
+ faxNumber = PHONE_BEAN.findFaxNumberById(faxNumberId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jfinancials.converter.landline;
-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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "LandLineNumberConverter", managed = true)
+@FacesConverter (value = "LandLineNumberConverter")
public class FinancialsLandLineNumberConverter implements Converter<DialableLandLineNumber> {
/**
* Phone EJB
*/
- @EJB(lookup = "java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote")
- private PhoneSessionBeanRemote phoneBean;
+ private static PhoneSessionBeanRemote PHONE_BEAN;
/**
* Default constructor
@Override
public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (PHONE_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(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
Long landLineNumberId = Long.valueOf(submittedValue);
// Try to get mobile instance from it
- landLineNumber = this.phoneBean.findLandLineNumberById(landLineNumberId);
+ landLineNumber = PHONE_BEAN.findLandLineNumberById(landLineNumberId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jfinancials.converter.mobile;
-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.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "MobileNumberConverter", managed = true)
+@FacesConverter (value = "MobileNumberConverter")
public class FinancialsMobileNumberConverter implements Converter<DialableMobileNumber> {
/**
* Phone EJB
*/
- @EJB (lookup = "java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote")
- private PhoneSessionBeanRemote phoneBean;
+ private static PhoneSessionBeanRemote PHONE_BEAN;
/**
* Default constructor
@Override
public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (PHONE_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(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
Long mobileId = Long.valueOf(submittedValue);
// Try to get mobile instance from it
- mobile = this.phoneBean.findMobileNumberById(mobileId);
+ mobile = PHONE_BEAN.findMobileNumberById(mobileId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
*/
package org.mxchange.jfinancials.converter.user;
-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.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesConverter (value = "UserConverter", managed = true)
+@FacesConverter (value = "UserConverter")
public class FinancialsUserConverter implements Converter<User> {
/**
* User EJB
*/
- @EJB(lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
- private UserSessionBeanRemote userBean;
+ private static UserSessionBeanRemote USER_BEAN;
/**
* Default constructor
@Override
public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+ // Is the instance there?
+ if (USER_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ USER_BEAN = (UserSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote");
+ } 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
Long userId = Long.valueOf(submittedValue);
// Try to get user instance from it
- user = this.userBean.findUserById(userId);
+ user = USER_BEAN.findUserById(userId);
} catch (final NumberFormatException ex) {
// Throw again
throw new ConverterException(ex);
package org.mxchange.jfinancials.validator.business.basicdata;
import java.text.MessageFormat;
-import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote;
import org.mxchange.jcoreee.validator.string.BaseStringValidator;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesValidator (value = "CompanyNameValidator", managed = true)
+@FacesValidator (value = "CompanyNameValidator")
public class FinancialsCompanyNameValidator extends BaseStringValidator {
/**
- * Serial number
+ * Business contact EJB
*/
- private static final long serialVersionUID = 57_283_657_476_561L;
+ private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN;
/**
- * Business contact EJB
+ * Serial number
*/
- @EJB (lookup = "java:global/jfinancials-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote")
- private BusinessDataSessionBeanRemote basicDataBean;
+ private static final long serialVersionUID = 57_283_657_476_561L;
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+ // Is the instance there?
+ if (BASIC_DATA_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ }
+ }
+
// All accepted, required fields
String[] requiredFields = {"companyName"}; //NOI18N
}
// Check if name is already used
- Boolean nameExists = this.basicDataBean.isCompanyNameUsed(companyName);
+ Boolean nameExists = BASIC_DATA_BEAN.isCompanyNameUsed(companyName);
// Is the user id valid?
if ((!nameExists) && (checkExisting)) {
import java.text.MessageFormat;
import java.util.regex.Pattern;
-import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
import org.mxchange.jcoreee.validator.string.BaseStringValidator;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesValidator (value = "EmailAddressValidator", managed = true)
+@FacesValidator (value = "EmailAddressValidator")
public class FinancialsEmailAddressValidator extends BaseStringValidator {
/**
* Contact session-scoped bean
*/
- @EJB (lookup = "java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote")
- private ContactSessionBeanRemote contactBean;
+ private static ContactSessionBeanRemote CONTACT_BEAN;
/**
* Email pattern
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+ // Is the instance there?
+ if (CONTACT_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ CONTACT_BEAN = (ContactSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ }
+ }
+
System.out.println(this.getClass().getSimpleName() + ".validate(): component.clientId=" + component.getClientId());
// The required field
String[] requiredFields = {"emailAddress", "emailAddressRepeat", "resendEmailAddress"}; //NOI18N
String clientId = component.getClientId();
// Is it registered?
- Boolean isRegistered = this.contactBean.isEmailAddressRegistered(emailAddress);
+ Boolean isRegistered = CONTACT_BEAN.isEmailAddressRegistered(emailAddress);
// Is the email address already registered?
if ((!clientId.endsWith("resendEmailAddress")) && (isRegistered)) { //NOI18N
package org.mxchange.jfinancials.validator.user;
import java.text.MessageFormat;
-import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.mxchange.jcoreee.validator.number.BaseNumberValidator;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@FacesValidator (value = "UserIdValidator", managed = true)
+@FacesValidator (value = "UserIdValidator")
public class FinancialsUserIdValidator extends BaseNumberValidator {
/**
- * Serial number
+ * Remote bean
*/
- private static final long serialVersionUID = 12_869_569_314_764_690L;
+ private static UserSessionBeanRemote USER_BEAN;
/**
- * Remote bean
+ * Serial number
*/
- @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
- private UserSessionBeanRemote userBean;
+ private static final long serialVersionUID = 12_869_569_314_764_690L;
/**
* Default constructor
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+ // Is the instance there?
+ if (USER_BEAN == null) {
+ try {
+ // Not yet, attempt lookup
+ Context initial = new InitialContext();
+
+ // Lookup EJB
+ USER_BEAN = (UserSessionBeanRemote) initial.lookup("java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote");
+ } catch (final NamingException ex) {
+ // Throw it again
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+ }
+ }
+
// All accepted, required fields
String[] requiredFields = {"userId"}; //NOI18N
Long userId = (Long) value;
// Define variable
- Boolean ifUserExists = this.userBean.ifUserIdExists(userId);
+ Boolean ifUserExists = USER_BEAN.ifUserIdExists(userId);
// Is the user id valid?
if (!ifUserExists) {