]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 13 Dec 2018 16:03:47 +0000 (17:03 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 13 Dec 2018 16:03:47 +0000 (17:03 +0100)
- if all 3 employee's relations are NULL, throw an NPE: branch office, personal
  data and headquarter
- basic company data is always required

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/employee/Employees.java

index 177da4fd32a07342b8a46c2efd4a58743aae41e4..c0373941d767cf7ef76a853bc0a63e487332f716 100644 (file)
@@ -101,9 +101,9 @@ public class Employees implements Serializable {
                } else if (employee1.getEmployeeHeadquarter() != null && employee1.getEmployeeHeadquarter().getHeadquarterId() < 1) {
                        // Throw IAE
                        throw new IllegalArgumentException(MessageFormat.format("employee1.employeeHeadquarter.headquarterId={0} is invalid.", employee1.getEmployeeHeadquarter().getHeadquarterId())); //NOI18N
-               } else if ((employee1.getEmployeePersonalData() == null) && (employee1.getEmployeeNumber() == null)) {
-                       // Both are null
-                       throw new NullPointerException("employee1.employeePersonalData and employee1.employeeNumber are null"); //NOI18N
+               } else if ((employee1.getEmployeePersonalData() == null) && (employee1.getEmployeeBranchOffice() == null) && (employee1.getEmployeeHeadquarter() == null) && (employee1.getEmployeeNumber() == null)) {
+                       // All are null
+                       throw new NullPointerException("employee1.employeePersonalData, employee1.employeeBranchOffice, employee1.employeeHeadquarter and employee1.employeeNumber are null"); //NOI18N
                } else if ((employee1.getEmployeePersonalData() != null) && (employee1.getEmployeePersonalData().getContactId() == null)) {
                        // Throw NPE
                        throw new NullPointerException("employee1.employeePersonalData.contactId is null"); //NOI18N
@@ -146,9 +146,9 @@ public class Employees implements Serializable {
                } else if (employee2.getEmployeeHeadquarter() != null && employee2.getEmployeeHeadquarter().getHeadquarterId() < 1) {
                        // Throw IAE
                        throw new IllegalArgumentException(MessageFormat.format("employee2.employeeHeadquarter.headquarterId={0} is invalid.", employee2.getEmployeeHeadquarter().getHeadquarterId())); //NOI18N
-               } else if ((employee2.getEmployeePersonalData() == null) && (employee2.getEmployeeNumber() == null)) {
-                       // Both are null
-                       throw new NullPointerException("employee2.employeePersonalData and employee2.employeeNumber are null"); //NOI18N
+               } else if ((employee2.getEmployeePersonalData() == null) && (employee2.getEmployeeBranchOffice() == null) && (employee2.getEmployeeHeadquarter() == null) && (employee2.getEmployeeNumber() == null)) {
+                       // All are null
+                       throw new NullPointerException("employee2.employeePersonalData, employee2.employeeBranchOffice, employee2.employeeHeadquarter and employee2.employeeNumber are null"); //NOI18N
                } else if ((employee2.getEmployeePersonalData() != null) && (employee2.getEmployeePersonalData().getContactId() == null)) {
                        // Throw NPE
                        throw new NullPointerException("employee2.employeePersonalData.contactId is null"); //NOI18N