]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 1 Nov 2017 18:43:08 +0000 (19:43 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 1 Nov 2017 20:10:57 +0000 (21:10 +0100)
- headquarter's "owning" user is now optional
- headquarters may have contact persons, too
- added opening times for headquarters

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

index 0e09c86eff6e93daa5fc6d5a4e1a8e94c3e29253..9f9fa146dae93ad979cb971640cc57236a14c903 100644 (file)
@@ -19,13 +19,13 @@ package org.mxchange.jcontactsbusiness.model.branchoffice;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 
 /**
  * A POJI for branch offices
index 23e4114c9ac1c466e2054b3e480f9d663cc3fdca..8c23a74e4d0e72e355b2e7215619ad9cb064485e 100644 (file)
@@ -37,6 +37,7 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
@@ -50,7 +51,6 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 
 /**
  * A POJO for company branch offices
index 26554ea9d1d3653086d95955ff370ac2e427582e..1ce60481f840333e1805a85bba7d2b52527f99cf 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jcontactsbusiness.model.headquarters;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
@@ -26,11 +27,17 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -41,7 +48,7 @@ import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 
 /**
- * A POJO for company headquarts data
+ * A POJO for company headquarters data
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
@@ -63,6 +70,13 @@ public class BusinessHeadquartersData implements HeadquartersData {
        @Column (name = "headquarters_city", length = 100, nullable = false)
        private String headquartersCity;
 
+       /**
+        * Reference to contact person
+        */
+       @JoinColumn (name = "headquarters_contact_employee_id", referencedColumnName = "employee_id")
+       @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.REFRESH)
+       private Employable headquartersContactEmployee;
+
        /**
         * Headquarter's country code
         */
@@ -100,6 +114,13 @@ public class BusinessHeadquartersData implements HeadquartersData {
        @Column (name = "headquarters_id", nullable = false, updatable = false)
        private Long headquartersId;
 
+       /**
+        * Opening times for this branch office
+        */
+       @JoinTable (name = "headquarters_opening_times", joinColumns = @JoinColumn (name = "headquarters_opening_id", referencedColumnName = "branch_id"), inverseJoinColumns = @JoinColumn (name = "opening_headquarters_id", referencedColumnName = "opening_times_id"))
+       @ManyToMany (targetEntity = BusinessOpeningTime.class, cascade = CascadeType.ALL)
+       private List<OpeningTime> headquartersOpeningTimes;
+
        /**
         * Headquarters' phone number
         */
@@ -129,8 +150,8 @@ public class BusinessHeadquartersData implements HeadquartersData {
        /**
         * User owner instance
         */
-       @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+       @JoinColumn (name = "headquarters_user_id")
+       @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
        private User headquartersUserOwner;
 
        /**
@@ -181,6 +202,16 @@ public class BusinessHeadquartersData implements HeadquartersData {
                this.headquartersCity = headquartersCity;
        }
 
+       @Override
+       public Employable getHeadquartersContactEmployee () {
+               return this.headquartersContactEmployee;
+       }
+
+       @Override
+       public void setHeadquartersContactEmployee (final Employable headquartersContactEmployee) {
+               this.headquartersContactEmployee = headquartersContactEmployee;
+       }
+
        @Override
        public Country getHeadquartersCountry () {
                return this.headquartersCountry;
@@ -233,6 +264,18 @@ public class BusinessHeadquartersData implements HeadquartersData {
                this.headquartersId = headquartersId;
        }
 
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<OpeningTime> getHeadquartersOpeningTimes () {
+               return this.headquartersOpeningTimes;
+       }
+
+       @Override
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setHeadquartersOpeningTimes (final List<OpeningTime> headquartersOpeningTimes) {
+               this.headquartersOpeningTimes = headquartersOpeningTimes;
+       }
+
        @Override
        public DialableLandLineNumber getHeadquartersPhoneNumber () {
                return this.headquartersPhoneNumber;
index e87b0d451dc232a7c22a265426e04b4792f3dbef..42fecefc18148dc504fef90a558c470c8cef1432 100644 (file)
@@ -18,6 +18,9 @@ package org.mxchange.jcontactsbusiness.model.headquarters;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -184,6 +187,34 @@ public interface HeadquartersData extends Serializable {
         */
        void setHeadquartersUserOwner (final User headquartersUserOwner);
 
+       /**
+        * Getter for branch office owning employee
+        * <p>
+        * @return Owning employee
+        */
+       Employable getHeadquartersContactEmployee ();
+
+       /**
+        * Setter for branch office contact person
+        * <p>
+        * @param branchContactEmployee Contact person
+        */
+       void setHeadquartersContactEmployee (final Employable branchContactEmployee);
+
+       /**
+        * Getter for opening times for this branch office
+        * <p>
+        * @return Opening times
+        */
+       List<OpeningTime> getHeadquartersOpeningTimes ();
+
+       /**
+        * Setter for opening times for this branch office
+        * <p>
+        * @param branchOpeningTimes Opening times
+        */
+       void setHeadquartersOpeningTimes (final List<OpeningTime> branchOpeningTimes);
+
        /**
         * Getter for timestamp when this entry has been created
         * <p>