]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 10 May 2020 04:57:40 +0000 (06:57 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 10 May 2020 04:57:40 +0000 (06:57 +0200)
- also headquarter cannot have direct reference to employee as this would result
  in recursive call as the headquarter's employee may also be compared

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java
src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarter.java

index 27923e1de45168ab85978480dfa7b21d24641ed5..36c8f2002d9134771231aeac905f0178cd1b0cb9 100644 (file)
@@ -38,8 +38,8 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 import org.apache.commons.lang3.StringUtils;
-import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontacts.model.contact.UserContact;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcoreutils.Comparables;
@@ -91,9 +91,9 @@ public class BusinessHeadquarter implements Headquarter {
        /**
         * Reference to contact person
         */
-       @JoinColumn (name = "headquarter_contact_employee_id", referencedColumnName = "employee_id")
-       @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.REFRESH)
-       private Employable headquarterContactEmployee;
+       @JoinColumn (name = "headquarter_contact_employee_id", referencedColumnName = "contact_id")
+       @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH)
+       private Contact headquarterContactEmployee;
 
        /**
         * Headquarter's country code
@@ -346,6 +346,8 @@ public class BusinessHeadquarter implements Headquarter {
                        return false;
                } else if (!Objects.equals(this.getHeadquarterCompanyName(), headquarter.getHeadquarterCompanyName())) {
                        return false;
+               } else if (!Objects.equals(this.getHeadquarterContactEmployee(), headquarter.getHeadquarterContactEmployee())) {
+                       return false;
                } else if (!Objects.equals(this.getHeadquarterCountry(), headquarter.getHeadquarterCountry())) {
                        return false;
                } else if (!Objects.equals(this.getHeadquarterEmailAddress(), headquarter.getHeadquarterEmailAddress())) {
@@ -396,12 +398,12 @@ public class BusinessHeadquarter implements Headquarter {
        }
 
        @Override
-       public Employable getHeadquarterContactEmployee () {
+       public Contact getHeadquarterContactEmployee () {
                return this.headquarterContactEmployee;
        }
 
        @Override
-       public void setHeadquarterContactEmployee (final Employable headquarterContactEmployee) {
+       public void setHeadquarterContactEmployee (final Contact headquarterContactEmployee) {
                this.headquarterContactEmployee = headquarterContactEmployee;
        }
 
@@ -577,6 +579,7 @@ public class BusinessHeadquarter implements Headquarter {
 
                hash = 47 * hash + Objects.hashCode(this.getHeadquarterCity());
                hash = 47 * hash + Objects.hashCode(this.getHeadquarterCompanyName());
+               hash = 47 * hash + Objects.hashCode(this.getHeadquarterContactEmployee());
                hash = 47 * hash + Objects.hashCode(this.getHeadquarterCountry());
                hash = 47 * hash + Objects.hashCode(this.getHeadquarterEmailAddress());
                hash = 47 * hash + Objects.hashCode(this.getHeadquarterFaxNumber());
index c9eff4ee29fc8a6caec9992b33a11bed6a15900d..19a02e067bfe6eb9dea9b6c62be690a983a674f2 100644 (file)
@@ -19,7 +19,7 @@ package org.mxchange.jcontactsbusiness.model.headquarter;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -230,18 +230,18 @@ public interface Headquarter extends Comparable<Headquarter>, Serializable {
        void setHeadquarterUserOwner (final User headquarterUserOwner);
 
        /**
-        * Getter for branch office owning employee
+        * Getter for branch office owning contact
         * <p>
-        * @return Owning employee
+        * @return Owning contact
         */
-       Employable getHeadquarterContactEmployee ();
+       Contact getHeadquarterContactEmployee ();
 
        /**
         * Setter for branch office contact person
         * <p>
         * @param branchContactEmployee Contact person
         */
-       void setHeadquarterContactEmployee (final Employable branchContactEmployee);
+       void setHeadquarterContactEmployee (final Contact branchContactEmployee);
 
        /**
         * Getter for opening times for this branch office