From: Roland Häder Date: Sun, 24 Sep 2017 12:33:39 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=69c7ebe52347a0f63e71d70da47d0f19d7358b59;p=jcontacts-business-core.git Continued: - 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 --- diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java index 4da8fd7..d179997 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java @@ -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 + *

+ * @return Opening times + */ + OpeningTimes getBranchOpeningTimes (); + + /** + * Setter for opening times for this branch office + *

+ * @param branchOpeningTimes Opening times + */ + void setBranchOpeningTimes (final OpeningTimes branchOpeningTimes); + + /** + * Getter for branch office owning employee + *

+ * @return Owning employee + */ + Employee getBranchOwnerEmployee (); + + /** + * Setter for branch office owning employee + *

+ * @param branchOwnerEmployee Owning employee + */ + void setBranchOwnerEmployee (final Employee branchOwnerEmployee); + /** * Getter for branch office's ZIP code *

diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java index d1b8dfc..3dfed1a 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java @@ -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;