From: Roland Häder Date: Wed, 27 Apr 2016 09:37:44 +0000 (+0200) Subject: added admin helper usage (needed for overworked customer form) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f48e18ad9b21440ef146a0686575bc417f42e3a2;p=pizzaservice-war.git added admin helper usage (needed for overworked customer form) Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java index 7c9bbd62..4bdd3fbe 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java @@ -35,6 +35,7 @@ import org.mxchange.jcustomercore.exceptions.CustomerAlreadyRegisteredException; import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jcustomercore.model.customer.status.CustomerAccountStatus; import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController; +import org.mxchange.pizzaapplication.beans.helper.PizzaAdminWebRequestController; import org.mxchange.pizzaapplication.model.customer.PizzaAdminCustomerSessionBeanRemote; /** @@ -62,6 +63,12 @@ public class PizzaAdminCustomerWebRequestBean implements PizzaAdminCustomerWebRe */ private PizzaAdminCustomerSessionBeanRemote adminCustomerBean; + /** + * Admin helper instance + */ + @Inject + private PizzaAdminWebRequestController adminHelper; + /** * An event being fired when an administrator has added a new customer */ @@ -95,13 +102,22 @@ public class PizzaAdminCustomerWebRequestBean implements PizzaAdminCustomerWebRe @Override public String addCustomer () { // Are at least some fields added? - if (!this.isCustomerDataSet()) { + if ((this.adminHelper.getContact() == null) && (!this.isCustomerDataSet())) { // Not all customer data is set throw new FaceletException("Please provide minimum personal data: gender, first_name, family_name"); //NOI18N } - // Get contact instance - Contact contact = this.adminContactController.createContactInstance(); + // Init contact + Contact contact; + + // Is the contact set in helper? + if (this.adminHelper.getContact() instanceof Contact) { + // Get from helper + contact = this.adminHelper.getContact(); + } else { + // Get new contact instance + contact = this.adminContactController.createContactInstance(); + } // Ask the EJB for a free customer number String customerNumber = this.adminCustomerBean.createCustomerNumber();