/*
- * 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
* @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