From be70d0221360580992a841ccdb695a44d69226fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 18 Oct 2017 01:34:34 +0200 Subject: [PATCH] Continued: - renamed many other entity (classes) to Business MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/basicdata/BasicData.java | 6 +- .../model/basicdata/BusinessBasicData.java | 14 +- .../model/department/BusinessDepartment.java | 4 +- .../model/employee/BusinessEmployee.java | 4 +- ...ata.java => BusinessHeadquartersData.java} | 2 +- .../model/logo/BusinessLogo.java | 152 ++++++++++++----- .../model/logo/CompanyLogo.java | 157 ------------------ .../jcontactsbusiness/model/logo/Logo.java | 91 ++++++++++ 8 files changed, 215 insertions(+), 215 deletions(-) rename src/org/mxchange/jcontactsbusiness/model/headquarters/{CompanyHeadquartersData.java => BusinessHeadquartersData.java} (99%) delete mode 100644 src/org/mxchange/jcontactsbusiness/model/logo/CompanyLogo.java create mode 100644 src/org/mxchange/jcontactsbusiness/model/logo/Logo.java 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/CompanyHeadquartersData.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/BusinessHeadquartersData.java similarity index 99% rename from src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.java rename to src/org/mxchange/jcontactsbusiness/model/headquarters/BusinessHeadquartersData.java index 1bd660a..26554ea 100644 --- a/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.java +++ b/src/org/mxchange/jcontactsbusiness/model/headquarters/BusinessHeadquartersData.java @@ -48,7 +48,7 @@ import org.mxchange.jusercore.model.user.User; @Entity (name = "company_headquarters") @Table (name = "company_headquarters") @SuppressWarnings ("PersistenceUnitPresent") -public class CompanyHeadquartersData implements HeadquartersData { +public class BusinessHeadquartersData implements HeadquartersData { /** * Serial number 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 (); +} -- 2.39.5