]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
added connection from department to headquarters and branch offices
authorRoland Haeder <roland@mxchange.org>
Wed, 21 Oct 2015 12:36:13 +0000 (14:36 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 21 Oct 2015 12:42:46 +0000 (14:42 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java
src/org/mxchange/jcontactsbusiness/department/Department.java
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java

index 624a3e9eb5d558b7f120f9a1604be7b46a0cf8a3..5eddcca9369a4df3a7ea5b662b8ca5958b5e853a 100644 (file)
@@ -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<Department> {
        @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<Department> {
                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;
index 456b697faa64f88edb10a4622a49a6b463ee6638..4e40ed956d5258f81bca06d6be92b7c8a995a785 100644 (file)
@@ -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
+        * <p>
+        * @return Connection to company headquarters
+        */
+       HeadQuartersData getDepartentHeadquarters ();
+
+       /**
+        * Setter for connection to company headquarters
+        * <p>
+        * @param departentHeadquarters Connection to company headquarters
+        */
+       void setDepartentHeadquarters (final HeadQuartersData departentHeadquarters);
+
+       /**
+        * Getter for connection to company branch office
+        * <p>
+        * @return Connection to company branch office
+        */
+       BranchOffice getDepartmentBranchOffice ();
+
+       /**
+        * Setter for connection to company branch office
+        * <p>
+        * @param departmentBranchOffice Connection to company branch office
+        */
+       void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice);
+
        /**
         * Getter for department id
         * <p>
@@ -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 ();
 }
index 9f6b162d136d3548467e2a8e7867f48e5b548f96..05b946b9ea06e868cb9f3280016879de1fcf5aaa 100644 (file)
@@ -66,7 +66,7 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        /**
         * 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;