From: Roland Häder Date: Tue, 17 Oct 2017 23:34:34 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=be70d0221360580992a841ccdb695a44d69226fa;p=jcontacts-business-core.git Continued: - renamed many other entity (classes) to Business 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 6eef651..5bb5a5a 100644 --- a/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicData.java +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/BasicData.java @@ -22,10 +22,10 @@ import java.util.List; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.employee.Employable; import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; -import org.mxchange.jcontactsbusiness.model.logo.BusinessLogo; 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; /** * A POJI for business contact classes @@ -179,14 +179,14 @@ public interface BasicData extends Serializable { *

* @return Company logo */ - BusinessLogo getCompanyLogo (); + Logo getCompanyLogo (); /** * Setter for company logo *

* @param companyLogo Company logo */ - void setCompanyLogo (final BusinessLogo companyLogo); + void setCompanyLogo (final Logo companyLogo); /** * Getter for company name diff --git a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java index 9f844f1..0c61fdd 100644 --- a/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java @@ -38,16 +38,16 @@ import javax.persistence.Transient; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee; import org.mxchange.jcontactsbusiness.model.employee.Employable; -import org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersData; +import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquartersData; import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; import org.mxchange.jcontactsbusiness.model.logo.BusinessLogo; -import org.mxchange.jcontactsbusiness.model.logo.CompanyLogo; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jcontactsbusiness.model.logo.Logo; /** * A POJO for business basic data @@ -131,7 +131,7 @@ public class BusinessBasicData implements BasicData { * Reference to headquarters data */ @JoinColumn (name = "company_headquarters_data_id") - @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = BusinessHeadquartersData.class, cascade = CascadeType.ALL) private HeadquartersData companyHeadQuartersData; /** @@ -145,8 +145,8 @@ public class BusinessBasicData implements BasicData { * Id number of company logo */ @JoinColumn (name = "company_logo_id") - @OneToOne (targetEntity = CompanyLogo.class, cascade = CascadeType.ALL) - private BusinessLogo companyLogo; + @OneToOne (targetEntity = BusinessLogo.class, cascade = CascadeType.ALL) + private Logo companyLogo; /** * Company name @@ -329,12 +329,12 @@ public class BusinessBasicData implements BasicData { } @Override - public BusinessLogo getCompanyLogo () { + public Logo getCompanyLogo () { return this.companyLogo; } @Override - public void setCompanyLogo (final BusinessLogo companyLogoId) { + public void setCompanyLogo (final Logo companyLogoId) { this.companyLogo = companyLogoId; } diff --git a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java index a569a44..cf1081b 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java @@ -38,7 +38,7 @@ import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice; import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee; -import org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersData; +import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquartersData; import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; @@ -92,7 +92,7 @@ public class BusinessDepartment implements Department { * Where this department is located */ @JoinColumn (name = "department_headquarters_id") - @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.REFRESH) + @OneToOne (targetEntity = BusinessHeadquartersData.class, cascade = CascadeType.REFRESH) private HeadquartersData departmentHeadquarters; /** diff --git a/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java b/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java index d821779..21953d5 100644 --- a/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java @@ -40,7 +40,7 @@ import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice; import org.mxchange.jcontactsbusiness.model.department.BusinessDepartment; import org.mxchange.jcontactsbusiness.model.department.Department; -import org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersData; +import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquartersData; import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; import org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition; import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition; @@ -111,7 +111,7 @@ public class BusinessEmployee implements Employable { * Head quarters id number (if the employee works there) */ @JoinColumn (name = "employee_headquarters_id") - @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.REFRESH) + @OneToOne (targetEntity = BusinessHeadquartersData.class, cascade = CascadeType.REFRESH) private HeadquartersData employeeHeadquarter; /** diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarters/BusinessHeadquartersData.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/BusinessHeadquartersData.java new file mode 100644 index 0000000..26554ea --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/headquarters/BusinessHeadquartersData.java @@ -0,0 +1,312 @@ +/* + * 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 . + */ +package org.mxchange.jcontactsbusiness.model.headquarters; + +import java.util.Date; +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.model.data.Country; +import org.mxchange.jcountry.model.data.CountryData; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO for company headquarts data + *

