]> git.mxchange.org Git - jcontacts-business-core.git/blobdiff - src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java
Updated copyright year
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / model / employee / BusinessEmployee.java
index 63b32579033f3f80475a4881f01d93e83b8d2f0b..467454c1368a5fd113043f6c54d6756052ed188e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 - 2018 Free Software Foundation
+ * Copyright (C) 2016 - 2020 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
@@ -49,7 +49,7 @@ import org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarters;
 import org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition;
-import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
+import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition;
 import org.mxchange.jcontactsbusiness.model.jobposition.JobPositions;
 import org.mxchange.jcoreutils.Comparables;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
@@ -132,7 +132,7 @@ public class BusinessEmployee implements Employable {
         */
        @JoinColumn (name = "employee_position_id")
        @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.REFRESH)
-       private JobPosition employeeJobPosition;
+       private HireableJobPosition employeeJobPosition;
 
        /**
         * Employee's business mobile number
@@ -202,33 +202,35 @@ public class BusinessEmployee implements Employable {
 
        @Override
        public int compareTo (final Employable employable) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == employable) {
                        // Should not happen
                        throw new NullPointerException("employable is null"); //NOI18N
-               } else if (Objects.equals(this, employable)) {
+               } else if (employable.equals(this)) {
                        // Same object
                        return 0;
                }
 
                // Init comparisons
                final int[] comparators = {
-                       // First check company data (BasicData)
-                       this.getEmployeeBasicData().compareTo(employable.getEmployeeBasicData()),
-                       // ... next headquarters
-                       Headquarters.compare(this.getEmployeeHeadquarter(), employable.getEmployeeHeadquarter()),
-                       // ... branch office
-                       BranchOffices.compare(this.getEmployeeBranchOffice(), employable.getEmployeeBranchOffice()),
-                       // ... department
-                       Departments.compare(this.getEmployeeDepartment(), employable.getEmployeeDepartment()),
-                       // ... job position
-                       JobPositions.compare(this.getEmployeeJobPosition(), employable.getEmployeeJobPosition()),
-                       // ... employee's number
+                       // First employee's number
+                       // First employee's number
+                       // First employee's number
+                       // First employee's number
                        StringUtils.compareIgnoreCase(this.getEmployeeNumber(), employable.getEmployeeNumber()),
+                       // ... finally contact data
+                       Contacts.compare(this.getEmployeePersonalData(), employable.getEmployeePersonalData()),
                        // ... employee's email address
                        StringUtils.compareIgnoreCase(this.getEmployeeEmailAddress(), employable.getEmployeeEmailAddress()),
-                       // ... finally contact data
-                       Contacts.compare(this.getEmployeePersonalData(), employable.getEmployeePersonalData())
+                       // ... company data (BasicData)
+                       this.getEmployeeBasicData().compareTo(employable.getEmployeeBasicData()),
+                       JobPositions.compare(this.getEmployeeJobPosition(), employable.getEmployeeJobPosition()),
+                       // ... department
+                       Departments.compare(this.getEmployeeDepartment(), employable.getEmployeeDepartment()),
+                       // ... branch office
+                       BranchOffices.compare(this.getEmployeeBranchOffice(), employable.getEmployeeBranchOffice()),
+                       // ... next headquarters
+                       Headquarters.compare(this.getEmployeeHeadquarter(), employable.getEmployeeHeadquarter()),
                };
 
                // Check all values
@@ -334,12 +336,12 @@ public class BusinessEmployee implements Employable {
        }
 
        @Override
-       public JobPosition getEmployeeJobPosition () {
+       public HireableJobPosition getEmployeeJobPosition () {
                return this.employeeJobPosition;
        }
 
        @Override
-       public void setEmployeeJobPosition (final JobPosition employeeJobPosition) {
+       public void setEmployeeJobPosition (final HireableJobPosition employeeJobPosition) {
                this.employeeJobPosition = employeeJobPosition;
        }