/*
- * 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
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;
*/
@JoinColumn (name = "employee_position_id")
@OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.REFRESH)
- private JobPosition employeeJobPosition;
+ private HireableJobPosition employeeJobPosition;
/**
* Employee's business mobile number
@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
}
@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;
}