+ * @author Roland Häder + */ +@Entity (name = "company_headquarters") +@Table (name = "company_headquarters") +@SuppressWarnings ("PersistenceUnitPresent") +public class BusinessHeadquartersData 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 Date 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 Date getHeadquartersCreated () { + return this.headquartersCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setHeadquartersCreated (final Date 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; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.java deleted file mode 100644 index 1bd660a..0000000 --- a/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jcontactsbusiness.model.headquarters; - -import java.util.Date; -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.model.data.Country; -import org.mxchange.jcountry.model.data.CountryData; -import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber; -import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for company headquarts data - *

- * @author Roland Häder - */ -@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 Date 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 Date getHeadquartersCreated () { - return this.headquartersCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setHeadquartersCreated (final Date 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; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java index 043e7f2..ece3374 100644 --- a/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java +++ b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java @@ -16,76 +16,142 @@ */ package org.mxchange.jcontactsbusiness.model.logo; -import java.io.Serializable; import java.util.Date; +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.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** - * A POJI for business logos + * A POJO for company logos *

* @author Roland Häder */ -public interface BusinessLogo extends Serializable { +@Entity (name = "company_logos") +@Table (name = "company_logos") +@SuppressWarnings ("PersistenceUnitPresent") +public class BusinessLogo implements Logo { /** - * Getter for logo's local file name - *

- * @return Logo's local file name + * Serial number */ - String getLogoFileName (); + @Transient + private static final long serialVersionUID = 475_871_875_718_751_285L; /** - * Setter for logo's local file name - *

- * @param logoFileName Logo's local file name + * Timestamp when this entry has been created */ - void setLogoFileName (final String logoFileName); + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "logo_entry_created", nullable = false, updatable = false) + private Date logoCreated; /** - * Getter for logo's id number - *

- * @return Logo's id number + * Local file name of the logo (relative to /resources/logos/) */ - Long getLogoId (); + @Basic (optional = false) + @Column (name = "logo_file_name", nullable = false, unique = true, updatable = false) + private String logoFileName; /** - * Setter for logo's id number - *

- * @param logoId Logo's id number + * Id number */ - void setLogoId (final Long logoId); + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "logo_id", nullable = false, updatable = false) + private Long logoId; /** - * Getter for user owner instance - *

- * @return User owner instance + * Logo uploader user instance */ - User getLogoUploader (); + @JoinColumn (name = "logo_uploader_id", nullable = false, updatable = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + private User logoUploader; - /** - * Setter for user owner instance - *

- * @param logoUploader User owner instance - */ - void setLogoUploader (final User logoUploader); + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } - /** - * Getter for timestamp when this entry has been created - *

- * @return Timestamp when this entry has been created - */ - Date getLogoCreated (); + final Logo other = (Logo) object; - /** - * Setter for timestamp when this entry has been created - *

- * @param logoCreated Timestamp when this entry has been created - */ - void setLogoCreated (final Date logoCreated); + if (!Objects.equals(this.getLogoId(), other.getLogoId())) { + return false; + } else if (!Objects.equals(this.getLogoUploader(), other.getLogoUploader())) { + return false; + } else if (!Objects.equals(this.getLogoFileName(), other.getLogoFileName())) { + return false; + } + + return true; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Date getLogoCreated () { + return this.logoCreated; + } @Override - boolean equals (final Object object); + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setLogoCreated (final Date logoCreated) { + this.logoCreated = logoCreated; + } @Override - int hashCode (); + public String getLogoFileName () { + return this.logoFileName; + } + + @Override + public void setLogoFileName (final String logoFileName) { + this.logoFileName = logoFileName; + } + + @Override + public Long getLogoId () { + return this.logoId; + } + + @Override + public void setLogoId (final Long logoId) { + this.logoId = logoId; + } + + @Override + public User getLogoUploader () { + return this.logoUploader; + } + + @Override + public void setLogoUploader (final User logoUploader) { + this.logoUploader = logoUploader; + } + + @Override + public int hashCode () { + int hash = 3; + + hash = 53 * hash + Objects.hashCode(this.getLogoId()); + hash = 53 * hash + Objects.hashCode(this.getLogoFileName()); + hash = 53 * hash + Objects.hashCode(this.getLogoUploader()); + + return hash; + } + } diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/CompanyLogo.java b/src/org/mxchange/jcontactsbusiness/model/logo/CompanyLogo.java deleted file mode 100644 index f4067d4..0000000 --- a/src/org/mxchange/jcontactsbusiness/model/logo/CompanyLogo.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jcontactsbusiness.model.logo; - -import java.util.Date; -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.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for company logos - *

- * @author Roland Häder - */ -@Entity (name = "company_logos") -@Table (name = "company_logos") -@SuppressWarnings ("PersistenceUnitPresent") -public class CompanyLogo implements BusinessLogo { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 475_871_875_718_751_285L; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "logo_entry_created", nullable = false, updatable = false) - private Date logoCreated; - - /** - * Local file name of the logo (relative to /resources/logos/) - */ - @Basic (optional = false) - @Column (name = "logo_file_name", nullable = false, unique = true, updatable = false) - private String logoFileName; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "logo_id", nullable = false, updatable = false) - private Long logoId; - - /** - * Logo uploader user instance - */ - @JoinColumn (name = "logo_uploader_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User logoUploader; - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final BusinessLogo other = (BusinessLogo) object; - - if (!Objects.equals(this.getLogoId(), other.getLogoId())) { - return false; - } else if (!Objects.equals(this.getLogoUploader(), other.getLogoUploader())) { - return false; - } else if (!Objects.equals(this.getLogoFileName(), other.getLogoFileName())) { - return false; - } - - return true; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Date getLogoCreated () { - return this.logoCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setLogoCreated (final Date logoCreated) { - this.logoCreated = logoCreated; - } - - @Override - public String getLogoFileName () { - return this.logoFileName; - } - - @Override - public void setLogoFileName (final String logoFileName) { - this.logoFileName = logoFileName; - } - - @Override - public Long getLogoId () { - return this.logoId; - } - - @Override - public void setLogoId (final Long logoId) { - this.logoId = logoId; - } - - @Override - public User getLogoUploader () { - return this.logoUploader; - } - - @Override - public void setLogoUploader (final User logoUploader) { - this.logoUploader = logoUploader; - } - - @Override - public int hashCode () { - int hash = 3; - - hash = 53 * hash + Objects.hashCode(this.getLogoId()); - hash = 53 * hash + Objects.hashCode(this.getLogoFileName()); - hash = 53 * hash + Objects.hashCode(this.getLogoUploader()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/Logo.java b/src/org/mxchange/jcontactsbusiness/model/logo/Logo.java new file mode 100644 index 0000000..ea30fd5 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/logo/Logo.java @@ -0,0 +1,91 @@ +/* + * 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 . + */ +package org.mxchange.jcontactsbusiness.model.logo; + +import java.io.Serializable; +import java.util.Date; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for business logos + *

+ * @author Roland Häder + */ +public interface Logo extends Serializable { + + /** + * Getter for logo's local file name + *

+ * @return Logo's local file name + */ + String getLogoFileName (); + + /** + * Setter for logo's local file name + *

+ * @param logoFileName Logo's local file name + */ + void setLogoFileName (final String logoFileName); + + /** + * Getter for logo's id number + *

+ * @return Logo's id number + */ + Long getLogoId (); + + /** + * Setter for logo's id number + *

+ * @param logoId Logo's id number + */ + void setLogoId (final Long logoId); + + /** + * Getter for user owner instance + *

+ * @return User owner instance + */ + User getLogoUploader (); + + /** + * Setter for user owner instance + *

+ * @param logoUploader User owner instance + */ + void setLogoUploader (final User logoUploader); + + /** + * Getter for timestamp when this entry has been created + *

+ * @return Timestamp when this entry has been created + */ + Date getLogoCreated (); + + /** + * Setter for timestamp when this entry has been created + *

+ * @param logoCreated Timestamp when this entry has been created + */ + void setLogoCreated (final Date logoCreated); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +}