]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 8 Nov 2017 18:44:14 +0000 (19:44 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 8 Nov 2017 18:44:14 +0000 (19:44 +0100)
- added headquarterCompanyName as the name may varry from branch offices

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/basicdata/BasicData.java
src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java
src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarter.java

index 9b004674c040f60d531c33ec73d1ee5d3acb7a15..3be442aab5a6c5d2044aad0da3e08973de2c718d 100644 (file)
@@ -21,11 +21,11 @@ import java.util.Date;
 import java.util.List;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
+import org.mxchange.jcontactsbusiness.model.logo.Logo;
 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.logo.Logo;
-import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
 
 /**
  * A POJI for business contact classes
index 2189b2bfedcae06144ccec4ff16a53bc07d576a3..f6a35e1517df3a480eb6b2ed3bac41e22fdd65e6 100644 (file)
@@ -78,6 +78,13 @@ public class BusinessHeadquarter implements Headquarter {
        @Column (name = "headquarter_city", length = 100, nullable = false)
        private String headquarterCity;
 
+       /**
+        * Headquarter's company name
+        */
+       @Basic (optional = false)
+       @Column (name = "headquarter_company_name", length = 100, nullable = false, unique = true)
+       private String headquarterCompanyName;
+
        /**
         * Reference to contact person
         */
@@ -150,7 +157,9 @@ public class BusinessHeadquarter implements Headquarter {
        /**
         * Opening times for this branch office
         */
-       @JoinTable (name = "headquarter_opening_times", joinColumns =@JoinColumn (name = "headquarter_opening_id", referencedColumnName = "headquarter_id"), inverseJoinColumns = @JoinColumn (name = "opening_headquarter_id", referencedColumnName = "opening_times_id"))
+       @JoinTable (name = "headquarter_opening_times", joinColumns =
+                                                                                                       @JoinColumn (name = "headquarter_opening_id", referencedColumnName = "headquarter_id"), inverseJoinColumns =
+                                                                                                                                                                                                                                                                                       @JoinColumn (name = "opening_headquarter_id", referencedColumnName = "opening_times_id"))
        @ManyToMany (targetEntity = BusinessOpeningTime.class, cascade = CascadeType.ALL)
        private List<OpeningTime> headquarterOpeningTimes;
 
@@ -196,18 +205,25 @@ public class BusinessHeadquarter implements Headquarter {
        /**
         * Constructor with all required fields
         * <p>
+        * @param headquarterCompanyName Headquarter's company name
         * @param headquarterCity        City
         * @param headquarterCountry     Country
         * @param headquarterStreet      Street name
         * @param headquarterZipCode     ZIP code
         * @param headquarterHouseNumber House number
         */
-       public BusinessHeadquarter (final String headquarterCity, final Country headquarterCountry, final String headquarterStreet, final Integer headquarterZipCode, final Short headquarterHouseNumber) {
+       public BusinessHeadquarter (final String headquarterCompanyName, final String headquarterCity, final Country headquarterCountry, final String headquarterStreet, final Integer headquarterZipCode, final Short headquarterHouseNumber) {
                // Call other constructor first
                this();
 
-               // Validate parameters
-               if (null == headquarterCity) {
+               // First, validate all parameter
+               if (headquarterCompanyName == null) {
+                       // Is null
+                       throw new NullPointerException("headquarterCompanyName is null"); //NOI18N
+               } else if (headquarterCompanyName.isEmpty()) {
+                       // Is null
+                       throw new IllegalArgumentException("headquarterCompanyName is empty"); //NOI18N
+               } else if (null == headquarterCity) {
                        // Throw NPE
                        throw new NullPointerException("headquarterCity is null"); //NOI18N
                } else if (headquarterCity.isEmpty()) {
@@ -243,6 +259,7 @@ public class BusinessHeadquarter implements Headquarter {
                }
 
                // Set all fields
+               this.headquarterCompanyName = headquarterCompanyName;
                this.headquarterCity = headquarterCity;
                this.headquarterCountry = headquarterCountry;
                this.headquarterHouseNumber = headquarterHouseNumber;
@@ -293,6 +310,16 @@ public class BusinessHeadquarter implements Headquarter {
                this.headquarterCity = headquarterCity;
        }
 
+       @Override
+       public String getHeadquarterCompanyName () {
+               return this.headquarterCompanyName;
+       }
+
+       @Override
+       public void setHeadquarterCompanyName (final String headquarterCompanyName) {
+               this.headquarterCompanyName = headquarterCompanyName;
+       }
+
        @Override
        public Employable getHeadquarterContactEmployee () {
                return this.headquarterContactEmployee;
index 9d12d60916360f3e51014c5175f1801286a064aa..98a615552a7040355d904eb494ae0eb0e9fbedae 100644 (file)
@@ -47,6 +47,20 @@ public interface Headquarter extends Serializable {
         */
        void setHeadquarterCity (final String headquarterCity);
 
+       /**
+        * Getter for headquarter's company name
+        * <p>
+        * @return Headquarter's company name
+        */
+       String getHeadquarterCompanyName ();
+
+       /**
+        * Setter for headquarter's company name
+        * <p>
+        * @param headquarterCompanyName Headquarter's company name
+        */
+       void setHeadquarterCompanyName (final String headquarterCompanyName);
+
        /**
         * Getter for headquarter's country code
         * <p>