From: Roland Haeder Date: Wed, 21 Oct 2015 10:20:16 +0000 (+0200) Subject: added missing headquarters entity relationship X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=40f8752fe340d86bee73860c5525a3cae5d2de61;p=jcontacts-business-core.git added missing headquarters entity relationship Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java index cd05191..9f6b162 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java @@ -35,6 +35,8 @@ import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice; import org.mxchange.jcontactsbusiness.department.CompanyDepartment; import org.mxchange.jcontactsbusiness.department.Department; +import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData; +import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; import org.mxchange.jcontactsbusiness.jobposition.EmployeePosition; import org.mxchange.jcontactsbusiness.jobposition.JobPosition; import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber; @@ -55,12 +57,19 @@ public class CompanyEmployee implements Employee, Comparable { private static final long serialVersionUID = 48_959_819_859_812_076L; /** - * Branch office the employee works at + * Branch office (if the employee works there) */ @JoinColumn (name = "employee_branch_id") @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) private BranchOffice employeeBranchOffice; + /** + * Head quarters id number (if the employee works there) + */ + @JoinColumn (name = "employee_branch_id") + @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL) + private HeadQuartersData employeeHeadquarter; + /** * Company the employee is working at */ @@ -188,6 +197,16 @@ public class CompanyEmployee implements Employee, Comparable { this.employeeEmailAddress = employeeEmailAddress; } + @Override + public HeadQuartersData getEmployeeHeadquarter () { + return this.employeeHeadquarter; + } + + @Override + public void setEmployeeHeadquarter (final HeadQuartersData employeeHeadquarter) { + this.employeeHeadquarter = employeeHeadquarter; + } + @Override public Long getEmployeeId () { return this.employeeId; diff --git a/src/org/mxchange/jcontactsbusiness/employee/Employee.java b/src/org/mxchange/jcontactsbusiness/employee/Employee.java index daccb1d..f669ced 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/Employee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/Employee.java @@ -21,6 +21,7 @@ import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontactsbusiness.BusinessContact; import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.department.Department; +import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; import org.mxchange.jcontactsbusiness.jobposition.JobPosition; import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; @@ -73,6 +74,20 @@ public interface Employee extends Serializable { */ void setEmployeeDepartment (final Department employeeDepartment); + /** + * Getter for employee's head quarters + *

+ * @return Employee's head quarters + */ + HeadQuartersData getEmployeeHeadquarter (); + + /** + * Getter for employee's head quarters + *

+ * @param employeeHeadquarter Employee's head quarters + */ + void setEmployeeHeadquarter (final HeadQuartersData employeeHeadquarter); + /** * Getter for employee's email address *

@@ -172,8 +187,8 @@ public interface Employee extends Serializable { void setEmployeePosition (final JobPosition employeePosition); @Override - boolean equals (final Object object); + boolean equals (final Object object); @Override - int hashCode (); + int hashCode (); }