From: Roland Häder Date: Sun, 10 May 2020 04:52:14 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9ddab69c511068777101f65e94073a3c85fa55b0;p=jcontacts-business-core.git Continued: - also had to change it for branch offices (both references) Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java index 4795de9..0a41bd1 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java @@ -19,8 +19,8 @@ package org.mxchange.jcontactsbusiness.model.branchoffice; import java.io.Serializable; import java.util.Date; import java.util.List; +import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; -import org.mxchange.jcontactsbusiness.model.employee.Employable; import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime; import org.mxchange.jcountry.model.data.Country; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; @@ -203,18 +203,18 @@ public interface BranchOffice extends Comparable, Serializable { void setBranchOpeningTimes (final List branchOpeningTimes); /** - * Getter for branch office owning employee + * Getter for branch office owning contact *

- * @return Owning employee + * @return Owning contact */ - Employable getBranchOwnerEmployee (); + Contact getBranchOwnerEmployee (); /** - * Setter for branch office owning employee + * Setter for branch office owning contact *

- * @param branchOwnerEmployee Owning employee + * @param branchOwnerEmployee Owning contact */ - void setBranchOwnerEmployee (final Employable branchOwnerEmployee); + void setBranchOwnerEmployee (final Contact branchOwnerEmployee); /** * Getter for branch office's ZIP code @@ -277,14 +277,14 @@ public interface BranchOffice extends Comparable, Serializable { *

* @return Branch office's contact person */ - Employable getBranchContactEmployee (); + Contact getBranchContactEmployee (); /** * Setter branch office's contact person *

* @param branchEmployee Branch office's contact person */ - void setBranchContactEmployee (final Employable branchEmployee); + void setBranchContactEmployee (final Contact branchEmployee); /** * Getter for user owner instance diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java index 5d8f272..01b4b5d 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java @@ -39,11 +39,11 @@ 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.Contacts; +import org.mxchange.jcontacts.model.contact.UserContact; import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee; -import org.mxchange.jcontactsbusiness.model.employee.Employable; -import org.mxchange.jcontactsbusiness.model.employee.Employees; import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime; import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime; import org.mxchange.jcoreutils.Comparables; @@ -96,9 +96,9 @@ public class BusinessBranchOffice implements BranchOffice { /** * Reference to contact person */ - @JoinColumn (name = "branch_contact_employee_id", referencedColumnName = "employee_id") - @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.REFRESH) - private Employable branchContactEmployee; + @JoinColumn (name = "branch_contact_employee_id", referencedColumnName = "contact_id") + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH) + private Contact branchContactEmployee; /** * Branch office's country code @@ -199,9 +199,9 @@ public class BusinessBranchOffice implements BranchOffice { * will have an owning person (here generally referred as "employee") who * will own one or more branch offices. */ - @JoinColumn (name = "branch_owner_employee_id", referencedColumnName = "employee_id") - @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.REFRESH) - private Employable branchOwnerEmployee; + @JoinColumn (name = "branch_owner_employee_id", referencedColumnName = "contact_id") + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH) + private Contact branchOwnerEmployee; /** * Branch office's store (if multiple-store building) @@ -329,9 +329,9 @@ public class BusinessBranchOffice implements BranchOffice { // ... branch office number SafeNumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()), // ... owner employee - Employees.compare(this.getBranchOwnerEmployee(), branchOffice.getBranchOwnerEmployee()), + Contacts.compare(this.getBranchOwnerEmployee(), branchOffice.getBranchOwnerEmployee()), // ... contact person - Employees.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()), + Contacts.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()), // ... then country this.getBranchCountry().compareTo(branchOffice.getBranchCountry()), // ... next city @@ -376,6 +376,8 @@ public class BusinessBranchOffice implements BranchOffice { return false; } else if (!Objects.equals(this.getBranchCompany(), branchOffice.getBranchCompany())) { return false; + } else if (!Objects.equals(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee())) { + return false; } else if (!Objects.equals(this.getBranchCountry(), branchOffice.getBranchCountry())) { return false; } else if (!Objects.equals(this.getBranchEmailAddress(), branchOffice.getBranchEmailAddress())) { @@ -392,6 +394,8 @@ public class BusinessBranchOffice implements BranchOffice { return false; } else if (!Objects.equals(this.getBranchNumber(), branchOffice.getBranchNumber())) { return false; + } else if (!Objects.equals(this.getBranchOwnerEmployee(), branchOffice.getBranchOwnerEmployee())) { + return false; } else if (!Objects.equals(this.getBranchStore(), branchOffice.getBranchStore())) { return false; } else if (!Objects.equals(this.getBranchStreet(), branchOffice.getBranchStreet())) { @@ -428,12 +432,12 @@ public class BusinessBranchOffice implements BranchOffice { } @Override - public Employable getBranchContactEmployee () { + public Contact getBranchContactEmployee () { return this.branchContactEmployee; } @Override - public void setBranchContactEmployee (final Employable branchContactEmployee) { + public void setBranchContactEmployee (final Contact branchContactEmployee) { this.branchContactEmployee = branchContactEmployee; } @@ -564,12 +568,12 @@ public class BusinessBranchOffice implements BranchOffice { } @Override - public Employable getBranchOwnerEmployee () { + public Contact getBranchOwnerEmployee () { return this.branchOwnerEmployee; } @Override - public void setBranchOwnerEmployee (final Employable branchOwnerEmployee) { + public void setBranchOwnerEmployee (final Contact branchOwnerEmployee) { this.branchOwnerEmployee = branchOwnerEmployee; } @@ -629,6 +633,7 @@ public class BusinessBranchOffice implements BranchOffice { hash = 53 * hash + Objects.hashCode(this.getBranchCity()); hash = 53 * hash + Objects.hashCode(this.getBranchCompany()); + hash = 53 * hash + Objects.hashCode(this.getBranchContactEmployee()); hash = 53 * hash + Objects.hashCode(this.getBranchCountry()); hash = 53 * hash + Objects.hashCode(this.getBranchEmailAddress()); hash = 53 * hash + Objects.hashCode(this.getBranchFaxNumber()); @@ -638,6 +643,7 @@ public class BusinessBranchOffice implements BranchOffice { hash = 53 * hash + Objects.hashCode(this.getBranchLandLineNumber()); hash = 53 * hash + Objects.hashCode(this.getBranchLastHouseNumber()); hash = 53 * hash + Objects.hashCode(this.getBranchNumber()); + hash = 53 * hash + Objects.hashCode(this.getBranchOwnerEmployee()); hash = 53 * hash + Objects.hashCode(this.getBranchStore()); hash = 53 * hash + Objects.hashCode(this.getBranchStreet()); hash = 53 * hash + Objects.hashCode(this.getBranchSuiteNumber()); diff --git a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java index d066b59..46201ff 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java @@ -123,7 +123,7 @@ public class BusinessDepartment implements Department { /** * Department lead contact data */ - @JoinColumn (name = "department_lead_id") + @JoinColumn (name = "department_lead_id", referencedColumnName = "contact_id") @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH) private Contact departmentLead;