From: Roland Haeder Date: Wed, 21 Oct 2015 12:36:13 +0000 (+0200) Subject: added connection from department to headquarters and branch offices X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4455581acc87a3a41b911a84b266778c51876bc6;p=jcontacts-business-core.git added connection from department to headquarters and branch offices Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java index 624a3e9..5eddcca 100644 --- a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java @@ -31,8 +31,12 @@ import javax.persistence.OneToOne; import javax.persistence.Table; import org.mxchange.jcontactsbusiness.BusinessContact; import org.mxchange.jcontactsbusiness.CompanyContact; +import org.mxchange.jcontactsbusiness.branch.BranchOffice; +import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice; import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; import org.mxchange.jcontactsbusiness.employee.Employee; +import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData; +import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; /** * A POJO for company departments @@ -55,6 +59,20 @@ public class CompanyDepartment implements Department, Comparable { @ManyToOne (targetEntity = CompanyContact.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER) private BusinessContact departmentCompany; + /** + * Where this department is located + */ + @JoinColumn (name = "department_branch_id") + @ManyToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) + private BranchOffice departmentBranchOffice; + + /** + * Where this department is located + */ + @JoinColumn (name = "department_headquarters_id") + @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL) + private HeadQuartersData departentHeadquarters; + /** * Id number */ @@ -101,6 +119,26 @@ public class CompanyDepartment implements Department, Comparable { return true; } + @Override + public HeadQuartersData getDepartentHeadquarters () { + return this.departentHeadquarters; + } + + @Override + public void setDepartentHeadquarters (final HeadQuartersData departentHeadquarters) { + this.departentHeadquarters = departentHeadquarters; + } + + @Override + public BranchOffice getDepartmentBranchOffice () { + return this.departmentBranchOffice; + } + + @Override + public void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice) { + this.departmentBranchOffice = departmentBranchOffice; + } + @Override public BusinessContact getDepartmentCompany () { return this.departmentCompany; diff --git a/src/org/mxchange/jcontactsbusiness/department/Department.java b/src/org/mxchange/jcontactsbusiness/department/Department.java index 456b697..4e40ed9 100644 --- a/src/org/mxchange/jcontactsbusiness/department/Department.java +++ b/src/org/mxchange/jcontactsbusiness/department/Department.java @@ -18,7 +18,9 @@ package org.mxchange.jcontactsbusiness.department; import java.io.Serializable; import org.mxchange.jcontactsbusiness.BusinessContact; +import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.employee.Employee; +import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; /** * A POJI for company departments @@ -41,6 +43,34 @@ public interface Department extends Serializable { */ void setDepartmentCompany (final BusinessContact departmentCompany); + /** + * Getter for connection to company headquarters + *

+ * @return Connection to company headquarters + */ + HeadQuartersData getDepartentHeadquarters (); + + /** + * Setter for connection to company headquarters + *

+ * @param departentHeadquarters Connection to company headquarters + */ + void setDepartentHeadquarters (final HeadQuartersData departentHeadquarters); + + /** + * Getter for connection to company branch office + *

+ * @return Connection to company branch office + */ + BranchOffice getDepartmentBranchOffice (); + + /** + * Setter for connection to company branch office + *

+ * @param departmentBranchOffice Connection to company branch office + */ + void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice); + /** * Getter for department id *

@@ -84,8 +114,8 @@ public interface Department extends Serializable { void setDepartmentName (final String departmentName); @Override - boolean equals (final Object object); + boolean equals (final Object object); @Override - int hashCode (); + int hashCode (); } diff --git a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java index 9f6b162..05b946b 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java @@ -66,7 +66,7 @@ public class CompanyEmployee implements Employee, Comparable { /** * Head quarters id number (if the employee works there) */ - @JoinColumn (name = "employee_branch_id") + @JoinColumn (name = "employee_headquarters_id") @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL) private HeadQuartersData employeeHeadquarter;