]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java
Continued with customer:
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / customer / PizzaAdminCustomerWebRequestBean.java
index d530b3e4827db05cf352a5d0bafa33521fa8b163..a8bc117cdf417e4cd66b6184b23b5ef88b5ae874 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.pizzaapplication.beans.customer;
 
+import java.text.MessageFormat;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
@@ -153,6 +154,32 @@ public class PizzaAdminCustomerWebRequestBean implements PizzaAdminCustomerWebRe
                return "admin_list_customer"; //NOI18N
        }
 
+       @Override
+       public void copyCustomerToController (final Customer customer) {
+               // Parameters must be valid
+               if (null == customer) {
+                       // Throw NPE
+                       throw new NullPointerException("customer is null");
+               } else if (customer.getCustomerId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("customer.customerId is null");
+               } else if (customer.getCustomerId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("customer.customerId={0} is not valid", customer.getCustomerId()));
+               } else if (customer.getCustomerContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("customer.customerContact is null");
+               } else if (customer.getCustomerContact().getContactId() == null) {
+                       // .. and again
+                       throw new NullPointerException("customer.customerContact.contactId is null");
+               } else if (customer.getCustomerContact().getContactId() < 1) {
+                       // Invalid id
+                       throw new IllegalArgumentException(MessageFormat.format("customer.customerContact.contactId={0} is not valid", customer.getCustomerContact().getContactId()));
+               }
+
+               // @TODO Set all data
+       }
+
        /**
         * Post-initialization of this class
         */