]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 24 Sep 2017 12:33:39 +0000 (14:33 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 24 Sep 2017 12:33:39 +0000 (14:33 +0200)
- branch offices may have an "owning employee" which is a personal who may own
  one or more branch offices with e.g. franchise supermarkets
- they may also have separate opening times depending on local laws

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java
src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java

index 4da8fd7a47b497aa940e348167a6eedbef893647..d17999728cd480435ba189393d275ba3152fdc63 100644 (file)
@@ -20,6 +20,7 @@ import java.io.Serializable;
 import java.util.Date;
 import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.model.opening_times.OpeningTimes;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -158,6 +159,34 @@ public interface BranchOffice extends Serializable {
         */
        void setBranchSuiteNumber (final Short branchSuiteNumber);
 
+       /**
+        * Getter for opening times for this branch office
+        * <p>
+        * @return Opening times
+        */
+       OpeningTimes getBranchOpeningTimes ();
+
+       /**
+        * Setter for opening times for this branch office
+        * <p>
+        * @param branchOpeningTimes Opening times
+        */
+       void setBranchOpeningTimes (final OpeningTimes branchOpeningTimes);
+
+       /**
+        * Getter for branch office owning employee
+        * <p>
+        * @return Owning employee
+        */
+       Employee getBranchOwnerEmployee ();
+
+       /**
+        * Setter for branch office owning employee
+        * <p>
+        * @param branchOwnerEmployee Owning employee
+        */
+       void setBranchOwnerEmployee (final Employee branchOwnerEmployee);
+
        /**
         * Getter for branch office's ZIP code
         * <p>
index d1b8dfc0318e47c4faf7d502b50da0fd4f95c8e8..3dfed1a7a32d530ffc006940d75d58537bc6e5fe 100644 (file)
@@ -38,6 +38,7 @@ import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.model.basicdata.CompanyBasicData;
 import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployee;
 import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.model.opening_times.OpeningTimes;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -86,14 +87,14 @@ public class CompanyBranchOffice implements BranchOffice {
        /**
         * Reference to contact person
         */
-       @JoinColumn (name = "branch_contact_employee_id")
+       @JoinColumn (name = "branch_contact_employee_id", referencedColumnName = "employee_id")
        @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.REFRESH)
        private Employee branchContactEmployee;
 
        /**
         * Branch office's country code
         */
-       @JoinColumn (name = "branch_country_id", nullable = false)
+       @JoinColumn (name = "branch_country_id", referencedColumnName = "country_id", nullable = false)
        @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
        private Country branchCountry;
 
@@ -114,7 +115,7 @@ public class CompanyBranchOffice implements BranchOffice {
        /**
         * Branch office's main fax number: +ccxxxxxxxxxx
         */
-       @JoinColumn (name = "branch_fax_number_id")
+       @JoinColumn (name = "branch_fax_number_id", referencedColumnName = "id_id")
        @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
        private DialableFaxNumber branchFaxNumber;
 
@@ -136,16 +137,32 @@ public class CompanyBranchOffice implements BranchOffice {
        /**
         * Branch office's main land-line number: +ccxxxxxxxxxx
         */
-       @JoinColumn (name = "branch_landline_number_id")
+       @JoinColumn (name = "branch_landline_number_id", referencedColumnName = "landline_id")
        @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
        private DialableLandLineNumber branchLandLineNumber;
 
        /**
         * Numer of this branch office
         */
-       @Column(name = "branch_number")
+       @Column (name = "branch_number")
        private Long branchNumber;
 
+       /**
+        * Opening times for this branch office
+        */
+       @JoinColumn (name = "branch_owner_employee_id", referencedColumnName = "opening_times_id")
+       @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.REFRESH)
+       private OpeningTimes branchOpeningTimes;
+
+       /**
+        * Reference to branch office owner (for example some franchise supermarkets
+        * will have an owning person (here generally referred as "employee") who
+        * will own one or more branch offices.
+        */
+       @JoinColumn (name = "branch_owner_employee_id", referencedColumnName = "employee_id")
+       @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.REFRESH)
+       private Employee branchOwnerEmployee;
+
        /**
         * Branch office's store (if multiple-store building)
         */
@@ -168,7 +185,7 @@ public class CompanyBranchOffice implements BranchOffice {
        /**
         * User owner instance
         */
-       @JoinColumn (name = "branch_user_id")
+       @JoinColumn (name = "branch_user_id", referencedColumnName = "user_id")
        @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
        private User branchUserOwner;
 
@@ -399,6 +416,26 @@ public class CompanyBranchOffice implements BranchOffice {
                this.branchNumber = branchNumber;
        }
 
+       @Override
+       public OpeningTimes getBranchOpeningTimes () {
+               return this.branchOpeningTimes;
+       }
+
+       @Override
+       public void setBranchOpeningTimes (final OpeningTimes branchOpeningTimes) {
+               this.branchOpeningTimes = branchOpeningTimes;
+       }
+
+       @Override
+       public Employee getBranchOwnerEmployee () {
+               return this.branchOwnerEmployee;
+       }
+
+       @Override
+       public void setBranchOwnerEmployee (final Employee branchOwnerEmployee) {
+               this.branchOwnerEmployee = branchOwnerEmployee;
+       }
+
        @Override
        public Short getBranchStore () {
                return this.branchStore;