From 40f8752fe340d86bee73860c5525a3cae5d2de61 Mon Sep 17 00:00:00 2001 From: Roland Haeder <roland@mxchange.org> Date: Wed, 21 Oct 2015 12:20:16 +0200 Subject: [PATCH] =?utf8?q?added=20missing=20headquarters=20entity=20relati?= =?utf8?q?onship=20Signed-off-by:Roland=20H=C3=A4der=20<roland@mxchange.or?= =?utf8?q?g>?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../employee/CompanyEmployee.java | 21 ++++++++++++++++++- .../jcontactsbusiness/employee/Employee.java | 19 +++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) 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<Employee> { 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<Employee> { 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 + * <p> + * @return Employee's head quarters + */ + HeadQuartersData getEmployeeHeadquarter (); + + /** + * Getter for employee's head quarters + * <p> + * @param employeeHeadquarter Employee's head quarters + */ + void setEmployeeHeadquarter (final HeadQuartersData employeeHeadquarter); + /** * Getter for employee's email address * <p> @@ -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 (); } -- 2.39.5