From: Roland Häder Date: Wed, 8 Nov 2017 18:44:14 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c576d7e3bd1b86d0e4c29e39f062b35ae23f59c2;p=jcontacts-business-core.git Continued: - added headquarterCompanyName as the name may varry from branch offices Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicData.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicData.java index 9b00467..3be442a 100644 --- a/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicData.java +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicData.java @@ -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 diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java b/src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java index 2189b2b..f6a35e1 100644 --- a/src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java +++ b/src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java @@ -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 headquarterOpeningTimes; @@ -196,18 +205,25 @@ public class BusinessHeadquarter implements Headquarter { /** * Constructor with all required fields *

+ * @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; diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarter.java b/src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarter.java index 9d12d60..98a6155 100644 --- a/src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarter.java +++ b/src/org/mxchange/jcontactsbusiness/model/headquarter/Headquarter.java @@ -47,6 +47,20 @@ public interface Headquarter extends Serializable { */ void setHeadquarterCity (final String headquarterCity); + /** + * Getter for headquarter's company name + *

+ * @return Headquarter's company name + */ + String getHeadquarterCompanyName (); + + /** + * Setter for headquarter's company name + *

+ * @param headquarterCompanyName Headquarter's company name + */ + void setHeadquarterCompanyName (final String headquarterCompanyName); + /** * Getter for headquarter's country code *