/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
import java.text.MessageFormat;
import java.util.Objects;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
/**
* Administrative user EJB
*/
- private final AdminUserSessionBeanRemote adminUserBean;
+ private AdminUserSessionBeanRemote adminUserBean;
/**
* Bean helper
/**
* General user EJB
*/
- private final UserSessionBeanRemote userBean;
+ private UserSessionBeanRemote userBean;
/**
* Regular user controller
* Default constructor
*/
public PizzaAdminUserWebRequestBean () {
- // Try it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Try to lookup
- this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
- this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
- } catch (final NamingException e) {
- // Throw again
- throw new FaceletException(e);
- }
+ // Call super constructor
+ super();
}
@Override
throw new IllegalArgumentException("userName is null"); //NOI18N
} else if (this.beanHelper.getContact() == null) {
// No contact instance set, so test required fields: gender, first name and family name
- if (this.contactController.getGender() == null) {
+ if (this.contactController.getPersonalTitle() == null) {
// Throw NPE again
throw new NullPointerException("contactController.gender is null"); //NOI18N
} else if (this.contactController.getFirstName() == null) {
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);
+ }
+ }
+
@Override
public String lockUserAccount (final User user) {
// Is the user instance valid and CONFIRMED?