]> git.mxchange.org Git - jcustomer-core.git/blobdiff - src/org/mxchange/jcustomercore/events/customer/update/AdminUpdatedCustomerDataEvent.java
Updated copyright year
[jcustomer-core.git] / src / org / mxchange / jcustomercore / events / customer / update / AdminUpdatedCustomerDataEvent.java
index 923943625fff142087d99bc55ea3a910774fa896..190b7992956e36b6d0dcae844c9370db539a6ce5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016, 2017 Roland Häder
+ * Copyright (C) 2016 - 2024 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -42,16 +42,31 @@ public class AdminUpdatedCustomerDataEvent implements ObservableAdminUpdatedCust
         * @param updatedCustomer Updated customer instance
         */
        public AdminUpdatedCustomerDataEvent (final Customer updatedCustomer) {
-               // Is the customer instance valid?
+               // The instance should be valid
                if (null == updatedCustomer) {
                        // Throw NPE
                        throw new NullPointerException("updatedCustomer is null"); //NOI18N
                } else if (updatedCustomer.getCustomerId() == null) {
-                       // Throw NPE again
+                       // Throw NPE, again ...
                        throw new NullPointerException("updatedCustomer.customerId is null"); //NOI18N
                } else if (updatedCustomer.getCustomerId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("updatedCustomer.customerId={0} is invalid.", updatedCustomer.getCustomerId())); //NOI18N
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("updatedCustomer.customerId={0} is not valid", updatedCustomer.getCustomerId())); //NOI18N
+               } else if (updatedCustomer.getCustomerNumber() == null) {
+                       // Throw NPE, again ...
+                       throw new NullPointerException("updatedCustomer.customerNumber is null"); //NOI18N
+               } else if (updatedCustomer.getCustomerNumber() == null) {
+                       // Empty customer number
+                       throw new IllegalArgumentException("updatedCustomer.customerNumber is empty"); //NOI18N
+               } else if (updatedCustomer.getCustomerContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("updatedCustomer.customerContact is null"); //NOI18N
+               } else if (updatedCustomer.getCustomerContact().getContactId() == null) {
+                       // ... and again ...
+                       throw new NullPointerException("updatedCustomer.customerContact.contactId is null"); //NOI18N
+               } else if (updatedCustomer.getCustomerContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("updatedCustomer.customerContact.contactId={0} is not valid", updatedCustomer.getCustomerContact().getContactId())); //NOI18N
                }
 
                // Set it here