import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;
+import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
throw new IllegalArgumentException("event.basicData.companyName is empty");
}
- // Initialize list
- this.initializeList();
-
// Add it to list
this.businessContacts.add(event.getBasicData());
}
*/
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
public List<BusinessBasicData> allCompanyBasicData () {
- // Initialize list
- this.initializeList();
-
// Return it
return this.businessContacts;
}
/**
* Initializer method
*/
- private void initializeList () {
- // Is the list empty?
- if (this.businessContacts.isEmpty()) {
- // Init user's contact list
- this.businessContacts.addAll(this.adminBusinessDataBean.allCompanyBasicData());
- }
+ @PostConstruct
+ public void initializeList () {
+ // Init user's contact list
+ this.businessContacts.addAll(this.adminBusinessDataBean.allCompanyBasicData());
}
}
import java.util.LinkedList;
import java.util.List;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
-import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
-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.pizzaapplication.beans.BasePizzaController;
/**
* EJB for general company employee purposes
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/companyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote")
private CompanyEmployeeSessionBeanRemote companyEmployeeBean;
/**
*/
@PostConstruct
public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.companyEmployeeBean = (CompanyEmployeeSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/companyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Get all entries from remote bean
List<Employee> employees = this.companyEmployeeBean.allCompanyEmployees();
import java.util.List;
import java.util.Objects;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
-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.contact.ContactUtils;
/**
* EJB for general contact purposes
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote")
private ContactSessionBeanRemote contactBean;
/**
*/
@PostConstruct
public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Get full email address list for reducing EJB calls
this.emailAddressList.addAll(this.contactBean.getEmailAddressList());
import java.text.MessageFormat;
import java.util.List;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
-import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
/**
* Remote country EJB
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote")
private CountrySingletonBeanRemote countryBean;
/**
*/
@PostConstruct
public void init () {
- // Try this
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the bean
- this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/pizzaservice-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //NOI18N
- } catch (final NamingException ex) {
- // Continue to throw
- throw new FaceletException(ex);
- }
-
// "Cache" country list as this will not change so often.
this.countryList = this.countryBean.allCountries();
}
import java.text.MessageFormat;
import java.util.List;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
-import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
/**
* Remote EJB for mobile providers (regular)
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
private MobileProviderSingletonBeanRemote mobileRemoteBean;
/**
*/
@PostConstruct
public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the beans
- this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/pizzaservice-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw it again
- throw new FaceletException(e);
- }
-
// Init list of mobile providers
this.mobileProviders = this.mobileRemoteBean.allMobileProvider();
}
import java.util.List;
import java.util.Objects;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
-import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
/**
* General EJB for phone numbers
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote")
private PhoneSessionBeanRemote phoneBean;
/**
*/
@PostConstruct
public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup the beans
- this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw it again
- throw new FaceletException(e);
- }
-
// All phone numbers
this.allMobileNumbers().addAll(this.phoneBean.allMobileNumbers());
this.allFaxNumbers().addAll(this.phoneBean.allFaxNumbers());
import java.text.MessageFormat;
import java.util.Locale;
import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcoreee.utils.FacesUtils;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
/**
* Administrative user EJB
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote")
private AdminUserSessionBeanRemote adminUserBean;
/**
/**
* General user EJB
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
private UserSessionBeanRemote userBean;
/**
* @return Redirect outcome
*/
public String addUser () {
- System.out.println("addUser: this.contact="+this.getContact());
+ System.out.println("addUser: this.contact=" + this.getContact());
// As the form cannot validate the data (required="true"), check it here
if (this.getUserName() == null) {
// Throw NPE
this.userPasswordRepeat = userPasswordRepeat;
}
- /**
- * Post-construction method
- */
- @PostConstruct
- public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
- this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
- }
-
/**
* Locks selected user's account. This method makes sure that a lock reason
* is provided that th user later can read on login attempts.
import java.util.Locale;
import java.util.Objects;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcoreee.events.locale.ObservableLocaleChangeEvent;
import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
/**
* Remote user bean
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
private UserSessionBeanRemote userBean;
/**
*/
@PostConstruct
public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Initialize user list
this.userList = this.userBean.allUsers();
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
-import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
/**
* EJB for user activity log
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/userActivity!org.mxchange.jusercore.model.user.activity.UserActivityLogSessionBeanRemote")
private UserActivityLogSessionBeanRemote userActivityBean;
/**
*/
@PostConstruct
public void init () {
- // Try to get EJB instance
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userActivityBean = (UserActivityLogSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/userActivity!org.mxchange.jusercore.model.user.activity.UserActivityLogSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Get whole list
List<LogableUserActivity> list = this.userActivityBean.fetchAllUserActivityLog();
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jcoreee.events.helper.clear.HelperCleanupEvent;
import org.mxchange.jcoreee.events.helper.clear.ObservableHelperCleanupEvent;
import org.mxchange.jcoreee.utils.FacesUtils;
/**
* Remote user bean
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
private UserSessionBeanRemote userBean;
/**
this.confirmationKey = confirmationKey;
}
- /**
- * Post-construction method
- */
- @PostConstruct
- public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
- }
-
@Override
public void maybeConfirmUserAccount () {
// Trace message
import java.util.List;
import java.util.Objects;
import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcoreee.utils.FacesUtils;
import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
/**
* Remote email change bean
*/
+ @EJB (lookup = "java:global/pizzaservice-ejb/userEmailChange!org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote")
private UserEmailChangeSessionBeanRemote emailChangeBean;
/**
*/
@PostConstruct
public void init () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.emailChangeBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
-
// Init list
this.emailAddresses = this.emailChangeBean.allQueuedAddresses();
}