From 42d68ff56df219eeb5e22c4c5a8c2f878316a114 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 6 Oct 2022 15:26:26 +0200 Subject: [PATCH] Continued: - renamed all *s utility classes to *Utils - moved them to own package (for all the same package) --- .../model/basicdata/BusinessBasicData.java | 6 ++--- .../branchoffice/BusinessBranchOffice.java | 7 +++--- .../model/department/BusinessDepartment.java | 22 ++++++++++------ .../model/employee/BusinessEmployee.java | 25 +++++++++++-------- .../model/jobposition/EmployeePosition.java | 6 +++-- .../model/logo/BusinessLogo.java | 6 +++-- .../{basicdata => utils}/BasicDataUtils.java | 3 ++- .../BranchOfficeUtils.java} | 7 +++--- .../DepartmentUtils.java} | 7 +++--- .../EmployeeUtils.java} | 7 +++--- .../HeadquarterUtils.java} | 7 +++--- .../JobPositionUtils.java} | 7 +++--- 12 files changed, 66 insertions(+), 44 deletions(-) rename src/org/mxchange/jcontactsbusiness/model/{basicdata => utils}/BasicDataUtils.java (94%) rename src/org/mxchange/jcontactsbusiness/model/{branchoffice/BranchOffices.java => utils/BranchOfficeUtils.java} (96%) rename src/org/mxchange/jcontactsbusiness/model/{department/Departments.java => utils/DepartmentUtils.java} (96%) rename src/org/mxchange/jcontactsbusiness/model/{employee/Employees.java => utils/EmployeeUtils.java} (98%) rename src/org/mxchange/jcontactsbusiness/model/{headquarter/Headquarters.java => utils/HeadquarterUtils.java} (95%) rename src/org/mxchange/jcontactsbusiness/model/{jobposition/JobPositions.java => utils/JobPositionUtils.java} (89%) diff --git a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java index 80d60e5..dbd25c5 100644 --- a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java @@ -41,9 +41,9 @@ import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee; import org.mxchange.jcontactsbusiness.model.employee.Employable; 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.logo.BusinessLogo; import org.mxchange.jcontactsbusiness.model.logo.Logo; +import org.mxchange.jcontactsbusiness.model.utils.HeadquarterUtils; import org.mxchange.jcoreutils.Comparables; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber; @@ -233,7 +233,7 @@ public class BusinessBasicData implements BasicData { // Init comparators final int comparators[] = { // First compare company short name - this.getCompanyShortName().compareToIgnoreCase(basicData.getCompanyShortName()), + StringUtils.compareIgnoreCase(this.getCompanyShortName(), basicData.getCompanyShortName()), // ... 2nd compare company name StringUtils.compareIgnoreCase(this.getCompanyName(), basicData.getCompanyName()), // ... next tax number @@ -241,7 +241,7 @@ public class BusinessBasicData implements BasicData { // ... and email address StringUtils.compareIgnoreCase(this.getCompanyEmailAddress(), basicData.getCompanyEmailAddress()), // ... head quarter data - Headquarters.compare(this.getCompanyHeadquarterData(), basicData.getCompanyHeadquarterData()) + HeadquarterUtils.compare(this.getCompanyHeadquarterData(), basicData.getCompanyHeadquarterData()) }; // Check all values diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java index ff41be2..66f9200 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java @@ -40,8 +40,8 @@ import javax.persistence.TemporalType; import javax.persistence.Transient; import org.apache.commons.lang3.StringUtils; import org.mxchange.jcontacts.model.contact.Contact; -import org.mxchange.jcontacts.model.contact.Contacts; import org.mxchange.jcontacts.model.contact.UserContact; +import org.mxchange.jcontacts.model.utils.ContactUtils; import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime; @@ -324,14 +324,15 @@ public class BusinessBranchOffice implements BranchOffice { // Init comparisons final int[] comparators = { + // First compare basic data // First compare basic data this.getBranchCompany().compareTo(branchOffice.getBranchCompany()), // ... branch office number SafeNumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()), // ... owner employee - Contacts.compare(this.getBranchOwnerEmployee(), branchOffice.getBranchOwnerEmployee()), + ContactUtils.compare(this.getBranchOwnerEmployee(), branchOffice.getBranchOwnerEmployee()), // ... contact person - Contacts.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()), + ContactUtils.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()), // ... then country this.getBranchCountry().compareTo(branchOffice.getBranchCountry()), // ... next city diff --git a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java index 1bd6df7..757ed77 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java @@ -34,19 +34,23 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.apache.commons.lang3.StringUtils; import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jcontacts.model.contact.UserContact; +import org.mxchange.jcontacts.model.utils.ContactUtils; import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; -import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices; import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice; 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.utils.BasicDataUtils; +import org.mxchange.jcontactsbusiness.model.utils.BranchOfficeUtils; +import org.mxchange.jcontactsbusiness.model.utils.HeadquarterUtils; import org.mxchange.jcoreutils.Comparables; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.Users; /** * A POJO for company departments @@ -181,13 +185,17 @@ public class BusinessDepartment implements Department { // Init comparisons final int[] comparators = { // First department's company (BasicData) ... - this.getDepartmentCompany().compareTo(department.getDepartmentCompany()), + BasicDataUtils.compare(this.getDepartmentCompany(), department.getDepartmentCompany()), // ... then headquarters - Headquarters.compare(this.getDepartmentHeadquarter(), department.getDepartmentHeadquarter()), + HeadquarterUtils.compare(this.getDepartmentHeadquarter(), department.getDepartmentHeadquarter()), // ... branch office - BranchOffices.compare(this.getDepartmentBranchOffice(), department.getDepartmentBranchOffice()), - // ... finally department's i18n key - this.getDepartmentI18nKey().compareTo(department.getDepartmentI18nKey()) + BranchOfficeUtils.compare(this.getDepartmentBranchOffice(), department.getDepartmentBranchOffice()), + // ... department's i18n key + StringUtils.compare(this.getDepartmentI18nKey(), department.getDepartmentI18nKey()), + // ... lead contact + ContactUtils.compare(this.getDepartmentLead(), department.getDepartmentLead()), + // ... user owner + Users.compare(this.getDepartmentUserOwner(), department.getDepartmentUserOwner()) }; // Check all values diff --git a/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java b/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java index 7e5a5e2..b2c8054 100644 --- a/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java @@ -35,22 +35,23 @@ import javax.persistence.TemporalType; import javax.persistence.Transient; import org.apache.commons.lang3.StringUtils; import org.mxchange.jcontacts.model.contact.Contact; -import org.mxchange.jcontacts.model.contact.Contacts; import org.mxchange.jcontacts.model.contact.UserContact; +import org.mxchange.jcontacts.model.utils.ContactUtils; import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; -import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices; import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice; import org.mxchange.jcontactsbusiness.model.department.BusinessDepartment; import org.mxchange.jcontactsbusiness.model.department.Department; -import org.mxchange.jcontactsbusiness.model.department.Departments; 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.HireableJobPosition; -import org.mxchange.jcontactsbusiness.model.jobposition.JobPositions; +import org.mxchange.jcontactsbusiness.model.utils.JobPositionUtils; +import org.mxchange.jcontactsbusiness.model.utils.BasicDataUtils; +import org.mxchange.jcontactsbusiness.model.utils.BranchOfficeUtils; +import org.mxchange.jcontactsbusiness.model.utils.DepartmentUtils; +import org.mxchange.jcontactsbusiness.model.utils.HeadquarterUtils; import org.mxchange.jcoreutils.Comparables; import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber; @@ -220,21 +221,23 @@ public class BusinessEmployee implements Employable { // Init comparisons final int[] comparators = { + // First employee's number // First employee's number StringUtils.compareIgnoreCase(this.getEmployeeNumber(), employable.getEmployeeNumber()), // ... finally contact data - Contacts.compare(this.getEmployeePersonalData(), employable.getEmployeePersonalData()), + ContactUtils.compare(this.getEmployeePersonalData(), employable.getEmployeePersonalData()), // ... employee's email address StringUtils.compareIgnoreCase(this.getEmployeeEmailAddress(), employable.getEmployeeEmailAddress()), // ... company data (BasicData) - this.getEmployeeBasicData().compareTo(employable.getEmployeeBasicData()), - JobPositions.compare(this.getEmployeeJobPosition(), employable.getEmployeeJobPosition()), + BasicDataUtils.compare(this.getEmployeeBasicData(), employable.getEmployeeBasicData()), + // ... job position +JobPositionUtils.compare(this.getEmployeeJobPosition(), employable.getEmployeeJobPosition()), // ... department - Departments.compare(this.getEmployeeDepartment(), employable.getEmployeeDepartment()), + DepartmentUtils.compare(this.getEmployeeDepartment(), employable.getEmployeeDepartment()), // ... branch office - BranchOffices.compare(this.getEmployeeBranchOffice(), employable.getEmployeeBranchOffice()), + BranchOfficeUtils.compare(this.getEmployeeBranchOffice(), employable.getEmployeeBranchOffice()), // ... next headquarters - Headquarters.compare(this.getEmployeeHeadquarter(), employable.getEmployeeHeadquarter()),}; + HeadquarterUtils.compare(this.getEmployeeHeadquarter(), employable.getEmployeeHeadquarter()),}; // Check all values final int comparison = Comparables.checkAll(comparators); diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java b/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java index c08b89d..ae2e5ae 100644 --- a/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java +++ b/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java @@ -33,10 +33,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.apache.commons.lang3.StringUtils; import org.mxchange.jcontactsbusiness.model.jobposition.status.JobPositionStatus; import org.mxchange.jcoreutils.Comparables; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.Users; /** * A POJO for job positions @@ -144,9 +146,9 @@ public class EmployeePosition implements HireableJobPosition { // Init comparisons final int[] comparators = { // First added by which user ... - this.getJobPositionAddedUser().compareTo(jobPosition.getJobPositionAddedUser()), + Users.compare(this.getJobPositionAddedUser(), jobPosition.getJobPositionAddedUser()), // ... next name - this.getJobPositionName().compareToIgnoreCase(jobPosition.getJobPositionName()) + StringUtils.compareIgnoreCase(this.getJobPositionName(), jobPosition.getJobPositionName()) }; // Check all values diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java index 8e7f392..ae98fde 100644 --- a/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java +++ b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java @@ -31,9 +31,11 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.apache.commons.lang3.StringUtils; import org.mxchange.jcoreutils.Comparables; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.Users; /** * A POJO for company logos @@ -102,9 +104,9 @@ public class BusinessLogo implements Logo { // Init comparisons final int[] comparators = { // First file name ... - this.getLogoFileName().compareToIgnoreCase(logo.getLogoFileName()), + StringUtils.compareIgnoreCase(this.getLogoFileName(), logo.getLogoFileName()), // ... then uploader instance - this.getLogoUploaderUser().compareTo(logo.getLogoUploaderUser()) + Users.compare(this.getLogoUploaderUser(), logo.getLogoUploaderUser()) }; // Check all values diff --git a/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicDataUtils.java b/src/org/mxchange/jcontactsbusiness/model/utils/BasicDataUtils.java similarity index 94% rename from src/org/mxchange/jcontactsbusiness/model/basicdata/BasicDataUtils.java rename to src/org/mxchange/jcontactsbusiness/model/utils/BasicDataUtils.java index e7f5126..e4a4616 100644 --- a/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicDataUtils.java +++ b/src/org/mxchange/jcontactsbusiness/model/utils/BasicDataUtils.java @@ -14,10 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.model.basicdata; +package org.mxchange.jcontactsbusiness.model.utils; import java.io.Serializable; import java.util.Objects; +import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; /** * An utilities class for basic company data diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java b/src/org/mxchange/jcontactsbusiness/model/utils/BranchOfficeUtils.java similarity index 96% rename from src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java rename to src/org/mxchange/jcontactsbusiness/model/utils/BranchOfficeUtils.java index 1f08653..801b17b 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java +++ b/src/org/mxchange/jcontactsbusiness/model/utils/BranchOfficeUtils.java @@ -15,17 +15,18 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.model.branchoffice; +package org.mxchange.jcontactsbusiness.model.utils; import java.io.Serializable; import java.util.Objects; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; /** * An utilities class for branch offices * * @author Roland Häder */ -public class BranchOffices implements Serializable { +public class BranchOfficeUtils implements Serializable { /** * Serial number @@ -160,7 +161,7 @@ public class BranchOffices implements Serializable { /** * Private default constructor */ - private BranchOffices () { + private BranchOfficeUtils () { // Utilities don't have instances } diff --git a/src/org/mxchange/jcontactsbusiness/model/department/Departments.java b/src/org/mxchange/jcontactsbusiness/model/utils/DepartmentUtils.java similarity index 96% rename from src/org/mxchange/jcontactsbusiness/model/department/Departments.java rename to src/org/mxchange/jcontactsbusiness/model/utils/DepartmentUtils.java index e4d0c32..f1c657f 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/Departments.java +++ b/src/org/mxchange/jcontactsbusiness/model/utils/DepartmentUtils.java @@ -14,12 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.model.department; +package org.mxchange.jcontactsbusiness.model.utils; import java.io.Serializable; import java.text.MessageFormat; import java.util.Objects; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.department.Department; import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter; /** @@ -27,7 +28,7 @@ import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter; *

* @author Roland Häder */ -public class Departments implements Serializable { +public class DepartmentUtils implements Serializable { /** * Serial number @@ -156,7 +157,7 @@ public class Departments implements Serializable { /** * Private default constructor */ - private Departments () { + private DepartmentUtils () { // Prevent instances from utilities classes } diff --git a/src/org/mxchange/jcontactsbusiness/model/employee/Employees.java b/src/org/mxchange/jcontactsbusiness/model/utils/EmployeeUtils.java similarity index 98% rename from src/org/mxchange/jcontactsbusiness/model/employee/Employees.java rename to src/org/mxchange/jcontactsbusiness/model/utils/EmployeeUtils.java index a5f20f3..3e8bcb6 100644 --- a/src/org/mxchange/jcontactsbusiness/model/employee/Employees.java +++ b/src/org/mxchange/jcontactsbusiness/model/utils/EmployeeUtils.java @@ -14,18 +14,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.model.employee; +package org.mxchange.jcontactsbusiness.model.utils; import java.io.Serializable; import java.text.MessageFormat; import java.util.Objects; +import org.mxchange.jcontactsbusiness.model.employee.Employable; /** * Utilities class for employees *

* @author Roland Häder */ -public class Employees implements Serializable { +public class EmployeeUtils implements Serializable { /** * Serial number @@ -182,7 +183,7 @@ public class Employees implements Serializable { /** * Private constructor */ - private Employees () { + private EmployeeUtils () { // No instances from utilities } diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarters.java b/src/org/mxchange/jcontactsbusiness/model/utils/HeadquarterUtils.java similarity index 95% rename from src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarters.java rename to src/org/mxchange/jcontactsbusiness/model/utils/HeadquarterUtils.java index dfd6020..fbe2283 100644 --- a/src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarters.java +++ b/src/org/mxchange/jcontactsbusiness/model/utils/HeadquarterUtils.java @@ -14,17 +14,18 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.model.headquarter; +package org.mxchange.jcontactsbusiness.model.utils; import java.io.Serializable; import java.util.Objects; +import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter; /** * An utilities class for headquarter * * @author Roland Häder */ -public class Headquarters implements Serializable { +public class HeadquarterUtils implements Serializable { /** * Serial number @@ -117,7 +118,7 @@ public class Headquarters implements Serializable { /** * Private default constructor */ - private Headquarters () { + private HeadquarterUtils () { // Utilities don't have instances } diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/JobPositions.java b/src/org/mxchange/jcontactsbusiness/model/utils/JobPositionUtils.java similarity index 89% rename from src/org/mxchange/jcontactsbusiness/model/jobposition/JobPositions.java rename to src/org/mxchange/jcontactsbusiness/model/utils/JobPositionUtils.java index 72d1b67..36d6c95 100644 --- a/src/org/mxchange/jcontactsbusiness/model/jobposition/JobPositions.java +++ b/src/org/mxchange/jcontactsbusiness/model/utils/JobPositionUtils.java @@ -14,17 +14,18 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.model.jobposition; +package org.mxchange.jcontactsbusiness.model.utils; import java.io.Serializable; import java.util.Objects; +import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition; /** * Utilities class for job positions *

* @author Roland Häder */ -public class JobPositions implements Serializable { +public class JobPositionUtils implements Serializable { /** * Serial number @@ -60,7 +61,7 @@ public class JobPositions implements Serializable { /** * Private constructor */ - private JobPositions () { + private JobPositionUtils () { // No instance should be creatable } -- 2.39.5