import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
-import org.mxchange.jcontactsbusiness.branch.BranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.employee.Employee;
-import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
import org.mxchange.jcontactsbusiness.logo.BusinessLogo;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
* <p>
* @return Business contact id
*/
- Long getBusinessDataId ();
+ Long getCompanyDataId ();
/**
* Setter for business contact id
* <p>
* @param businessContactId Business contact id
*/
- void setBusinessDataId (final Long businessContactId);
+ void setCompanyDataId (final Long businessContactId);
/**
* Getter for company founder
* <p>
* @return Headquarters data
*/
- HeadQuartersData getCompanyHeadQuartersData ();
+ HeadquartersData getCompanyHeadQuartersData ();
/**
* Setter for headquarters data
* <p>
* @param headQuartersData Headquarters data
*/
- void setCompanyHeadQuartersData (final HeadQuartersData headQuartersData);
+ void setCompanyHeadQuartersData (final HeadquartersData headQuartersData);
/**
* Getter for user owner instance
* <p>
* @return User owner instance
*/
- User getContactCompanyUserOwner ();
+ User getCompanyUserOwner ();
/**
* Setter for user owner instance
* <p>
* @param contactUserOwner User owner instance
*/
- void setContactCompanyUserOwner (final User contactUserOwner);
+ void setCompanyUserOwner (final User contactUserOwner);
/**
* Getter for timestamp when this entry has been created
* <p>
* @return Timestamp when this entry has been created
*/
- Calendar getContactCreated ();
+ Calendar getCompanyCreated ();
/**
* Setter for timestamp when this entry has been created
* <p>
* @param contactCreated Timestamp when this entry has been created
*/
- void setContactCreated (final Calendar contactCreated);
+ void setCompanyCreated (final Calendar contactCreated);
/**
* Getter for comments
* <p>
* @return Phone numbers
*/
- DialableLandLineNumber getCompanyPhoneNumber ();
+ DialableLandLineNumber getCompanyLandLineNumber ();
/**
* Setter for list of phone number
* <p>
* @param companyPhoneNumber Phone numbers
*/
- void setCompanyPhoneNumber (final DialableLandLineNumber companyPhoneNumber);
+ void setCompanyLandLineNumber (final DialableLandLineNumber companyPhoneNumber);
/**
* Getter for tax number
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
-import org.mxchange.jcontactsbusiness.branch.BranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
import org.mxchange.jcontactsbusiness.employee.Employee;
-import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData;
-import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
+import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersData;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
import org.mxchange.jcontactsbusiness.logo.BusinessLogo;
import org.mxchange.jcontactsbusiness.logo.CompanyLogo;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
@Table (name = "company_basic_data")
@NamedQueries (
{
- @NamedQuery (name = "AllBusinessData", query = "SELECT b FROM company_basic_data AS b ORDER BY b.businessDataId"),
- @NamedQuery (name = "SearchBusinessDataById", query = "SELECT b FROM company_basic_data AS b WHERE b.businessDataId = :businessDataId")
+ @NamedQuery (name = "AllBusinessData", query = "SELECT b FROM company_basic_data AS b ORDER BY b.companyDataId"),
+ @NamedQuery (name = "SearchBusinessDataById", query = "SELECT b FROM company_basic_data AS b WHERE b.companyDataId = :companyDataId")
}
)
@SuppressWarnings ("PersistenceUnitPresent")
@Transient
private List<BranchOffice> brancheOffices;
- /**
- * Id number
- */
- @Id
- @Column (name = "business_data_id", nullable = false, updatable = false)
- @GeneratedValue (strategy = GenerationType.IDENTITY)
- private Long businessDataId;
-
/**
* Comments (any)
*/
@OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
private Employee companyContactEmployee;
+ /**
+ * Timestamp when this entry has been created
+ */
+ @Basic (optional = false)
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "company_entry_created", nullable = false, updatable = false)
+ private Calendar companyCreated;
+
+ /**
+ * Id number
+ */
+ @Id
+ @Column (name = "company_data_id", nullable = false, updatable = false)
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ private Long companyDataId;
+
/**
* Company's main email address (example: info@company.com)
*/
@OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
private Employee companyFounder;
+ /**
+ * Reference to headquarters data
+ */
+ @JoinColumn (name = "company_headquarters_data_id")
+ @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL)
+ private HeadquartersData companyHeadQuartersData;
+
+ /**
+ * Company's main phone number: +ccxxxxxxxxxx
+ */
+ @JoinColumn (name = "company_landline_number_id")
+ @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
+ private DialableLandLineNumber companyLandLineNumber;
+
/**
* Id number of company logo
*/
* Company name
*/
@Basic (optional = false)
- @Column (name = "company_name", length = 100, nullable = false)
+ @Column (name = "company_name", length = 100, nullable = false, unique = true)
private String companyName;
- /**
- * Company's main phone number: +ccxxxxxxxxxx
- */
- @JoinColumn (name = "company_phone_number_id")
- @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
- private DialableLandLineNumber companyPhoneNumber;
-
/**
* Tax number
*/
@Column (name = "company_tax_number", length = 30)
private String companyTaxNumber;
+ /**
+ * User owner instance
+ */
+ @JoinColumn (name = "company_owner_user_id")
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
+ private User companyUserOwner;
+
/**
* URL for company website
*/
private String companyWebsiteUrl;
/**
- * User owner instance
+ * Default constructor, required for JPA
*/
- @JoinColumn (name = "company_owner_user_id")
- @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
- private User contactCompanyUserOwner;
+ public CompanyBasicData () {
+ }
/**
- * Timestamp when this entry has been created
+ * Constructor with company name
+ * <p>
+ * @param companyName Company name
*/
- @Basic (optional = false)
- @Temporal (TemporalType.TIMESTAMP)
- @Column (name = "company_entry_created", nullable = false, updatable = false)
- private Calendar contactCreated;
+ public CompanyBasicData (final String companyName) {
+ // First, validate all parameter
+ if (companyName == null) {
+ // Is null
+ throw new NullPointerException("companyName is null"); //NOI18N
+ } else if (companyName.isEmpty()) {
+ // Is null
+ throw new IllegalArgumentException("companyName is empty"); //NOI18N
+ }
- /**
- * Reference to headquarters data
- */
- @JoinColumn (name = "company_headquarters_data_id")
- @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL)
- private HeadQuartersData companyHeadQuartersData;
+ // Set company name
+ this.companyName = companyName;
+ }
@Override
public boolean equals (final Object object) {
final BusinessBasicData other = (BusinessBasicData) object;
- if (!Objects.equals(this.getBusinessDataId(), other.getBusinessDataId())) {
+ if (!Objects.equals(this.getCompanyDataId(), other.getCompanyDataId())) {
return false;
} else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) {
return false;
this.brancheOffices = brancheOffices;
}
- @Override
- public Long getBusinessDataId () {
- return this.businessDataId;
- }
-
- @Override
- public void setBusinessDataId (final Long businessDataId) {
- this.businessDataId = businessDataId;
- }
-
@Override
public String getCompanyComments () {
return this.companyComments;
this.companyContactEmployee = companyContactEmployee;
}
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Calendar getCompanyCreated () {
+ return this.companyCreated;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setCompanyCreated (final Calendar companyCreated) {
+ this.companyCreated = companyCreated;
+ }
+
+ @Override
+ public Long getCompanyDataId () {
+ return this.companyDataId;
+ }
+
+ @Override
+ public void setCompanyDataId (final Long companyDataId) {
+ this.companyDataId = companyDataId;
+ }
+
@Override
public String getCompanyEmailAddress () {
return this.companyEmailAddress;
}
@Override
- public BusinessLogo getCompanyLogo () {
- return this.companyLogo;
- }
-
- @Override
- public void setCompanyLogo (final BusinessLogo companyLogoId) {
- this.companyLogo = companyLogoId;
- }
-
- @Override
- public String getCompanyName () {
- return this.companyName;
+ public HeadquartersData getCompanyHeadQuartersData () {
+ return this.companyHeadQuartersData;
}
@Override
- public void setCompanyName (final String companyName) {
- this.companyName = companyName;
+ public void setCompanyHeadQuartersData (final HeadquartersData companyHeadQuartersData) {
+ this.companyHeadQuartersData = companyHeadQuartersData;
}
@Override
- public DialableLandLineNumber getCompanyPhoneNumber () {
- return this.companyPhoneNumber;
+ public DialableLandLineNumber getCompanyLandLineNumber () {
+ return this.companyLandLineNumber;
}
@Override
- public void setCompanyPhoneNumber (final DialableLandLineNumber companyPhoneNumber) {
- this.companyPhoneNumber = companyPhoneNumber;
+ public void setCompanyLandLineNumber (final DialableLandLineNumber companyLandLineNumber) {
+ this.companyLandLineNumber = companyLandLineNumber;
}
@Override
- public String getCompanyTaxNumber () {
- return this.companyTaxNumber;
+ public BusinessLogo getCompanyLogo () {
+ return this.companyLogo;
}
@Override
- public void setCompanyTaxNumber (final String companyTaxNumber) {
- this.companyTaxNumber = companyTaxNumber;
+ public void setCompanyLogo (final BusinessLogo companyLogoId) {
+ this.companyLogo = companyLogoId;
}
@Override
- public String getCompanyWebsiteUrl () {
- return this.companyWebsiteUrl;
+ public String getCompanyName () {
+ return this.companyName;
}
@Override
- public void setCompanyWebsiteUrl (final String companyWebsiteUrl) {
- this.companyWebsiteUrl = companyWebsiteUrl;
+ public void setCompanyName (final String companyName) {
+ this.companyName = companyName;
}
@Override
- public User getContactCompanyUserOwner () {
- return this.contactCompanyUserOwner;
+ public String getCompanyTaxNumber () {
+ return this.companyTaxNumber;
}
@Override
- public void setContactCompanyUserOwner (final User contactCompanyUserOwner) {
- this.contactCompanyUserOwner = contactCompanyUserOwner;
+ public void setCompanyTaxNumber (final String companyTaxNumber) {
+ this.companyTaxNumber = companyTaxNumber;
}
@Override
- @SuppressWarnings ("ReturnOfDateField")
- public Calendar getContactCreated () {
- return this.contactCreated;
+ public User getCompanyUserOwner () {
+ return this.companyUserOwner;
}
@Override
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setContactCreated (final Calendar contactCreated) {
- this.contactCreated = contactCreated;
+ public void setCompanyUserOwner (final User companyUserOwner) {
+ this.companyUserOwner = companyUserOwner;
}
@Override
- public HeadQuartersData getCompanyHeadQuartersData () {
- return this.companyHeadQuartersData;
+ public String getCompanyWebsiteUrl () {
+ return this.companyWebsiteUrl;
}
@Override
- public void setCompanyHeadQuartersData (final HeadQuartersData companyHeadQuartersData) {
- this.companyHeadQuartersData = companyHeadQuartersData;
+ public void setCompanyWebsiteUrl (final String companyWebsiteUrl) {
+ this.companyWebsiteUrl = companyWebsiteUrl;
}
@Override
public int hashCode () {
int hash = 3;
- hash = 37 * hash + Objects.hashCode(this.getBusinessDataId());
+ hash = 37 * hash + Objects.hashCode(this.getCompanyDataId());
hash = 37 * hash + Objects.hashCode(this.getCompanyName());
hash = 37 * hash + Objects.hashCode(this.getCompanyHeadQuartersData());
hash = 37 * hash + Objects.hashCode(this.getCompanyContactEmployee());
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.branch;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
-
-/**
- * A POJI for branch offices
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface BranchOffice extends Serializable {
-
- /**
- * Getter for branch office's city name
- * <p>
- * @return Branch office's city name
- */
- String getBranchCity ();
-
- /**
- * Setter for branch office's city name
- * <p>
- * @param branchCity Branch office's city name
- */
- void setBranchCity (final String branchCity);
-
- /**
- * Getter for branch office's email address
- * <p>
- * @return Branch office's email address
- */
- String getBranchEmailAddress ();
-
- /**
- * Setter for branch office's email address
- * <p>
- * @param branchEmailAddress Branch office's email address
- */
- void setBranchEmailAddress (final String branchEmailAddress);
-
- /**
- * Getter for branch office's fax number
- * <p>
- * @return Branch office's fax number
- */
- DialableFaxNumber getBranchFaxNumber ();
-
- /**
- * Setter for branch office's fax number
- * <p>
- * @param branchFaxNumber Branch office's fax number
- */
- void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber);
-
- /**
- * Getter for branch office's house number
- * <p>
- * @return Branch office's house number
- */
- Short getBranchHouseNumber ();
-
- /**
- * Setter for branch office's house number
- * <p>
- * @param branchHouseNumber Branch office's house number
- */
- void setBranchHouseNumber (final Short branchHouseNumber);
-
- /**
- * Getter for branch office's phone number
- * <p>
- * @return Branch office's phone number
- */
- DialableLandLineNumber getBranchPhoneNumber ();
-
- /**
- * Setter for branch office's phone number
- * <p>
- * @param branchPhoneNumber Branch office's phone number
- */
- void setBranchPhoneNumber (final DialableLandLineNumber branchPhoneNumber);
-
- /**
- * Getter for branch office's store
- * <p>
- * @return Branch office's store
- */
- Short getBranchStore ();
-
- /**
- * Setter for branch office's store
- * <p>
- * @param branchStore Branch office's store
- */
- void setBranchStore (final Short branchStore);
-
- /**
- * Getter for branch office's street name
- * <p>
- * @return Branch office's street name
- */
- String getBranchStreet ();
-
- /**
- * Setter for branch office's street name
- * <p>
- * @param branchStreet Branch office's street name
- */
- void setBranchStreet (final String branchStreet);
-
- /**
- * Getter for branch office's suite number
- * <p>
- * @return Branch office's suite number
- */
- Short getBranchSuiteNumber ();
-
- /**
- * Setter for branch office's suite number
- * <p>
- * @param branchSuiteNumber Branch office's suite number
- */
- void setBranchSuiteNumber (final Short branchSuiteNumber);
-
- /**
- * Getter for branch office's ZIP code
- * <p>
- * @return Branch office's ZIP code
- */
- Integer getBranchZipCode ();
-
- /**
- * Setter for branch office's ZIP code
- * <p>
- * @param branchZipCode Branch office's ZIP code
- */
- void setBranchZipCode (final Integer branchZipCode);
-
- /**
- * Getter for branch office's id number
- * <p>
- * @return Branch office's id number
- */
- Long getBranchId ();
-
- /**
- * Setter for branch office's id number
- * <p>
- * @param branchId Branch office's id number
- */
- void setBranchId (final Long branchId);
-
- /**
- * Getter for branch office's country
- * <p>
- * @return Branch office's country
- */
- Country getBranchCountry ();
-
- /**
- * Setter for branch office's country
- * <p>
- * @param branchCountryCode Branch office's country
- */
- void setBranchCountry (final Country branchCountryCode);
-
- /**
- * Getter for branch office's company
- * <p>
- * @return Branch office's company
- */
- BusinessBasicData getBranchCompanyContact ();
-
- /**
- * Setter for branch office's company
- * <p>
- * @param branchCompanyContact Branch office's company
- */
- void setBranchCompanyContact (final BusinessBasicData branchCompanyContact);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getBranchUserOwner ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param branchUserOwner User owner instance
- */
- void setBranchUserOwner (final User branchUserOwner);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getBranchCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param branchCreated Timestamp when this entry has been created
- */
- void setBranchCreated (final Calendar branchCreated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.branch;
-
-import java.util.Calendar;
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
-import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jcountry.data.CountryData;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jusercore.model.user.LoginUser;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A POJO for company branch offices
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "company_branch_offices")
-@Table (name = "company_branch_offices")
-@SuppressWarnings ("PersistenceUnitPresent")
-public class CompanyBranchOffice implements BranchOffice {
-
- /**
- * Serial number
- */
- @Transient
- private static final long serialVersionUID = 47_957_817_276_871_852L;
-
- /**
- * Branch office's city name
- */
- @Basic (optional = false)
- @Column (name = "branch_city", length = 100, nullable = false)
- private String branchCity;
-
- /**
- * Company that has this branch office
- */
- @JoinColumn (name = "branch_company_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = CompanyBasicData.class, optional = false, cascade = CascadeType.ALL)
- private BusinessBasicData branchCompanyContact;
-
- /**
- * Branch office's country code
- */
- @JoinColumn (name = "branch_country_id", nullable = false)
- @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
- private Country branchCountry;
-
- /**
- * Timestamp when this entry has been created
- */
- @Basic (optional = false)
- @Temporal (TemporalType.TIMESTAMP)
- @Column (name = "branch_entry_created", nullable = false, updatable = false)
- private Calendar branchCreated;
-
- /**
- * Branch office's main email address (example: branch-name@company.com)
- */
- @Column (name = "branch_email_address", length = 100)
- private String branchEmailAddress;
-
- /**
- * Branch office's main fax number: +ccxxxxxxxxxx
- */
- @JoinColumn (name = "branch_fax_number_id")
- @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
- private DialableFaxNumber branchFaxNumber;
-
- /**
- * Branch office's house number
- */
- @Basic (optional = false)
- @Column (name = "branch_house_number", length = 3, nullable = false)
- private Short branchHouseNumber;
-
- /**
- * Id number
- */
- @Id
- @GeneratedValue (strategy = GenerationType.IDENTITY)
- @Column (name = "branch_id", nullable = false, updatable = false)
- private Long branchId;
-
- /**
- * Branch office's main phone number: +ccxxxxxxxxxx
- */
- @JoinColumn (name = "branch_phone_number_id")
- @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
- private DialableLandLineNumber branchPhoneNumber;
-
- /**
- * Branch office's store (if multiple-store building)
- */
- @Column (name = "branch_store", length = 3)
- private Short branchStore;
-
- /**
- * Branch office's street name
- */
- @Basic (optional = false)
- @Column (name = "branch_street", length = 100, nullable = false)
- private String branchStreet;
-
- /**
- * Branch office's suite number (if applyable)
- */
- @Column (name = "branch_suite_number", length = 4)
- private Short branchSuiteNumber;
-
- /**
- * User owner instance
- */
- @JoinColumn (name = "branch_user_id")
- @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
- private User branchUserOwner;
-
- /**
- * Branch office's ZIP code
- */
- @Basic (optional = false)
- @Column (name = "branch_zip_code", length = 6, nullable = false)
- private Integer branchZipCode;
-
- @Override
- public boolean equals (final Object object) {
- if (null == object) {
- return false;
- } else if (this.getClass() != object.getClass()) {
- return false;
- }
-
- final BranchOffice other = (BranchOffice) object;
-
- if (!Objects.equals(this.getBranchId(), other.getBranchId())) {
- return false;
- } else if (!Objects.equals(this.getBranchCity(), other.getBranchCity())) {
- return false;
- } else if (!Objects.equals(this.getBranchCountry(), other.getBranchCountry())) {
- return false;
- } else if (!Objects.equals(this.getBranchHouseNumber(), other.getBranchHouseNumber())) {
- return false;
- } else if (!Objects.equals(this.getBranchStore(), other.getBranchStore())) {
- return false;
- } else if (!Objects.equals(this.getBranchStreet(), other.getBranchStreet())) {
- return false;
- } else if (!Objects.equals(this.getBranchSuiteNumber(), other.getBranchSuiteNumber())) {
- return false;
- } else if (!Objects.equals(this.getBranchZipCode(), other.getBranchZipCode())) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public String getBranchCity () {
- return this.branchCity;
- }
-
- @Override
- public void setBranchCity (final String branchCity) {
- this.branchCity = branchCity;
- }
-
- @Override
- public BusinessBasicData getBranchCompanyContact () {
- return this.branchCompanyContact;
- }
-
- @Override
- public void setBranchCompanyContact (final BusinessBasicData branchCompanyContact) {
- this.branchCompanyContact = branchCompanyContact;
- }
-
- @Override
- public Country getBranchCountry () {
- return this.branchCountry;
- }
-
- @Override
- public void setBranchCountry (final Country branchCountry) {
- this.branchCountry = branchCountry;
- }
-
- @Override
- @SuppressWarnings ("ReturnOfDateField")
- public Calendar getBranchCreated () {
- return this.branchCreated;
- }
-
- @Override
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setBranchCreated (final Calendar branchCreated) {
- this.branchCreated = branchCreated;
- }
-
- @Override
- public String getBranchEmailAddress () {
- return this.branchEmailAddress;
- }
-
- @Override
- public void setBranchEmailAddress (final String branchEmailAddress) {
- this.branchEmailAddress = branchEmailAddress;
- }
-
- @Override
- public DialableFaxNumber getBranchFaxNumber () {
- return this.branchFaxNumber;
- }
-
- @Override
- public void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber) {
- this.branchFaxNumber = branchFaxNumber;
- }
-
- @Override
- public Short getBranchHouseNumber () {
- return this.branchHouseNumber;
- }
-
- @Override
- public void setBranchHouseNumber (final Short branchHouseNumber) {
- this.branchHouseNumber = branchHouseNumber;
- }
-
- @Override
- public Long getBranchId () {
- return this.branchId;
- }
-
- @Override
- public void setBranchId (final Long branchId) {
- this.branchId = branchId;
- }
-
- @Override
- public DialableLandLineNumber getBranchPhoneNumber () {
- return this.branchPhoneNumber;
- }
-
- @Override
- public void setBranchPhoneNumber (final DialableLandLineNumber branchPhoneNumber) {
- this.branchPhoneNumber = branchPhoneNumber;
- }
-
- @Override
- public Short getBranchStore () {
- return this.branchStore;
- }
-
- @Override
- public void setBranchStore (final Short branchStore) {
- this.branchStore = branchStore;
- }
-
- @Override
- public String getBranchStreet () {
- return this.branchStreet;
- }
-
- @Override
- public void setBranchStreet (final String branchStreet) {
- this.branchStreet = branchStreet;
- }
-
- @Override
- public Short getBranchSuiteNumber () {
- return this.branchSuiteNumber;
- }
-
- @Override
- public void setBranchSuiteNumber (final Short branchSuiteNumber) {
- this.branchSuiteNumber = branchSuiteNumber;
- }
-
- @Override
- public User getBranchUserOwner () {
- return this.branchUserOwner;
- }
-
- @Override
- public void setBranchUserOwner (final User branchUserOwner) {
- this.branchUserOwner = branchUserOwner;
- }
-
- @Override
- public Integer getBranchZipCode () {
- return this.branchZipCode;
- }
-
- @Override
- public void setBranchZipCode (final Integer branchZipCode) {
- this.branchZipCode = branchZipCode;
- }
-
- @Override
- public int hashCode () {
- int hash = 7;
-
- hash = 53 * hash + Objects.hashCode(this.getBranchId());
- hash = 53 * hash + Objects.hashCode(this.getBranchCity());
- hash = 53 * hash + Objects.hashCode(this.getBranchCountry());
- hash = 53 * hash + Objects.hashCode(this.getBranchHouseNumber());
- hash = 53 * hash + Objects.hashCode(this.getBranchStore());
- hash = 53 * hash + Objects.hashCode(this.getBranchStreet());
- hash = 53 * hash + Objects.hashCode(this.getBranchSuiteNumber());
- hash = 53 * hash + Objects.hashCode(this.getBranchZipCode());
-
- return hash;
- }
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.branchoffice;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.employee.Employee;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJI for branch offices
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface BranchOffice extends Serializable {
+
+ /**
+ * Getter for branch office's city name
+ * <p>
+ * @return Branch office's city name
+ */
+ String getBranchCity ();
+
+ /**
+ * Setter for branch office's city name
+ * <p>
+ * @param branchCity Branch office's city name
+ */
+ void setBranchCity (final String branchCity);
+
+ /**
+ * Getter for branch office's email address
+ * <p>
+ * @return Branch office's email address
+ */
+ String getBranchEmailAddress ();
+
+ /**
+ * Setter for branch office's email address
+ * <p>
+ * @param branchEmailAddress Branch office's email address
+ */
+ void setBranchEmailAddress (final String branchEmailAddress);
+
+ /**
+ * Getter for branch office's fax number
+ * <p>
+ * @return Branch office's fax number
+ */
+ DialableFaxNumber getBranchFaxNumber ();
+
+ /**
+ * Setter for branch office's fax number
+ * <p>
+ * @param branchFaxNumber Branch office's fax number
+ */
+ void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber);
+
+ /**
+ * Getter for branch office's house number
+ * <p>
+ * @return Branch office's house number
+ */
+ Short getBranchHouseNumber ();
+
+ /**
+ * Setter for branch office's house number
+ * <p>
+ * @param branchHouseNumber Branch office's house number
+ */
+ void setBranchHouseNumber (final Short branchHouseNumber);
+
+ /**
+ * Getter for branch office's phone number
+ * <p>
+ * @return Branch office's phone number
+ */
+ DialableLandLineNumber getBranchPhoneNumber ();
+
+ /**
+ * Setter for branch office's phone number
+ * <p>
+ * @param branchPhoneNumber Branch office's phone number
+ */
+ void setBranchPhoneNumber (final DialableLandLineNumber branchPhoneNumber);
+
+ /**
+ * Getter for branch office's store
+ * <p>
+ * @return Branch office's store
+ */
+ Short getBranchStore ();
+
+ /**
+ * Setter for branch office's store
+ * <p>
+ * @param branchStore Branch office's store
+ */
+ void setBranchStore (final Short branchStore);
+
+ /**
+ * Getter for branch office's street name
+ * <p>
+ * @return Branch office's street name
+ */
+ String getBranchStreet ();
+
+ /**
+ * Setter for branch office's street name
+ * <p>
+ * @param branchStreet Branch office's street name
+ */
+ void setBranchStreet (final String branchStreet);
+
+ /**
+ * Getter for branch office's suite number
+ * <p>
+ * @return Branch office's suite number
+ */
+ Short getBranchSuiteNumber ();
+
+ /**
+ * Setter for branch office's suite number
+ * <p>
+ * @param branchSuiteNumber Branch office's suite number
+ */
+ void setBranchSuiteNumber (final Short branchSuiteNumber);
+
+ /**
+ * Getter for branch office's ZIP code
+ * <p>
+ * @return Branch office's ZIP code
+ */
+ Integer getBranchZipCode ();
+
+ /**
+ * Setter for branch office's ZIP code
+ * <p>
+ * @param branchZipCode Branch office's ZIP code
+ */
+ void setBranchZipCode (final Integer branchZipCode);
+
+ /**
+ * Getter for branch office's id number
+ * <p>
+ * @return Branch office's id number
+ */
+ Long getBranchId ();
+
+ /**
+ * Setter for branch office's id number
+ * <p>
+ * @param branchId Branch office's id number
+ */
+ void setBranchId (final Long branchId);
+
+ /**
+ * Getter for branch office's country
+ * <p>
+ * @return Branch office's country
+ */
+ Country getBranchCountry ();
+
+ /**
+ * Setter for branch office's country
+ * <p>
+ * @param branchCountryCode Branch office's country
+ */
+ void setBranchCountry (final Country branchCountryCode);
+
+ /**
+ * Getter for branch office's company
+ * <p>
+ * @return Branch office's company
+ */
+ BusinessBasicData getBranchCompany ();
+
+ /**
+ * Setter for branch office's company
+ * <p>
+ * @param branchCompany Branch office's company
+ */
+ void setBranchCompany (final BusinessBasicData branchCompany);
+
+ /**
+ * Getter branch office's contact person
+ * <p>
+ * @return Branch office's contact person
+ */
+ Employee getBranchContactEmployee ();
+
+ /**
+ * Setter branch office's contact person
+ * <p>
+ * @param branchEmployee Branch office's contact person
+ */
+ void setBranchContactEmployee (final Employee branchEmployee);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getBranchUserOwner ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param branchUserOwner User owner instance
+ */
+ void setBranchUserOwner (final User branchUserOwner);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getBranchCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param branchCreated Timestamp when this entry has been created
+ */
+ void setBranchCreated (final Calendar branchCreated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.branchoffice;
+
+import java.util.Calendar;
+import java.util.Objects;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
+import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
+import org.mxchange.jcontactsbusiness.employee.Employee;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
+import org.mxchange.jusercore.model.user.LoginUser;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJO for company branch offices
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Entity (name = "company_branch_offices")
+@Table (name = "company_branch_offices")
+@NamedQueries ({
+ @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC")
+})
+@SuppressWarnings ("PersistenceUnitPresent")
+public class CompanyBranchOffice implements BranchOffice {
+
+ /**
+ * Serial number
+ */
+ @Transient
+ private static final long serialVersionUID = 47_957_817_276_871_852L;
+
+ /**
+ * Branch office's city name
+ */
+ @Basic (optional = false)
+ @Column (name = "branch_city", length = 100, nullable = false)
+ private String branchCity;
+
+ /**
+ * Company that has this branch office
+ */
+ @JoinColumn (name = "branch_company_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = CompanyBasicData.class, optional = false, cascade = CascadeType.ALL)
+ private BusinessBasicData branchCompany;
+
+ /**
+ * Branch office's country code
+ */
+ @JoinColumn (name = "branch_country_id", nullable = false)
+ @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
+ private Country branchCountry;
+
+ /**
+ * Timestamp when this entry has been created
+ */
+ @Basic (optional = false)
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "branch_entry_created", nullable = false, updatable = false)
+ private Calendar branchCreated;
+
+ /**
+ * Branch office's main email address (example: branch-name@company.com)
+ */
+ @Column (name = "branch_email_address", length = 100)
+ private String branchEmailAddress;
+
+ /**
+ * Reference to contact person
+ */
+ @JoinColumn (name = "branch_contact_employee_id")
+ @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
+ private Employee branchContactEmployee;
+
+ /**
+ * Branch office's main fax number: +ccxxxxxxxxxx
+ */
+ @JoinColumn (name = "branch_fax_number_id")
+ @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
+ private DialableFaxNumber branchFaxNumber;
+
+ /**
+ * Branch office's house number
+ */
+ @Basic (optional = false)
+ @Column (name = "branch_house_number", length = 3, nullable = false)
+ private Short branchHouseNumber;
+
+ /**
+ * Id number
+ */
+ @Id
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ @Column (name = "branch_id", nullable = false, updatable = false)
+ private Long branchId;
+
+ /**
+ * Branch office's main phone number: +ccxxxxxxxxxx
+ */
+ @JoinColumn (name = "branch_phone_number_id")
+ @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
+ private DialableLandLineNumber branchPhoneNumber;
+
+ /**
+ * Branch office's store (if multiple-store building)
+ */
+ @Column (name = "branch_store", length = 3)
+ private Short branchStore;
+
+ /**
+ * Branch office's street name
+ */
+ @Basic (optional = false)
+ @Column (name = "branch_street", length = 100, nullable = false)
+ private String branchStreet;
+
+ /**
+ * Branch office's suite number (if applyable)
+ */
+ @Column (name = "branch_suite_number", length = 4)
+ private Short branchSuiteNumber;
+
+ /**
+ * User owner instance
+ */
+ @JoinColumn (name = "branch_user_id")
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
+ private User branchUserOwner;
+
+ /**
+ * Branch office's ZIP code
+ */
+ @Basic (optional = false)
+ @Column (name = "branch_zip_code", length = 6, nullable = false)
+ private Integer branchZipCode;
+
+ @Override
+ public boolean equals (final Object object) {
+ if (null == object) {
+ return false;
+ } else if (this.getClass() != object.getClass()) {
+ return false;
+ }
+
+ final BranchOffice other = (BranchOffice) object;
+
+ if (!Objects.equals(this.getBranchId(), other.getBranchId())) {
+ return false;
+ } else if (!Objects.equals(this.getBranchCity(), other.getBranchCity())) {
+ return false;
+ } else if (!Objects.equals(this.getBranchCountry(), other.getBranchCountry())) {
+ return false;
+ } else if (!Objects.equals(this.getBranchHouseNumber(), other.getBranchHouseNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getBranchStore(), other.getBranchStore())) {
+ return false;
+ } else if (!Objects.equals(this.getBranchStreet(), other.getBranchStreet())) {
+ return false;
+ } else if (!Objects.equals(this.getBranchSuiteNumber(), other.getBranchSuiteNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getBranchZipCode(), other.getBranchZipCode())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getBranchCity () {
+ return this.branchCity;
+ }
+
+ @Override
+ public void setBranchCity (final String branchCity) {
+ this.branchCity = branchCity;
+ }
+
+ @Override
+ public BusinessBasicData getBranchCompany () {
+ return this.branchCompany;
+ }
+
+ @Override
+ public void setBranchCompany (final BusinessBasicData branchCompany) {
+ this.branchCompany = branchCompany;
+ }
+
+ @Override
+ public Country getBranchCountry () {
+ return this.branchCountry;
+ }
+
+ @Override
+ public void setBranchCountry (final Country branchCountry) {
+ this.branchCountry = branchCountry;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Calendar getBranchCreated () {
+ return this.branchCreated;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setBranchCreated (final Calendar branchCreated) {
+ this.branchCreated = branchCreated;
+ }
+
+ @Override
+ public String getBranchEmailAddress () {
+ return this.branchEmailAddress;
+ }
+
+ @Override
+ public void setBranchEmailAddress (final String branchEmailAddress) {
+ this.branchEmailAddress = branchEmailAddress;
+ }
+
+ @Override
+ public Employee getBranchContactEmployee () {
+ return this.branchContactEmployee;
+ }
+
+ @Override
+ public void setBranchContactEmployee (final Employee branchContactEmployee) {
+ this.branchContactEmployee = branchContactEmployee;
+ }
+
+ @Override
+ public DialableFaxNumber getBranchFaxNumber () {
+ return this.branchFaxNumber;
+ }
+
+ @Override
+ public void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber) {
+ this.branchFaxNumber = branchFaxNumber;
+ }
+
+ @Override
+ public Short getBranchHouseNumber () {
+ return this.branchHouseNumber;
+ }
+
+ @Override
+ public void setBranchHouseNumber (final Short branchHouseNumber) {
+ this.branchHouseNumber = branchHouseNumber;
+ }
+
+ @Override
+ public Long getBranchId () {
+ return this.branchId;
+ }
+
+ @Override
+ public void setBranchId (final Long branchId) {
+ this.branchId = branchId;
+ }
+
+ @Override
+ public DialableLandLineNumber getBranchPhoneNumber () {
+ return this.branchPhoneNumber;
+ }
+
+ @Override
+ public void setBranchPhoneNumber (final DialableLandLineNumber branchPhoneNumber) {
+ this.branchPhoneNumber = branchPhoneNumber;
+ }
+
+ @Override
+ public Short getBranchStore () {
+ return this.branchStore;
+ }
+
+ @Override
+ public void setBranchStore (final Short branchStore) {
+ this.branchStore = branchStore;
+ }
+
+ @Override
+ public String getBranchStreet () {
+ return this.branchStreet;
+ }
+
+ @Override
+ public void setBranchStreet (final String branchStreet) {
+ this.branchStreet = branchStreet;
+ }
+
+ @Override
+ public Short getBranchSuiteNumber () {
+ return this.branchSuiteNumber;
+ }
+
+ @Override
+ public void setBranchSuiteNumber (final Short branchSuiteNumber) {
+ this.branchSuiteNumber = branchSuiteNumber;
+ }
+
+ @Override
+ public User getBranchUserOwner () {
+ return this.branchUserOwner;
+ }
+
+ @Override
+ public void setBranchUserOwner (final User branchUserOwner) {
+ this.branchUserOwner = branchUserOwner;
+ }
+
+ @Override
+ public Integer getBranchZipCode () {
+ return this.branchZipCode;
+ }
+
+ @Override
+ public void setBranchZipCode (final Integer branchZipCode) {
+ this.branchZipCode = branchZipCode;
+ }
+
+ @Override
+ public int hashCode () {
+ int hash = 7;
+
+ hash = 53 * hash + Objects.hashCode(this.getBranchId());
+ hash = 53 * hash + Objects.hashCode(this.getBranchCity());
+ hash = 53 * hash + Objects.hashCode(this.getBranchCountry());
+ hash = 53 * hash + Objects.hashCode(this.getBranchHouseNumber());
+ hash = 53 * hash + Objects.hashCode(this.getBranchStore());
+ hash = 53 * hash + Objects.hashCode(this.getBranchStreet());
+ hash = 53 * hash + Objects.hashCode(this.getBranchSuiteNumber());
+ hash = 53 * hash + Objects.hashCode(this.getBranchZipCode());
+
+ return hash;
+ }
+
+}
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
-import org.mxchange.jcontactsbusiness.branch.BranchOffice;
-import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.CompanyBranchOffice;
import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
import org.mxchange.jcontactsbusiness.employee.Employee;
-import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData;
-import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
+import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersData;
import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
/**
* A POJO for company departments
* Where this department is located
*/
@JoinColumn (name = "department_headquarters_id")
- @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL)
- private HeadQuartersData departentHeadquarters;
+ @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL)
+ private HeadquartersData departentHeadquarters;
/**
* Where this department is located
}
@Override
- public HeadQuartersData getDepartentHeadquarters () {
+ public HeadquartersData getDepartentHeadquarters () {
return this.departentHeadquarters;
}
@Override
- public void setDepartentHeadquarters (final HeadQuartersData departentHeadquarters) {
+ public void setDepartentHeadquarters (final HeadquartersData departentHeadquarters) {
this.departentHeadquarters = departentHeadquarters;
}
import java.io.Serializable;
import java.util.Calendar;
-import org.mxchange.jcontactsbusiness.branch.BranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.employee.Employee;
-import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
/**
* A POJI for company departments
* <p>
* @return Connection to company headquarters
*/
- HeadQuartersData getDepartentHeadquarters ();
+ HeadquartersData getDepartentHeadquarters ();
/**
* Setter for connection to company headquarters
* <p>
* @param departentHeadquarters Connection to company headquarters
*/
- void setDepartentHeadquarters (final HeadQuartersData departentHeadquarters);
+ void setDepartentHeadquarters (final HeadquartersData departentHeadquarters);
/**
* Getter for connection to company branch office
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import org.mxchange.jcontacts.contact.UserContact;
import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
-import org.mxchange.jcontactsbusiness.branch.BranchOffice;
-import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.CompanyBranchOffice;
import org.mxchange.jcontactsbusiness.department.CompanyDepartment;
import org.mxchange.jcontactsbusiness.department.Department;
-import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData;
-import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
+import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersData;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
import org.mxchange.jcontactsbusiness.jobposition.EmployeePosition;
import org.mxchange.jcontactsbusiness.jobposition.JobPosition;
import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
*/
@Entity (name = "company_employees")
@Table (name = "company_employees")
+@NamedQueries (
+ {
+ @NamedQuery (name = "AllCompanyEmployees", query = "SELECT e FROM company_employees AS e ORDER BY e.employeeId ASC"),
+ @NamedQuery (name = "SearchCompanyEmployeeById", query = "SELECT e FROM company_employees AS e WHERE e.employeeId = :employeeId")
+ }
+)
@SuppressWarnings ("PersistenceUnitPresent")
public class CompanyEmployee implements Employee {
* Head quarters id number (if the employee works there)
*/
@JoinColumn (name = "employee_headquarters_id")
- @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL)
- private HeadQuartersData employeeHeadquarter;
+ @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL)
+ private HeadquartersData employeeHeadquarter;
/**
* Id number
}
@Override
- public HeadQuartersData getEmployeeHeadquarter () {
+ public HeadquartersData getEmployeeHeadquarter () {
return this.employeeHeadquarter;
}
@Override
- public void setEmployeeHeadquarter (final HeadQuartersData employeeHeadquarter) {
+ public void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter) {
this.employeeHeadquarter = employeeHeadquarter;
}
import java.util.Calendar;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
-import org.mxchange.jcontactsbusiness.branch.BranchOffice;
+import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.department.Department;
-import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
import org.mxchange.jcontactsbusiness.jobposition.JobPosition;
import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData;
/**
* A POJI for employees
* <p>
* @return Employee's head quarters
*/
- HeadQuartersData getEmployeeHeadquarter ();
+ HeadquartersData getEmployeeHeadquarter ();
/**
* Getter for employee's head quarters
* <p>
* @param employeeHeadquarter Employee's head quarters
*/
- void setEmployeeHeadquarter (final HeadQuartersData employeeHeadquarter);
+ void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter);
/**
* Getter for employee's email address
--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.events.basicdata.added;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+
+/**
+ * An event being thrown when new basic business data has been added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class AdminAddedBusinessBasicDataEvent implements ObservableAdminAddedBusinessBasicDataEvent {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 41_908_266_873_657_271L;
+
+ /**
+ * Basic data instance just being created. It must bear aside company name
+ * also a primary key.
+ */
+ private final BusinessBasicData basicData;
+
+ /**
+ * Constructor with basic data
+ * <p>
+ * @param basicData Basic data with at least company name and primary key
+ */
+ public AdminAddedBusinessBasicDataEvent (final BusinessBasicData basicData) {
+ // Is company name and primary key set?
+ if (null == basicData) {
+ // Throw NPE
+ throw new NullPointerException("basicData is null"); //NOI18N
+ } else if (basicData.getCompanyName() == null) {
+ // Throw NPE again
+ throw new NullPointerException("basicData.companyName is null"); //NOI18N
+ } else if (basicData.getCompanyName().isEmpty()) {
+ // Throw NPE again
+ throw new IllegalArgumentException("basicData.companyName is empty"); //NOI18N
+ } else if (basicData.getCompanyDataId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("basicData.companyDataId is null"); //NOI18N
+ } else if (basicData.getCompanyDataId() < 1) {
+ // Throw NPE again
+ throw new IllegalArgumentException(MessageFormat.format("basicData.companyDataId={0} is not valid.", basicData.getCompanyDataId())); //NOI18N
+ }
+
+ // Set it here
+ this.basicData = basicData;
+ }
+
+ @Override
+ public BusinessBasicData getBasicData () {
+ return this.basicData;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.events.basicdata.added;
+
+import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+
+/**
+ * An interface for events being fired when new basic business data has been
+ * added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableAdminAddedBusinessBasicDataEvent extends Serializable {
+
+ /**
+ * Getter for basic business data entity
+ * <p>
+ * @return Basic business data entity
+ */
+ BusinessBasicData getBasicData ();
+
+}
* @param businessContact Business contact that is already added
*/
public BusinessDataAlreadyAddedException (final BusinessBasicData businessContact) {
- super(MessageFormat.format("Business contact with businessContactId={0} not found.", businessContact.getBusinessDataId())); //NOI18N
+ super(MessageFormat.format("Business contact with comanyName={0} already added.", businessContact.getCompanyName())); //NOI18N
}
/**
* Default constructor, may be used if no contact instance is available
*/
public BusinessDataAlreadyAddedException () {
- super("BusinessContact already added"); //NOI18N
+ super("Business contact already added"); //NOI18N
}
}
import java.text.MessageFormat;
/**
- * An exception thrown when a contact (entity) has not found.
+ * An exception thrown when a company employee (entity) has not found.
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.exceptions.headquarters;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when a headquarters (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CompanyHeadquartersNotFoundException extends Exception {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 23_759_801_876_416_568L;
+
+ /**
+ * Constructor with company headquarters id
+ * <p>
+ * @param headquartersId Company headquarters id
+ */
+ public CompanyHeadquartersNotFoundException (final Long headquartersId) {
+ // Call super constructor with message and cause
+ super(MessageFormat.format("Company headquarters with id {0} was not found.", headquartersId)); //NOI18N
+ }
+
+ /**
+ * Constructor with company headquarters id and causing exception
+ * <p>
+ * @param headquartersId Company headquarters id
+ * @param cause Causing exception
+ */
+ public CompanyHeadquartersNotFoundException (final Long headquartersId, final Throwable cause) {
+ // Call super constructor with message and cause
+ super(MessageFormat.format("Company headquarters with id {0} was not found.", headquartersId), cause); //NOI18N
+ }
+
+ /**
+ * Constructor with email address and causing exception
+ * <p>
+ * @param emailAddress Email address
+ * @param cause Causing exception
+ */
+ public CompanyHeadquartersNotFoundException (final String emailAddress, final Throwable cause) {
+ // Call super constructor with message and cause
+ super(MessageFormat.format("Company headquarters with email address {0} was not found.", emailAddress), cause); //NOI18N
+ }
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2016 KLC
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.headquarters;
-
-import java.util.Calendar;
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jcountry.data.CountryData;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jusercore.model.user.LoginUser;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A POJO for company headquarts data
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "company_headquarters")
-@Table (name = "company_headquarters")
-@SuppressWarnings ("PersistenceUnitPresent")
-public class CompanyHeadQuartersData implements HeadQuartersData {
-
- /**
- * Serial number
- */
- @Transient
- private static final long serialVersionUID = 385_752_948_781_761L;
-
- /**
- * Headquarters' city name
- */
- @Basic (optional = false)
- @Column (name = "headquarters_city", length = 100, nullable = false)
- private String headquartersCity;
-
- /**
- * Headquarter's country code
- */
- @JoinColumn (name = "headquarters_country_id", nullable = false)
- @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
- private Country headquartersCountry;
-
- /**
- * Timestamp when this entry has been created
- */
- @Basic (optional = false)
- @Temporal (TemporalType.TIMESTAMP)
- @Column (name = "headquarters_entry_created", nullable = false, updatable = false)
- private Calendar headquartersCreated;
-
- /**
- * Headquarters' fax number
- */
- @JoinColumn (name = "headquarters_fax_number_id")
- @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
- private DialableFaxNumber headquartersFaxNumber;
-
- /**
- * Headquarters' house number
- */
- @Basic (optional = false)
- @Column (name = "headquarters_house_number", length = 4, nullable = false)
- private Short headquartersHouseNumber;
-
- /**
- * Id number
- */
- @Id
- @GeneratedValue (strategy = GenerationType.IDENTITY)
- @Column (name = "headquarters_id", nullable = false, updatable = false)
- private Long headquartersId;
-
- /**
- * Headquarters' phone number
- */
- @JoinColumn (name = "headquarters_phone_number_id")
- @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
- private DialableLandLineNumber headquartersPhoneNumber;
-
- /**
- * Headquarters' store number (multi-store building only)
- */
- @Column (name = "headquarters_store", length = 3)
- private Short headquartersStore;
-
- /**
- * Headquarters' street name
- */
- @Basic (optional = false)
- @Column (name = "headquarters_street", length = 100, nullable = false)
- private String headquartersStreet;
-
- /**
- * Headquarters' suite number
- */
- @Column (name = "headquarters_suite_number", length = 4)
- private Short headquartersSuiteNumber;
-
- /**
- * User owner instance
- */
- @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
- private User headquartersUserOwner;
-
- /**
- * Headquarters' ZIP code
- */
- @Basic (optional = false)
- @Column (name = "headquarters_zip_code", length = 6, nullable = false)
- private Integer headquartersZipCode;
-
- @Override
- public boolean equals (final Object object) {
- if (null == object) {
- return false;
- } else if (this.getClass() != object.getClass()) {
- return false;
- }
-
- final HeadQuartersData other = (HeadQuartersData) object;
-
- if (!Objects.equals(this.getHeadquartersId(), other.getHeadquartersId())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersCity(), other.getHeadquartersCity())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersCountry(), other.getHeadquartersCountry())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersHouseNumber(), other.getHeadquartersHouseNumber())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersStore(), other.getHeadquartersStore())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersStreet(), other.getHeadquartersStreet())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersSuiteNumber(), other.getHeadquartersSuiteNumber())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersZipCode(), other.getHeadquartersZipCode())) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public String getHeadquartersCity () {
- return this.headquartersCity;
- }
-
- @Override
- public void setHeadquartersCity (final String headquartersCity) {
- this.headquartersCity = headquartersCity;
- }
-
- @Override
- public Country getHeadquartersCountry () {
- return this.headquartersCountry;
- }
-
- @Override
- public void setHeadquartersCountry (final Country headquartersCountry) {
- this.headquartersCountry = headquartersCountry;
- }
-
- @Override
- @SuppressWarnings ("ReturnOfDateField")
- public Calendar getHeadquartersCreated () {
- return this.headquartersCreated;
- }
-
- @Override
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setHeadquartersCreated (final Calendar headquartersCreated) {
- this.headquartersCreated = headquartersCreated;
- }
-
- @Override
- public DialableFaxNumber getHeadquartersFaxNumber () {
- return this.headquartersFaxNumber;
- }
-
- @Override
- public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) {
- this.headquartersFaxNumber = headquartersFaxNumber;
- }
-
- @Override
- public Short getHeadquartersHouseNumber () {
- return this.headquartersHouseNumber;
- }
-
- @Override
- public void setHeadquartersHouseNumber (final Short headquartersHouseNumber) {
- this.headquartersHouseNumber = headquartersHouseNumber;
- }
-
- @Override
- public Long getHeadquartersId () {
- return this.headquartersId;
- }
-
- @Override
- public void setHeadquartersId (final Long headquartersId) {
- this.headquartersId = headquartersId;
- }
-
- @Override
- public DialableLandLineNumber getHeadquartersPhoneNumber () {
- return this.headquartersPhoneNumber;
- }
-
- @Override
- public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) {
- this.headquartersPhoneNumber = headquartersPhoneNumber;
- }
-
- @Override
- public Short getHeadquartersStore () {
- return this.headquartersStore;
- }
-
- @Override
- public void setHeadquartersStore (final Short headquartersStore) {
- this.headquartersStore = headquartersStore;
- }
-
- @Override
- public String getHeadquartersStreet () {
- return this.headquartersStreet;
- }
-
- @Override
- public void setHeadquartersStreet (final String headquartersStreet) {
- this.headquartersStreet = headquartersStreet;
- }
-
- @Override
- public Short getHeadquartersSuiteNumber () {
- return this.headquartersSuiteNumber;
- }
-
- @Override
- public void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber) {
- this.headquartersSuiteNumber = headquartersSuiteNumber;
- }
-
- @Override
- public User getHeadquartersUserOwner () {
- return this.headquartersUserOwner;
- }
-
- @Override
- public void setHeadquartersUserOwner (final User headquartersUserOwner) {
- this.headquartersUserOwner = headquartersUserOwner;
- }
-
- @Override
- public Integer getHeadquartersZipCode () {
- return this.headquartersZipCode;
- }
-
- @Override
- public void setHeadquartersZipCode (final Integer headquartersZipCode) {
- this.headquartersZipCode = headquartersZipCode;
- }
-
- @Override
- public int hashCode () {
- int hash = 7;
-
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersId());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersCity());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersCountry());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersHouseNumber());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersStore());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersStreet());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersSuiteNumber());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersZipCode());
-
- return hash;
- }
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2016 KLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.headquarters;
+
+import java.util.Calendar;
+import java.util.Objects;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
+import org.mxchange.jusercore.model.user.LoginUser;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJO for company headquarts data
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Entity (name = "company_headquarters")
+@Table (name = "company_headquarters")
+@SuppressWarnings ("PersistenceUnitPresent")
+public class CompanyHeadquartersData implements HeadquartersData {
+
+ /**
+ * Serial number
+ */
+ @Transient
+ private static final long serialVersionUID = 385_752_948_781_761L;
+
+ /**
+ * Headquarters' city name
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_city", length = 100, nullable = false)
+ private String headquartersCity;
+
+ /**
+ * Headquarter's country code
+ */
+ @JoinColumn (name = "headquarters_country_id", nullable = false)
+ @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
+ private Country headquartersCountry;
+
+ /**
+ * Timestamp when this entry has been created
+ */
+ @Basic (optional = false)
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "headquarters_entry_created", nullable = false, updatable = false)
+ private Calendar headquartersCreated;
+
+ /**
+ * Headquarters' fax number
+ */
+ @JoinColumn (name = "headquarters_fax_number_id")
+ @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
+ private DialableFaxNumber headquartersFaxNumber;
+
+ /**
+ * Headquarters' house number
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_house_number", length = 4, nullable = false)
+ private Short headquartersHouseNumber;
+
+ /**
+ * Id number
+ */
+ @Id
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ @Column (name = "headquarters_id", nullable = false, updatable = false)
+ private Long headquartersId;
+
+ /**
+ * Headquarters' phone number
+ */
+ @JoinColumn (name = "headquarters_phone_number_id")
+ @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
+ private DialableLandLineNumber headquartersPhoneNumber;
+
+ /**
+ * Headquarters' store number (multi-store building only)
+ */
+ @Column (name = "headquarters_store", length = 3)
+ private Short headquartersStore;
+
+ /**
+ * Headquarters' street name
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_street", length = 100, nullable = false)
+ private String headquartersStreet;
+
+ /**
+ * Headquarters' suite number
+ */
+ @Column (name = "headquarters_suite_number", length = 4)
+ private Short headquartersSuiteNumber;
+
+ /**
+ * User owner instance
+ */
+ @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+ private User headquartersUserOwner;
+
+ /**
+ * Headquarters' ZIP code
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_zip_code", length = 6, nullable = false)
+ private Integer headquartersZipCode;
+
+ @Override
+ public boolean equals (final Object object) {
+ if (null == object) {
+ return false;
+ } else if (this.getClass() != object.getClass()) {
+ return false;
+ }
+
+ final HeadquartersData other = (HeadquartersData) object;
+
+ if (!Objects.equals(this.getHeadquartersId(), other.getHeadquartersId())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersCity(), other.getHeadquartersCity())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersCountry(), other.getHeadquartersCountry())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersHouseNumber(), other.getHeadquartersHouseNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersStore(), other.getHeadquartersStore())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersStreet(), other.getHeadquartersStreet())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersSuiteNumber(), other.getHeadquartersSuiteNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersZipCode(), other.getHeadquartersZipCode())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getHeadquartersCity () {
+ return this.headquartersCity;
+ }
+
+ @Override
+ public void setHeadquartersCity (final String headquartersCity) {
+ this.headquartersCity = headquartersCity;
+ }
+
+ @Override
+ public Country getHeadquartersCountry () {
+ return this.headquartersCountry;
+ }
+
+ @Override
+ public void setHeadquartersCountry (final Country headquartersCountry) {
+ this.headquartersCountry = headquartersCountry;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Calendar getHeadquartersCreated () {
+ return this.headquartersCreated;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setHeadquartersCreated (final Calendar headquartersCreated) {
+ this.headquartersCreated = headquartersCreated;
+ }
+
+ @Override
+ public DialableFaxNumber getHeadquartersFaxNumber () {
+ return this.headquartersFaxNumber;
+ }
+
+ @Override
+ public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) {
+ this.headquartersFaxNumber = headquartersFaxNumber;
+ }
+
+ @Override
+ public Short getHeadquartersHouseNumber () {
+ return this.headquartersHouseNumber;
+ }
+
+ @Override
+ public void setHeadquartersHouseNumber (final Short headquartersHouseNumber) {
+ this.headquartersHouseNumber = headquartersHouseNumber;
+ }
+
+ @Override
+ public Long getHeadquartersId () {
+ return this.headquartersId;
+ }
+
+ @Override
+ public void setHeadquartersId (final Long headquartersId) {
+ this.headquartersId = headquartersId;
+ }
+
+ @Override
+ public DialableLandLineNumber getHeadquartersPhoneNumber () {
+ return this.headquartersPhoneNumber;
+ }
+
+ @Override
+ public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) {
+ this.headquartersPhoneNumber = headquartersPhoneNumber;
+ }
+
+ @Override
+ public Short getHeadquartersStore () {
+ return this.headquartersStore;
+ }
+
+ @Override
+ public void setHeadquartersStore (final Short headquartersStore) {
+ this.headquartersStore = headquartersStore;
+ }
+
+ @Override
+ public String getHeadquartersStreet () {
+ return this.headquartersStreet;
+ }
+
+ @Override
+ public void setHeadquartersStreet (final String headquartersStreet) {
+ this.headquartersStreet = headquartersStreet;
+ }
+
+ @Override
+ public Short getHeadquartersSuiteNumber () {
+ return this.headquartersSuiteNumber;
+ }
+
+ @Override
+ public void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber) {
+ this.headquartersSuiteNumber = headquartersSuiteNumber;
+ }
+
+ @Override
+ public User getHeadquartersUserOwner () {
+ return this.headquartersUserOwner;
+ }
+
+ @Override
+ public void setHeadquartersUserOwner (final User headquartersUserOwner) {
+ this.headquartersUserOwner = headquartersUserOwner;
+ }
+
+ @Override
+ public Integer getHeadquartersZipCode () {
+ return this.headquartersZipCode;
+ }
+
+ @Override
+ public void setHeadquartersZipCode (final Integer headquartersZipCode) {
+ this.headquartersZipCode = headquartersZipCode;
+ }
+
+ @Override
+ public int hashCode () {
+ int hash = 7;
+
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersId());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersCity());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersCountry());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersHouseNumber());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersStore());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersStreet());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersSuiteNumber());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersZipCode());
+
+ return hash;
+ }
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.headquarters;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A POJI for headquarters data
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface HeadQuartersData extends Serializable {
-
- /**
- * Getter for headquarters' city name
- * <p>
- * @return Headquarters' city name
- */
- String getHeadquartersCity ();
-
- /**
- * Setter for headquarters' city name
- * <p>
- * @param headquartersCity Headquarters' city name
- */
- void setHeadquartersCity (final String headquartersCity);
-
- /**
- * Getter for headquarters' country code
- * <p>
- * @return Headquarters' country code
- */
- Country getHeadquartersCountry ();
-
- /**
- * Setter for headquarters' country code
- * <p>
- * @param headquartersCountryCode Headquarters' country code
- */
- void setHeadquartersCountry (final Country headquartersCountryCode);
-
- /**
- * Getter for headquarters' house number
- * <p>
- * @return Headquarters' house number
- */
- Short getHeadquartersHouseNumber ();
-
- /**
- * Setter for headquarters' house number
- * <p>
- * @param headquartersHouseNumber Headquarters' house number
- */
- void setHeadquartersHouseNumber (final Short headquartersHouseNumber);
-
- /**
- * Getter for headquarters' id number
- * <p>
- * @return Headquarters' id number
- */
- Long getHeadquartersId ();
-
- /**
- * Setter for headquarters' id number
- * <p>
- * @param headquartersId Headquarters' id number
- */
- void setHeadquartersId (final Long headquartersId);
-
- /**
- * Getter for headquarters' store number
- * <p>
- * @return Headquarters' store number
- */
- Short getHeadquartersStore ();
-
- /**
- * Setter for headquarters' store number
- * <p>
- * @param headquartersStore Headquarters' store number
- */
- void setHeadquartersStore (final Short headquartersStore);
-
- /**
- * Getter for headquarters' street name
- * <p>
- * @return Headquarters' street name
- */
- String getHeadquartersStreet ();
-
- /**
- * Setter for headquarters' street name
- * <p>
- * @param headquartersStreet Headquarters' street name
- */
- void setHeadquartersStreet (final String headquartersStreet);
-
- /**
- * Getter for headquarters' suite number
- * <p>
- * @return Headquarters' suite number
- */
- Short getHeadquartersSuiteNumber ();
-
- /**
- * Setter for headquarters' suite number
- * <p>
- * @param headquartersSuiteNumber Headquarters' suite number
- */
- void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber);
-
- /**
- * Getter for headquarters' ZIP code
- * <p>
- * @return Headquarters' ZIP code
- */
- Integer getHeadquartersZipCode ();
-
- /**
- * Setter for headquarters' ZIP code
- * <p>
- * @param headquartersZipCode Headquarters' ZIP code
- */
- void setHeadquartersZipCode (final Integer headquartersZipCode);
-
- /**
- * Getter for headquarters' phone number
- * <p>
- * @return Headquarters' phone number
- */
- DialableLandLineNumber getHeadquartersPhoneNumber ();
-
- /**
- * Setter for headquarters' phone number
- * <p>
- * @param headquartersPhoneNumber Headquarters' phone number
- */
- void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber);
-
- /**
- * Getter for headquarters' fax number
- * <p>
- * @return Headquarters' fax number
- */
- DialableFaxNumber getHeadquartersFaxNumber ();
-
- /**
- * Setter for headquarters' fax number
- * <p>
- * @param headquartersFaxNumber Headquarters' fax number
- */
- void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getHeadquartersUserOwner ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param headquartersUserOwner User owner instance
- */
- void setHeadquartersUserOwner (final User headquartersUserOwner);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getHeadquartersCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param headquartersCreated Timestamp when this entry has been created
- */
- void setHeadquartersCreated (final Calendar headquartersCreated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.headquarters;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJI for headquarters data
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface HeadquartersData extends Serializable {
+
+ /**
+ * Getter for headquarters' city name
+ * <p>
+ * @return Headquarters' city name
+ */
+ String getHeadquartersCity ();
+
+ /**
+ * Setter for headquarters' city name
+ * <p>
+ * @param headquartersCity Headquarters' city name
+ */
+ void setHeadquartersCity (final String headquartersCity);
+
+ /**
+ * Getter for headquarters' country code
+ * <p>
+ * @return Headquarters' country code
+ */
+ Country getHeadquartersCountry ();
+
+ /**
+ * Setter for headquarters' country code
+ * <p>
+ * @param headquartersCountryCode Headquarters' country code
+ */
+ void setHeadquartersCountry (final Country headquartersCountryCode);
+
+ /**
+ * Getter for headquarters' house number
+ * <p>
+ * @return Headquarters' house number
+ */
+ Short getHeadquartersHouseNumber ();
+
+ /**
+ * Setter for headquarters' house number
+ * <p>
+ * @param headquartersHouseNumber Headquarters' house number
+ */
+ void setHeadquartersHouseNumber (final Short headquartersHouseNumber);
+
+ /**
+ * Getter for headquarters' id number
+ * <p>
+ * @return Headquarters' id number
+ */
+ Long getHeadquartersId ();
+
+ /**
+ * Setter for headquarters' id number
+ * <p>
+ * @param headquartersId Headquarters' id number
+ */
+ void setHeadquartersId (final Long headquartersId);
+
+ /**
+ * Getter for headquarters' store number
+ * <p>
+ * @return Headquarters' store number
+ */
+ Short getHeadquartersStore ();
+
+ /**
+ * Setter for headquarters' store number
+ * <p>
+ * @param headquartersStore Headquarters' store number
+ */
+ void setHeadquartersStore (final Short headquartersStore);
+
+ /**
+ * Getter for headquarters' street name
+ * <p>
+ * @return Headquarters' street name
+ */
+ String getHeadquartersStreet ();
+
+ /**
+ * Setter for headquarters' street name
+ * <p>
+ * @param headquartersStreet Headquarters' street name
+ */
+ void setHeadquartersStreet (final String headquartersStreet);
+
+ /**
+ * Getter for headquarters' suite number
+ * <p>
+ * @return Headquarters' suite number
+ */
+ Short getHeadquartersSuiteNumber ();
+
+ /**
+ * Setter for headquarters' suite number
+ * <p>
+ * @param headquartersSuiteNumber Headquarters' suite number
+ */
+ void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber);
+
+ /**
+ * Getter for headquarters' ZIP code
+ * <p>
+ * @return Headquarters' ZIP code
+ */
+ Integer getHeadquartersZipCode ();
+
+ /**
+ * Setter for headquarters' ZIP code
+ * <p>
+ * @param headquartersZipCode Headquarters' ZIP code
+ */
+ void setHeadquartersZipCode (final Integer headquartersZipCode);
+
+ /**
+ * Getter for headquarters' phone number
+ * <p>
+ * @return Headquarters' phone number
+ */
+ DialableLandLineNumber getHeadquartersPhoneNumber ();
+
+ /**
+ * Setter for headquarters' phone number
+ * <p>
+ * @param headquartersPhoneNumber Headquarters' phone number
+ */
+ void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber);
+
+ /**
+ * Getter for headquarters' fax number
+ * <p>
+ * @return Headquarters' fax number
+ */
+ DialableFaxNumber getHeadquartersFaxNumber ();
+
+ /**
+ * Setter for headquarters' fax number
+ * <p>
+ * @param headquartersFaxNumber Headquarters' fax number
+ */
+ void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getHeadquartersUserOwner ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param headquartersUserOwner User owner instance
+ */
+ void setHeadquartersUserOwner (final User headquartersUserOwner);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getHeadquartersCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param headquartersCreated Timestamp when this entry has been created
+ */
+ void setHeadquartersCreated (final Calendar headquartersCreated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}