From: Roland Häder Date: Thu, 10 Aug 2017 20:46:12 +0000 (+0200) Subject: Moved *BasicData POJO/I into deeper package X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8fa3f2e1e8b1603824a7bf5cfcb10211a7372421;p=jcontacts-business-core.git Moved *BasicData POJO/I into deeper package --- diff --git a/src/org/mxchange/jcontactsbusiness/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/BusinessBasicData.java deleted file mode 100644 index 49f0d87..0000000 --- a/src/org/mxchange/jcontactsbusiness/BusinessBasicData.java +++ /dev/null @@ -1,266 +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; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.List; -import org.mxchange.jcontactsbusiness.branch.BranchOffice; -import org.mxchange.jcontactsbusiness.employee.Employee; -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; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for business contact classes - *

- * @author Roland Häder - */ -public interface BusinessBasicData extends Serializable { - - /** - * Getter for branches list - *

- * @return Branches list - */ - List getBrancheOffices (); - - /** - * Setter for branches list - *

- * @param branches Branches list - */ - void setBrancheOffices (final List branches); - - /** - * Getter for company contact person - *

- * @return Company contact person - */ - Employee getCompanyContactEmployee (); - - /** - * Setter for company contact person - *

- * @param companyContact Company contact person - */ - void setCompanyContactEmployee (final Employee companyContact); - - /** - * Getter for business contact id - *

- * @return Business contact id - */ - Long getBusinessDataId (); - - /** - * Setter for business contact id - *

- * @param businessContactId Business contact id - */ - void setBusinessDataId (final Long businessContactId); - - /** - * Getter for company founder - *

- * @return Company founder - */ - Employee getCompanyFounder (); - - /** - * Setter for company founder - *

- * @param companyFounder Company founder - */ - void setCompanyFounder (final Employee companyFounder); - - /** - * Getter for headquarters data - *

- * @return Headquarters data - */ - HeadQuartersData getHeadQuartersData (); - - /** - * Setter for headquarters data - *

- * @param headQuartersData Headquarters data - */ - void setHeadQuartersData (final HeadQuartersData headQuartersData); - - /** - * Getter for user owner instance - *

- * @return User owner instance - */ - User getContactCompanyUserOwner (); - - /** - * Setter for user owner instance - *

- * @param contactUserOwner User owner instance - */ - void setContactCompanyUserOwner (final User contactUserOwner); - - /** - * Getter for timestamp when this entry has been created - *

- * @return Timestamp when this entry has been created - */ - Calendar getContactCreated (); - - /** - * Setter for timestamp when this entry has been created - *

- * @param contactCreated Timestamp when this entry has been created - */ - void setContactCreated (final Calendar contactCreated); - - /** - * Getter for comments - *

- * @return Comments - */ - String getCompanyComments (); - - /** - * Setter for comments - *

- * @param companyComments Comments - */ - void setCompanyComments (final String companyComments); - - /** - * Getter for email address - *

- * @return Email address - */ - String getCompanyEmailAddress (); - - /** - * Setter for email address - *

- * @param companyEmailAddress Email address - */ - void setCompanyEmailAddress (final String companyEmailAddress); - - /** - * Getter for list of fax number - *

- * @return Fax numbers - */ - DialableFaxNumber getCompanyFaxNumber (); - - /** - * Setter for list of fax number - *

- * @param companyFaxNumber Fax numbers - */ - void setCompanyFaxNumber (final DialableFaxNumber companyFaxNumber); - - /** - * Getter for legal status - *

- * @return Legal status - */ - String getCompanyLegalStatus (); - - /** - * Setter for legal status - *

- * @param companyLegalStatus Legal status - */ - void setCompanyLegalStatus (final String companyLegalStatus); - - /** - * Getter for company logo - *

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

- * @param companyLogo Company logo - */ - void setCompanyLogo (final BusinessLogo companyLogo); - - /** - * Getter for company name - *

- * @return Company name - */ - String getCompanyName (); - - /** - * Setter for company name - *

- * @param companyName Company name - */ - void setCompanyName (final String companyName); - - /** - * Getter for list of phone number - *

- * @return Phone numbers - */ - DialableLandLineNumber getCompanyPhoneNumber (); - - /** - * Setter for list of phone number - *

- * @param companyPhoneNumber Phone numbers - */ - void setCompanyPhoneNumber (final DialableLandLineNumber companyPhoneNumber); - - /** - * Getter for tax number - *

- * @return Tax number - */ - String getCompanyTaxNumber (); - - /** - * Setter for tax number - *

- * @param companyTaxNumber Tax number - */ - void setCompanyTaxNumber (final String companyTaxNumber); - - /** - * Getter for website URL - *

- * @return Website URL - */ - String getCompanyWebsiteUrl (); - - /** - * Setter for website URL - *

- * @param companyWebsiteUrl Website URL - */ - void setCompanyWebsiteUrl (final String companyWebsiteUrl); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java deleted file mode 100644 index 5386d72..0000000 --- a/src/org/mxchange/jcontactsbusiness/CompanyBasicData.java +++ /dev/null @@ -1,388 +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; - -import java.util.Calendar; -import java.util.List; -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.Lob; -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.branch.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.logo.BusinessLogo; -import org.mxchange.jcontactsbusiness.logo.CompanyLogo; -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 business basic data - *

- * @author Roland Häder - */ -@Entity (name = "company_basic_data") -@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") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class CompanyBasicData implements BusinessBasicData { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 470_375_172_748_691L; - - /** - * Reference to company branch offices - */ - @Transient - private List brancheOffices; - - /** - * Id number - */ - @Id - @Column (name = "business_data_id", nullable = false, updatable = false) - @GeneratedValue (strategy = GenerationType.IDENTITY) - private Long businessDataId; - - /** - * Comments (any) - */ - @Lob - @Column (name = "company_comments") - private String companyComments; - - /** - * Reference to contact person - */ - @JoinColumn (name = "company_contact_employee_id") - @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) - private Employee companyContactEmployee; - - /** - * Company's main email address (example: info@company.com) - */ - @Column (name = "company_email_address", length = 100) - private String companyEmailAddress; - - /** - * Company's main fax numbers: +ccxxxxxxxxxx - */ - @JoinColumn (name = "company_fax_number_id") - @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) - private DialableFaxNumber companyFaxNumber; - - /** - * Reference to CEO "employee" - */ - @JoinColumn (name = "company_founder_id") - @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) - private Employee companyFounder; - - /** - * Legal status of company (example: "Inc.", "GmbH") - */ - @Column (name = "company_legal_status") - private String companyLegalStatus; - - /** - * Id number of company logo - */ - @JoinColumn (name = "company_logo_id") - @OneToOne (targetEntity = CompanyLogo.class, cascade = CascadeType.ALL) - private BusinessLogo companyLogo; - - /** - * Company name - */ - @Basic (optional = false) - @Column (name = "company_name", length = 100, nullable = false) - 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; - - /** - * URL for company website - */ - @Column (name = "company_website_url") - private String companyWebsiteUrl; - - /** - * User owner instance - */ - @JoinColumn (name = "company_owner_user_id") - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH) - private User contactCompanyUserOwner; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "company_entry_created", nullable = false, updatable = false) - private Calendar contactCreated; - - /** - * Reference to headquarters data - */ - @JoinColumn (name = "company_headquarters_data_id") - @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL) - private HeadQuartersData headQuartersData; - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final BusinessBasicData other = (BusinessBasicData) object; - - if (!Objects.equals(this.getBusinessDataId(), other.getBusinessDataId())) { - return false; - } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) { - return false; - } else if (!Objects.equals(this.getCompanyLegalStatus(), other.getCompanyLegalStatus())) { - return false; - } else if (!Objects.equals(this.getHeadQuartersData(), other.getHeadQuartersData())) { - return false; - } else if (!Objects.equals(this.getCompanyContactEmployee(), other.getCompanyContactEmployee())) { - return false; - } else if (!Objects.equals(this.getCompanyFounder(), other.getCompanyFounder())) { - return false; - } - - return true; - } - - @Override - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List getBrancheOffices () { - return this.brancheOffices; - } - - @Override - @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") - public void setBrancheOffices (final List brancheOffices) { - 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; - } - - @Override - public void setCompanyComments (final String companyComments) { - this.companyComments = companyComments; - } - - @Override - public Employee getCompanyContactEmployee () { - return this.companyContactEmployee; - } - - @Override - public void setCompanyContactEmployee (final Employee companyContactEmployee) { - this.companyContactEmployee = companyContactEmployee; - } - - @Override - public String getCompanyEmailAddress () { - return this.companyEmailAddress; - } - - @Override - public void setCompanyEmailAddress (final String companyEmailAddress) { - this.companyEmailAddress = companyEmailAddress; - } - - @Override - public DialableFaxNumber getCompanyFaxNumber () { - return this.companyFaxNumber; - } - - @Override - public void setCompanyFaxNumber (final DialableFaxNumber companyFaxNumber) { - this.companyFaxNumber = companyFaxNumber; - } - - @Override - public Employee getCompanyFounder () { - return this.companyFounder; - } - - @Override - public void setCompanyFounder (final Employee companyFounder) { - this.companyFounder = companyFounder; - } - - @Override - public String getCompanyLegalStatus () { - return this.companyLegalStatus; - } - - @Override - public void setCompanyLegalStatus (final String companyLegalStatus) { - this.companyLegalStatus = companyLegalStatus; - } - - @Override - public BusinessLogo getCompanyLogo () { - return this.companyLogo; - } - - @Override - public void setCompanyLogo (final BusinessLogo companyLogoId) { - this.companyLogo = companyLogoId; - } - - @Override - public String getCompanyName () { - return this.companyName; - } - - @Override - public void setCompanyName (final String companyName) { - this.companyName = companyName; - } - - @Override - public DialableLandLineNumber getCompanyPhoneNumber () { - return this.companyPhoneNumber; - } - - @Override - public void setCompanyPhoneNumber (final DialableLandLineNumber companyPhoneNumber) { - this.companyPhoneNumber = companyPhoneNumber; - } - - @Override - public String getCompanyTaxNumber () { - return this.companyTaxNumber; - } - - @Override - public void setCompanyTaxNumber (final String companyTaxNumber) { - this.companyTaxNumber = companyTaxNumber; - } - - @Override - public String getCompanyWebsiteUrl () { - return this.companyWebsiteUrl; - } - - @Override - public void setCompanyWebsiteUrl (final String companyWebsiteUrl) { - this.companyWebsiteUrl = companyWebsiteUrl; - } - - @Override - public User getContactCompanyUserOwner () { - return this.contactCompanyUserOwner; - } - - @Override - public void setContactCompanyUserOwner (final User contactCompanyUserOwner) { - this.contactCompanyUserOwner = contactCompanyUserOwner; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getContactCreated () { - return this.contactCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setContactCreated (final Calendar contactCreated) { - this.contactCreated = contactCreated; - } - - @Override - public HeadQuartersData getHeadQuartersData () { - return this.headQuartersData; - } - - @Override - public void setHeadQuartersData (final HeadQuartersData headQuartersData) { - this.headQuartersData = headQuartersData; - } - - @Override - public int hashCode () { - int hash = 3; - - hash = 37 * hash + Objects.hashCode(this.getBusinessDataId()); - hash = 37 * hash + Objects.hashCode(this.getCompanyName()); - hash = 37 * hash + Objects.hashCode(this.getCompanyLegalStatus()); - hash = 37 * hash + Objects.hashCode(this.getHeadQuartersData()); - hash = 37 * hash + Objects.hashCode(this.getCompanyContactEmployee()); - hash = 37 * hash + Objects.hashCode(this.getCompanyFounder()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/BusinessBasicData.java new file mode 100644 index 0000000..0485562 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/basicdata/BusinessBasicData.java @@ -0,0 +1,252 @@ +/* + * 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.basicdata; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; +import org.mxchange.jcontactsbusiness.branch.BranchOffice; +import org.mxchange.jcontactsbusiness.employee.Employee; +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; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for business contact classes + *

+ * @author Roland Häder + */ +public interface BusinessBasicData extends Serializable { + + /** + * Getter for branches list + *

+ * @return Branches list + */ + List getBrancheOffices (); + + /** + * Setter for branches list + *

+ * @param branches Branches list + */ + void setBrancheOffices (final List branches); + + /** + * Getter for company contact person + *

+ * @return Company contact person + */ + Employee getCompanyContactEmployee (); + + /** + * Setter for company contact person + *

+ * @param companyContact Company contact person + */ + void setCompanyContactEmployee (final Employee companyContact); + + /** + * Getter for business contact id + *

+ * @return Business contact id + */ + Long getBusinessDataId (); + + /** + * Setter for business contact id + *

+ * @param businessContactId Business contact id + */ + void setBusinessDataId (final Long businessContactId); + + /** + * Getter for company founder + *

+ * @return Company founder + */ + Employee getCompanyFounder (); + + /** + * Setter for company founder + *

+ * @param companyFounder Company founder + */ + void setCompanyFounder (final Employee companyFounder); + + /** + * Getter for headquarters data + *

+ * @return Headquarters data + */ + HeadQuartersData getHeadQuartersData (); + + /** + * Setter for headquarters data + *

+ * @param headQuartersData Headquarters data + */ + void setHeadQuartersData (final HeadQuartersData headQuartersData); + + /** + * Getter for user owner instance + *

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

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

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

+ * @param contactCreated Timestamp when this entry has been created + */ + void setContactCreated (final Calendar contactCreated); + + /** + * Getter for comments + *

+ * @return Comments + */ + String getCompanyComments (); + + /** + * Setter for comments + *

+ * @param companyComments Comments + */ + void setCompanyComments (final String companyComments); + + /** + * Getter for email address + *

+ * @return Email address + */ + String getCompanyEmailAddress (); + + /** + * Setter for email address + *

+ * @param companyEmailAddress Email address + */ + void setCompanyEmailAddress (final String companyEmailAddress); + + /** + * Getter for list of fax number + *

+ * @return Fax numbers + */ + DialableFaxNumber getCompanyFaxNumber (); + + /** + * Setter for list of fax number + *

+ * @param companyFaxNumber Fax numbers + */ + void setCompanyFaxNumber (final DialableFaxNumber companyFaxNumber); + + /** + * Getter for company logo + *

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

+ * @param companyLogo Company logo + */ + void setCompanyLogo (final BusinessLogo companyLogo); + + /** + * Getter for company name + *

+ * @return Company name + */ + String getCompanyName (); + + /** + * Setter for company name + *

+ * @param companyName Company name + */ + void setCompanyName (final String companyName); + + /** + * Getter for list of phone number + *

+ * @return Phone numbers + */ + DialableLandLineNumber getCompanyPhoneNumber (); + + /** + * Setter for list of phone number + *

+ * @param companyPhoneNumber Phone numbers + */ + void setCompanyPhoneNumber (final DialableLandLineNumber companyPhoneNumber); + + /** + * Getter for tax number + *

+ * @return Tax number + */ + String getCompanyTaxNumber (); + + /** + * Setter for tax number + *

+ * @param companyTaxNumber Tax number + */ + void setCompanyTaxNumber (final String companyTaxNumber); + + /** + * Getter for website URL + *

+ * @return Website URL + */ + String getCompanyWebsiteUrl (); + + /** + * Setter for website URL + *

+ * @param companyWebsiteUrl Website URL + */ + void setCompanyWebsiteUrl (final String companyWebsiteUrl); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java new file mode 100644 index 0000000..d821571 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java @@ -0,0 +1,369 @@ +/* + * 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.basicdata; + +import java.util.Calendar; +import java.util.List; +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.Lob; +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.branch.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.logo.BusinessLogo; +import org.mxchange.jcontactsbusiness.logo.CompanyLogo; +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 business basic data + *

+ * @author Roland Häder + */ +@Entity (name = "company_basic_data") +@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") + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class CompanyBasicData implements BusinessBasicData { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 470_375_172_748_691L; + + /** + * Reference to company branch offices + */ + @Transient + private List brancheOffices; + + /** + * Id number + */ + @Id + @Column (name = "business_data_id", nullable = false, updatable = false) + @GeneratedValue (strategy = GenerationType.IDENTITY) + private Long businessDataId; + + /** + * Comments (any) + */ + @Lob + @Column (name = "company_comments") + private String companyComments; + + /** + * Reference to contact person + */ + @JoinColumn (name = "company_contact_employee_id") + @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) + private Employee companyContactEmployee; + + /** + * Company's main email address (example: info@company.com) + */ + @Column (name = "company_email_address", length = 100) + private String companyEmailAddress; + + /** + * Company's main fax numbers: +ccxxxxxxxxxx + */ + @JoinColumn (name = "company_fax_number_id") + @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) + private DialableFaxNumber companyFaxNumber; + + /** + * Reference to CEO "employee" + */ + @JoinColumn (name = "company_founder_id") + @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) + private Employee companyFounder; + + /** + * Id number of company logo + */ + @JoinColumn (name = "company_logo_id") + @OneToOne (targetEntity = CompanyLogo.class, cascade = CascadeType.ALL) + private BusinessLogo companyLogo; + + /** + * Company name + */ + @Basic (optional = false) + @Column (name = "company_name", length = 100, nullable = false) + 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; + + /** + * URL for company website + */ + @Column (name = "company_website_url") + private String companyWebsiteUrl; + + /** + * User owner instance + */ + @JoinColumn (name = "company_owner_user_id") + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH) + private User contactCompanyUserOwner; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "company_entry_created", nullable = false, updatable = false) + private Calendar contactCreated; + + /** + * Reference to headquarters data + */ + @JoinColumn (name = "company_headquarters_data_id") + @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL) + private HeadQuartersData headQuartersData; + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final BusinessBasicData other = (BusinessBasicData) object; + + if (!Objects.equals(this.getBusinessDataId(), other.getBusinessDataId())) { + return false; + } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) { + return false; + } else if (!Objects.equals(this.getHeadQuartersData(), other.getHeadQuartersData())) { + return false; + } else if (!Objects.equals(this.getCompanyContactEmployee(), other.getCompanyContactEmployee())) { + return false; + } else if (!Objects.equals(this.getCompanyFounder(), other.getCompanyFounder())) { + return false; + } + + return true; + } + + @Override + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getBrancheOffices () { + return this.brancheOffices; + } + + @Override + @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") + public void setBrancheOffices (final List brancheOffices) { + 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; + } + + @Override + public void setCompanyComments (final String companyComments) { + this.companyComments = companyComments; + } + + @Override + public Employee getCompanyContactEmployee () { + return this.companyContactEmployee; + } + + @Override + public void setCompanyContactEmployee (final Employee companyContactEmployee) { + this.companyContactEmployee = companyContactEmployee; + } + + @Override + public String getCompanyEmailAddress () { + return this.companyEmailAddress; + } + + @Override + public void setCompanyEmailAddress (final String companyEmailAddress) { + this.companyEmailAddress = companyEmailAddress; + } + + @Override + public DialableFaxNumber getCompanyFaxNumber () { + return this.companyFaxNumber; + } + + @Override + public void setCompanyFaxNumber (final DialableFaxNumber companyFaxNumber) { + this.companyFaxNumber = companyFaxNumber; + } + + @Override + public Employee getCompanyFounder () { + return this.companyFounder; + } + + @Override + public void setCompanyFounder (final Employee companyFounder) { + this.companyFounder = companyFounder; + } + + @Override + public BusinessLogo getCompanyLogo () { + return this.companyLogo; + } + + @Override + public void setCompanyLogo (final BusinessLogo companyLogoId) { + this.companyLogo = companyLogoId; + } + + @Override + public String getCompanyName () { + return this.companyName; + } + + @Override + public void setCompanyName (final String companyName) { + this.companyName = companyName; + } + + @Override + public DialableLandLineNumber getCompanyPhoneNumber () { + return this.companyPhoneNumber; + } + + @Override + public void setCompanyPhoneNumber (final DialableLandLineNumber companyPhoneNumber) { + this.companyPhoneNumber = companyPhoneNumber; + } + + @Override + public String getCompanyTaxNumber () { + return this.companyTaxNumber; + } + + @Override + public void setCompanyTaxNumber (final String companyTaxNumber) { + this.companyTaxNumber = companyTaxNumber; + } + + @Override + public String getCompanyWebsiteUrl () { + return this.companyWebsiteUrl; + } + + @Override + public void setCompanyWebsiteUrl (final String companyWebsiteUrl) { + this.companyWebsiteUrl = companyWebsiteUrl; + } + + @Override + public User getContactCompanyUserOwner () { + return this.contactCompanyUserOwner; + } + + @Override + public void setContactCompanyUserOwner (final User contactCompanyUserOwner) { + this.contactCompanyUserOwner = contactCompanyUserOwner; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getContactCreated () { + return this.contactCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setContactCreated (final Calendar contactCreated) { + this.contactCreated = contactCreated; + } + + @Override + public HeadQuartersData getHeadQuartersData () { + return this.headQuartersData; + } + + @Override + public void setHeadQuartersData (final HeadQuartersData headQuartersData) { + this.headQuartersData = headQuartersData; + } + + @Override + public int hashCode () { + int hash = 3; + + hash = 37 * hash + Objects.hashCode(this.getBusinessDataId()); + hash = 37 * hash + Objects.hashCode(this.getCompanyName()); + hash = 37 * hash + Objects.hashCode(this.getHeadQuartersData()); + hash = 37 * hash + Objects.hashCode(this.getCompanyContactEmployee()); + hash = 37 * hash + Objects.hashCode(this.getCompanyFounder()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java index 3616fc2..be2c01f 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java @@ -22,7 +22,7 @@ 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.BusinessBasicData; +import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; /** * A POJI for branch offices diff --git a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java index b52338f..4446eb2 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java @@ -31,8 +31,8 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.mxchange.jcontactsbusiness.BusinessBasicData; -import org.mxchange.jcontactsbusiness.CompanyBasicData; +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; diff --git a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java index 6e56705..3e74a6e 100644 --- a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java @@ -32,7 +32,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.mxchange.jcontactsbusiness.CompanyBasicData; +import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice; import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; @@ -41,7 +41,7 @@ import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData; import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; -import org.mxchange.jcontactsbusiness.BusinessBasicData; +import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; /** * A POJO for company departments diff --git a/src/org/mxchange/jcontactsbusiness/department/Department.java b/src/org/mxchange/jcontactsbusiness/department/Department.java index 08de410..1615f98 100644 --- a/src/org/mxchange/jcontactsbusiness/department/Department.java +++ b/src/org/mxchange/jcontactsbusiness/department/Department.java @@ -22,7 +22,7 @@ import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.employee.Employee; import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; import org.mxchange.jusercore.model.user.User; -import org.mxchange.jcontactsbusiness.BusinessBasicData; +import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; /** * A POJI for company departments diff --git a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java index c16ab48..8901552 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java @@ -33,7 +33,7 @@ import javax.persistence.TemporalType; import javax.persistence.Transient; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jcontactsbusiness.CompanyBasicData; +import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice; import org.mxchange.jcontactsbusiness.department.CompanyDepartment; @@ -46,7 +46,7 @@ import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.mobile.MobileNumber; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; -import org.mxchange.jcontactsbusiness.BusinessBasicData; +import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; /** * A POJO for company employees (including CEO) diff --git a/src/org/mxchange/jcontactsbusiness/employee/Employee.java b/src/org/mxchange/jcontactsbusiness/employee/Employee.java index a7e9b0b..071f599 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/Employee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/Employee.java @@ -25,7 +25,7 @@ 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.BusinessBasicData; +import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; /** * A POJI for employees diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataAlreadyAddedException.java b/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataAlreadyAddedException.java index 2d99dd4..50b2aaa 100644 --- a/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataAlreadyAddedException.java +++ b/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataAlreadyAddedException.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.exceptions; import java.text.MessageFormat; -import org.mxchange.jcontactsbusiness.BusinessBasicData; +import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; /** * Thrown if the given BusinessBasicData instance is already added