From 80a7e2b08dfca74e34b7ac96fbf8964a1949d553 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 10 May 2020 01:47:53 +0200 Subject: [PATCH] Continued: - renamed other to fooEntity - renamed logoUploader to logoUploaderUser - added missing members to equals()/hashCode() - sorted members in equals()/hashCode() methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/basicdata/BusinessBasicData.java | 26 +++++++++---------- .../model/department/BusinessDepartment.java | 19 ++++++++++---- .../model/jobposition/EmployeePosition.java | 10 +++---- .../model/logo/BusinessLogo.java | 26 +++++++++---------- .../jcontactsbusiness/model/logo/Logo.java | 4 +-- 5 files changed, 47 insertions(+), 38 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java index f5a9f9d..469c915 100644 --- a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java @@ -259,31 +259,31 @@ public class BusinessBasicData implements BasicData { return false; } - final BasicData other = (BasicData) object; + final BasicData basicData = (BasicData) object; - if (!Objects.equals(this.getBasicDataId(), other.getBasicDataId())) { + if (!Objects.equals(this.getBasicDataId(), basicData.getBasicDataId())) { return false; - } else if (!Objects.equals(this.getCompanyComments(), other.getCompanyComments())) { + } else if (!Objects.equals(this.getCompanyComments(), basicData.getCompanyComments())) { return false; - } else if (!Objects.equals(this.getCompanyEmailAddress(), other.getCompanyEmailAddress())) { + } else if (!Objects.equals(this.getCompanyEmailAddress(), basicData.getCompanyEmailAddress())) { return false; - } else if (!Objects.equals(this.getCompanyFaxNumber(), other.getCompanyFaxNumber())) { + } else if (!Objects.equals(this.getCompanyFaxNumber(), basicData.getCompanyFaxNumber())) { return false; - } else if (!Objects.equals(this.getCompanyLandLineNumber(), other.getCompanyLandLineNumber())) { + } else if (!Objects.equals(this.getCompanyLandLineNumber(), basicData.getCompanyLandLineNumber())) { return false; - } else if (!Objects.equals(this.getCompanyLogo(), other.getCompanyLogo())) { + } else if (!Objects.equals(this.getCompanyLogo(), basicData.getCompanyLogo())) { return false; - } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) { + } else if (!Objects.equals(this.getCompanyName(), basicData.getCompanyName())) { return false; - } else if (!Objects.equals(this.getCompanyRoadNumber(), other.getCompanyRoadNumber())) { + } else if (!Objects.equals(this.getCompanyRoadNumber(), basicData.getCompanyRoadNumber())) { return false; - } else if (!Objects.equals(this.getCompanyShortName(), other.getCompanyShortName())) { + } else if (!Objects.equals(this.getCompanyShortName(), basicData.getCompanyShortName())) { return false; - } else if (!Objects.equals(this.getCompanyTaxNumber(), other.getCompanyTaxNumber())) { + } else if (!Objects.equals(this.getCompanyTaxNumber(), basicData.getCompanyTaxNumber())) { return false; - } else if (!Objects.equals(this.getCompanyUserOwner(), other.getCompanyUserOwner())) { + } else if (!Objects.equals(this.getCompanyUserOwner(), basicData.getCompanyUserOwner())) { return false; - } else if (!Objects.equals(this.getCompanyWebsiteUrl(), other.getCompanyWebsiteUrl())) { + } else if (!Objects.equals(this.getCompanyWebsiteUrl(), basicData.getCompanyWebsiteUrl())) { return false; } diff --git a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java index 6428a13..bc2dcb6 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java @@ -205,13 +205,19 @@ public class BusinessDepartment implements Department { return false; } - final Department other = (Department) object; + final Department department = (Department) object; - if (!Objects.equals(this.getDepartmentBranchOffice(), other.getDepartmentBranchOffice())) { + if (!Objects.equals(this.getDepartmentBranchOffice(), department.getDepartmentBranchOffice())) { return false; - } else if (!Objects.equals(this.getDepartmentCompany(), other.getDepartmentCompany())) { + } else if (!Objects.equals(this.getDepartmentCompany(), department.getDepartmentCompany())) { return false; - } else if (!Objects.equals(this.getDepartmentI18nKey(), other.getDepartmentI18nKey())) { + } else if (!Objects.equals(this.getDepartmentHeadquarter(), department.getDepartmentHeadquarter())) { + return false; + } else if (!Objects.equals(this.getDepartmentI18nKey(), department.getDepartmentI18nKey())) { + return false; + } else if (!Objects.equals(this.getDepartmentId(), department.getDepartmentId())) { + return false; + } else if (!Objects.equals(this.getDepartmentUserOwner(), department.getDepartmentUserOwner())) { return false; } @@ -316,9 +322,12 @@ public class BusinessDepartment implements Department { public int hashCode () { int hash = 5; - hash = 53 * hash + Objects.hashCode(this.getDepartmentId()); + hash = 53 * hash + Objects.hashCode(this.getDepartmentBranchOffice()); hash = 53 * hash + Objects.hashCode(this.getDepartmentCompany()); + hash = 53 * hash + Objects.hashCode(this.getDepartmentHeadquarter()); + hash = 53 * hash + Objects.hashCode(this.getDepartmentId()); hash = 53 * hash + Objects.hashCode(this.getDepartmentI18nKey()); + hash = 53 * hash + Objects.hashCode(this.getDepartmentUserOwner()); return hash; } diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java b/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java index 88de0ce..fbb1d15 100644 --- a/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java +++ b/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java @@ -166,15 +166,15 @@ public class EmployeePosition implements HireableJobPosition { return false; } - final HireableJobPosition other = (HireableJobPosition) object; + final HireableJobPosition jobPosition = (HireableJobPosition) object; - if (!Objects.equals(this.getJobPositionAddedUser(), other.getJobPositionAddedUser())) { + if (!Objects.equals(this.getJobPositionAddedUser(), jobPosition.getJobPositionAddedUser())) { return false; - } else if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) { + } else if (!Objects.equals(this.getJobPositionId(), jobPosition.getJobPositionId())) { return false; - } else if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) { + } else if (!Objects.equals(this.getJobPositionName(), jobPosition.getJobPositionName())) { return false; - } else if (!Objects.equals(this.getJobPositionStatus(), other.getJobPositionStatus())) { + } else if (!Objects.equals(this.getJobPositionStatus(), jobPosition.getJobPositionStatus())) { return false; } diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java index 99a9ceb..32907e6 100644 --- a/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java +++ b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java @@ -84,9 +84,9 @@ public class BusinessLogo implements Logo { /** * Logo uploader user instance */ - @JoinColumn (name = "logo_uploader_id", nullable = false, updatable = false) + @JoinColumn (name = "logo_uploader_user_id", nullable = false, updatable = false) @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User logoUploader; + private User logoUploaderUser; @Override public int compareTo (final Logo logo) { @@ -104,7 +104,7 @@ public class BusinessLogo implements Logo { // First file name ... this.getLogoFileName().compareToIgnoreCase(logo.getLogoFileName()), // ... then uploader instance - this.getLogoUploader().compareTo(logo.getLogoUploader()) + this.getLogoUploaderUser().compareTo(logo.getLogoUploaderUser()) }; // Check all values @@ -122,13 +122,13 @@ public class BusinessLogo implements Logo { return false; } - final Logo other = (Logo) object; + final Logo logo = (Logo) object; - if (!Objects.equals(this.getLogoId(), other.getLogoId())) { + if (!Objects.equals(this.getLogoFileName(), logo.getLogoFileName())) { return false; - } else if (!Objects.equals(this.getLogoUploader(), other.getLogoUploader())) { + } else if (!Objects.equals(this.getLogoId(), logo.getLogoId())) { return false; - } else if (!Objects.equals(this.getLogoFileName(), other.getLogoFileName())) { + } else if (!Objects.equals(this.getLogoUploaderUser(), logo.getLogoUploaderUser())) { return false; } @@ -180,22 +180,22 @@ public class BusinessLogo implements Logo { } @Override - public User getLogoUploader () { - return this.logoUploader; + public User getLogoUploaderUser () { + return this.logoUploaderUser; } @Override - public void setLogoUploader (final User logoUploader) { - this.logoUploader = logoUploader; + public void setLogoUploaderUser (final User logoUploaderUser) { + this.logoUploaderUser = logoUploaderUser; } @Override public int hashCode () { int hash = 3; - hash = 53 * hash + Objects.hashCode(this.getLogoId()); hash = 53 * hash + Objects.hashCode(this.getLogoFileName()); - hash = 53 * hash + Objects.hashCode(this.getLogoUploader()); + hash = 53 * hash + Objects.hashCode(this.getLogoId()); + hash = 53 * hash + Objects.hashCode(this.getLogoUploaderUser()); return hash; } diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/Logo.java b/src/org/mxchange/jcontactsbusiness/model/logo/Logo.java index ddfc9e3..19c2d7b 100644 --- a/src/org/mxchange/jcontactsbusiness/model/logo/Logo.java +++ b/src/org/mxchange/jcontactsbusiness/model/logo/Logo.java @@ -60,14 +60,14 @@ public interface Logo extends Comparable, Serializable { *

* @return User owner instance */ - User getLogoUploader (); + User getLogoUploaderUser (); /** * Setter for user owner instance *

* @param logoUploader User owner instance */ - void setLogoUploader (final User logoUploader); + void setLogoUploaderUser (final User logoUploader); /** * Getter for timestamp when this entry has been created -- 2.39.5