From: Roland Häder Date: Sat, 9 Sep 2017 12:25:38 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9b4b67dc878ff4b121a17826d2a149f71cc9c7af;p=jcontacts-business-core.git Continued: - moved all model (entity) related classes/interfaces to own 'model' package Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/BusinessBasicData.java deleted file mode 100644 index 3d6afe5..0000000 --- a/src/org/mxchange/jcontactsbusiness/basicdata/BusinessBasicData.java +++ /dev/null @@ -1,252 +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.basicdata; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.List; -import org.mxchange.jcontactsbusiness.branchoffice.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 getBasicDataId (); - - /** - * Setter for business contact id - *

- * @param businessContactId Business contact id - */ - void setBasicDataId (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 getCompanyHeadQuartersData (); - - /** - * Setter for headquarters data - *

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

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

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

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

- * @param contactCreated Timestamp when this entry has been created - */ - void setCompanyCreated (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 getCompanyLandLineNumber (); - - /** - * Setter for list of phone number - *

- * @param companyPhoneNumber Phone numbers - */ - void setCompanyLandLineNumber (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 deleted file mode 100644 index 7d260e0..0000000 --- a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java +++ /dev/null @@ -1,394 +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.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.branchoffice.BranchOffice; -import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; -import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersData; -import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData; -import org.mxchange.jcontactsbusiness.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.basicDataId"), - @NamedQuery (name = "SearchBusinessDataById", query = "SELECT b FROM company_basic_data AS b WHERE b.basicDataId = :basicDataId") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class CompanyBasicData implements BusinessBasicData { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 470_375_172_748_691L; - - /** - * Id number - */ - @Id - @Column (name = "company_data_id", nullable = false, updatable = false) - @GeneratedValue (strategy = GenerationType.IDENTITY) - private Long basicDataId; - - /** - * Reference to company branch offices - */ - @Transient - private List brancheOffices; - - /** - * 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; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "company_entry_created", nullable = false, updatable = false) - private Calendar companyCreated; - - /** - * 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; - - /** - * Reference to headquarters data - */ - @JoinColumn (name = "company_headquarters_data_id") - @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) - private HeadquartersData companyHeadQuartersData; - - /** - * Company's main phone number: +ccxxxxxxxxxx - */ - @JoinColumn (name = "company_landline_number_id") - @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) - private DialableLandLineNumber companyLandLineNumber; - - /** - * Id number of company logo - */ - @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, unique = true) - private String companyName; - - /** - * Tax number - */ - @Column (name = "company_tax_number", length = 30) - private String companyTaxNumber; - - /** - * User owner instance - */ - @JoinColumn (name = "company_owner_user_id") - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH) - private User companyUserOwner; - - /** - * URL for company website - */ - @Column (name = "company_website_url") - private String companyWebsiteUrl; - - /** - * Default constructor, required for JPA - */ - public CompanyBasicData () { - } - - /** - * Constructor with company name - *

- * @param companyName Company name - */ - public CompanyBasicData (final String companyName) { - // First, validate all parameter - if (companyName == null) { - // Is null - throw new NullPointerException("companyName is null"); //NOI18N - } else if (companyName.isEmpty()) { - // Is null - throw new IllegalArgumentException("companyName is empty"); //NOI18N - } - - // Set company name - this.companyName = companyName; - } - - @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.getBasicDataId(), other.getBasicDataId())) { - return false; - } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) { - return false; - } else if (!Objects.equals(this.getCompanyHeadQuartersData(), other.getCompanyHeadQuartersData())) { - 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 - public Long getBasicDataId () { - return this.basicDataId; - } - - @Override - public void setBasicDataId (final Long basicDataId) { - this.basicDataId = basicDataId; - } - - @Override - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List getBrancheOffices () { - return this.brancheOffices; - } - - @Override - @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") - public void setBrancheOffices (final List brancheOffices) { - this.brancheOffices = brancheOffices; - } - - @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 - @SuppressWarnings ("ReturnOfDateField") - public Calendar getCompanyCreated () { - return this.companyCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setCompanyCreated (final Calendar companyCreated) { - this.companyCreated = companyCreated; - } - - @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 HeadquartersData getCompanyHeadQuartersData () { - return this.companyHeadQuartersData; - } - - @Override - public void setCompanyHeadQuartersData (final HeadquartersData companyHeadQuartersData) { - this.companyHeadQuartersData = companyHeadQuartersData; - } - - @Override - public DialableLandLineNumber getCompanyLandLineNumber () { - return this.companyLandLineNumber; - } - - @Override - public void setCompanyLandLineNumber (final DialableLandLineNumber companyLandLineNumber) { - this.companyLandLineNumber = companyLandLineNumber; - } - - @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 String getCompanyTaxNumber () { - return this.companyTaxNumber; - } - - @Override - public void setCompanyTaxNumber (final String companyTaxNumber) { - this.companyTaxNumber = companyTaxNumber; - } - - @Override - public User getCompanyUserOwner () { - return this.companyUserOwner; - } - - @Override - public void setCompanyUserOwner (final User companyUserOwner) { - this.companyUserOwner = companyUserOwner; - } - - @Override - public String getCompanyWebsiteUrl () { - return this.companyWebsiteUrl; - } - - @Override - public void setCompanyWebsiteUrl (final String companyWebsiteUrl) { - this.companyWebsiteUrl = companyWebsiteUrl; - } - - @Override - public int hashCode () { - int hash = 3; - - hash = 37 * hash + Objects.hashCode(this.getBasicDataId()); - hash = 37 * hash + Objects.hashCode(this.getCompanyName()); - hash = 37 * hash + Objects.hashCode(this.getCompanyHeadQuartersData()); - hash = 37 * hash + Objects.hashCode(this.getCompanyContactEmployee()); - hash = 37 * hash + Objects.hashCode(this.getCompanyFounder()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/branchoffice/BranchOffice.java b/src/org/mxchange/jcontactsbusiness/branchoffice/BranchOffice.java deleted file mode 100644 index 915847a..0000000 --- a/src/org/mxchange/jcontactsbusiness/branchoffice/BranchOffice.java +++ /dev/null @@ -1,250 +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.branchoffice; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for branch offices - *

- * @author Roland Häder - */ -public interface BranchOffice extends Serializable { - - /** - * Getter for branch office's city name - *

- * @return Branch office's city name - */ - String getBranchCity (); - - /** - * Setter for branch office's city name - *

- * @param branchCity Branch office's city name - */ - void setBranchCity (final String branchCity); - - /** - * Getter for branch office's email address - *

- * @return Branch office's email address - */ - String getBranchEmailAddress (); - - /** - * Setter for branch office's email address - *

- * @param branchEmailAddress Branch office's email address - */ - void setBranchEmailAddress (final String branchEmailAddress); - - /** - * Getter for branch office's fax number - *

- * @return Branch office's fax number - */ - DialableFaxNumber getBranchFaxNumber (); - - /** - * Setter for branch office's fax number - *

- * @param branchFaxNumber Branch office's fax number - */ - void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber); - - /** - * Getter for branch office's house number - *

- * @return Branch office's house number - */ - Short getBranchHouseNumber (); - - /** - * Setter for branch office's house number - *

- * @param branchHouseNumber Branch office's house number - */ - void setBranchHouseNumber (final Short branchHouseNumber); - - /** - * Getter for branch office's phone number - *

- * @return Branch office's phone number - */ - DialableLandLineNumber getBranchLandLineNumber (); - - /** - * Setter for branch office's phone number - *

- * @param branchPhoneNumber Branch office's phone number - */ - void setBranchLandLineNumber (final DialableLandLineNumber branchPhoneNumber); - - /** - * Getter for branch office's store - *

- * @return Branch office's store - */ - Short getBranchStore (); - - /** - * Setter for branch office's store - *

- * @param branchStore Branch office's store - */ - void setBranchStore (final Short branchStore); - - /** - * Getter for branch office's street name - *

- * @return Branch office's street name - */ - String getBranchStreet (); - - /** - * Setter for branch office's street name - *

- * @param branchStreet Branch office's street name - */ - void setBranchStreet (final String branchStreet); - - /** - * Getter for branch office's suite number - *

- * @return Branch office's suite number - */ - Short getBranchSuiteNumber (); - - /** - * Setter for branch office's suite number - *

- * @param branchSuiteNumber Branch office's suite number - */ - void setBranchSuiteNumber (final Short branchSuiteNumber); - - /** - * Getter for branch office's ZIP code - *

- * @return Branch office's ZIP code - */ - Integer getBranchZipCode (); - - /** - * Setter for branch office's ZIP code - *

- * @param branchZipCode Branch office's ZIP code - */ - void setBranchZipCode (final Integer branchZipCode); - - /** - * Getter for branch office's id number - *

- * @return Branch office's id number - */ - Long getBranchId (); - - /** - * Setter for branch office's id number - *

- * @param branchId Branch office's id number - */ - void setBranchId (final Long branchId); - - /** - * Getter for branch office's country - *

- * @return Branch office's country - */ - Country getBranchCountry (); - - /** - * Setter for branch office's country - *

- * @param branchCountryCode Branch office's country - */ - void setBranchCountry (final Country branchCountryCode); - - /** - * Getter for branch office's company - *

- * @return Branch office's company - */ - BusinessBasicData getBranchCompany (); - - /** - * Setter for branch office's company - *

- * @param branchCompany Branch office's company - */ - void setBranchCompany (final BusinessBasicData branchCompany); - - /** - * Getter branch office's contact person - *

- * @return Branch office's contact person - */ - Employee getBranchContactEmployee (); - - /** - * Setter branch office's contact person - *

- * @param branchEmployee Branch office's contact person - */ - void setBranchContactEmployee (final Employee branchEmployee); - - /** - * Getter for user owner instance - *

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

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

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

- * @param branchCreated Timestamp when this entry has been created - */ - void setBranchCreated (final Calendar branchCreated); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jcontactsbusiness/branchoffice/BranchOfficeUtils.java b/src/org/mxchange/jcontactsbusiness/branchoffice/BranchOfficeUtils.java deleted file mode 100644 index 428ae3e..0000000 --- a/src/org/mxchange/jcontactsbusiness/branchoffice/BranchOfficeUtils.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jcontactsbusiness.branchoffice; - -import java.io.Serializable; -import java.util.Objects; - -/** - * An utilities class for branch offices - * - * @author Roland Häder - */ -public class BranchOfficeUtils implements Serializable { - - /** - * Serial number - */ - private static final long serialVersionUID = 69_537_867_224_651L; - - /** - * Checks if both branch offices have same address. This method will throw - * an {@code NullPointerException} if one of the instances is null. - *

- * @param branchOffice1 Branch office 1 - * @param branchOffice2 Branch office 2 - *

- * @return Whether both branch office addresses are the same - *

- * @throws NullPointerException If one of the instances is null - */ - public static boolean isSameAddress (final BranchOffice branchOffice1, final BranchOffice branchOffice2) { - // Check that both parameters are not null - if (null == branchOffice1) { - // Throw NPE - throw new NullPointerException("branchOffice1 is null"); //NOI18N - } else if (null == branchOffice2) { - // Throw NPE - throw new NullPointerException("branchOffice2 is null"); //NOI18N - } - - // Default is the same - boolean isSameAddress = true; - - // Compare both addresses - if (!Objects.equals(branchOffice1.getBranchCompany(), branchOffice2.getBranchCompany())) { - // Not the same - isSameAddress = false; - } else if (!Objects.equals(branchOffice1.getBranchCountry(), branchOffice2.getBranchCountry())) { - // Not the same - isSameAddress = false; - } else if (!Objects.equals(branchOffice1.getBranchCity(), branchOffice2.getBranchCity())) { - // Not the same - isSameAddress = false; - } else if (!Objects.equals(branchOffice1.getBranchZipCode(), branchOffice2.getBranchZipCode())) { - // Not the same - isSameAddress = false; - } else if (!Objects.equals(branchOffice1.getBranchStreet(), branchOffice2.getBranchStreet())) { - // Not the same - isSameAddress = false; - } else if (!Objects.equals(branchOffice1.getBranchHouseNumber(), branchOffice2.getBranchHouseNumber())) { - // Not the same - isSameAddress = false; - } else if (!Objects.equals(branchOffice1.getBranchStore(), branchOffice2.getBranchStore())) { - // Not the same - isSameAddress = false; - } else if (!Objects.equals(branchOffice1.getBranchSuiteNumber(), branchOffice2.getBranchSuiteNumber())) { - // Not the same - isSameAddress = false; - } - - // Return flag - return isSameAddress; - } - - /** - * Private default constructor - */ - private BranchOfficeUtils () { - // Utilities don't have instances - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/branchoffice/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/branchoffice/CompanyBranchOffice.java deleted file mode 100644 index 93663af..0000000 --- a/src/org/mxchange/jcontactsbusiness/branchoffice/CompanyBranchOffice.java +++ /dev/null @@ -1,447 +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.branchoffice; - -import java.text.MessageFormat; -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; -import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; -import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.data.CountryData; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for company branch offices - *

- * @author Roland Häder - */ -@Entity (name = "company_branch_offices") -@Table (name = "company_branch_offices") -@NamedQueries ({ - @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC") -}) -@SuppressWarnings ("PersistenceUnitPresent") -public class CompanyBranchOffice implements BranchOffice { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 47_957_817_276_871_852L; - - /** - * Branch office's city name - */ - @Basic (optional = false) - @Column (name = "branch_city", length = 100, nullable = false) - private String branchCity; - - /** - * Company that has this branch office - */ - @JoinColumn (name = "branch_company_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CompanyBasicData.class, optional = false, cascade = CascadeType.REFRESH) - private BusinessBasicData branchCompany; - - /** - * Reference to contact person - */ - @JoinColumn (name = "branch_contact_employee_id") - @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.REFRESH) - private Employee branchContactEmployee; - - /** - * Branch office's country code - */ - @JoinColumn (name = "branch_country_id", nullable = false) - @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) - private Country branchCountry; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "branch_entry_created", nullable = false, updatable = false) - private Calendar branchCreated; - - /** - * Branch office's main email address (example: branch-name@company.com) - */ - @Column (name = "branch_email_address", length = 100) - private String branchEmailAddress; - - /** - * Branch office's main fax number: +ccxxxxxxxxxx - */ - @JoinColumn (name = "branch_fax_number_id") - @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) - private DialableFaxNumber branchFaxNumber; - - /** - * Branch office's house number - */ - @Basic (optional = false) - @Column (name = "branch_house_number", length = 3, nullable = false) - private Short branchHouseNumber; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "branch_id", nullable = false, updatable = false) - private Long branchId; - - /** - * Branch office's main land-line number: +ccxxxxxxxxxx - */ - @JoinColumn (name = "branch_landline_number_id") - @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) - private DialableLandLineNumber branchLandLineNumber; - - /** - * Branch office's store (if multiple-store building) - */ - @Column (name = "branch_store", length = 3) - private Short branchStore; - - /** - * Branch office's street name - */ - @Basic (optional = false) - @Column (name = "branch_street", length = 100, nullable = false) - private String branchStreet; - - /** - * Branch office's suite number (if applyable) - */ - @Column (name = "branch_suite_number", length = 4) - private Short branchSuiteNumber; - - /** - * User owner instance - */ - @JoinColumn (name = "branch_user_id") - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH) - private User branchUserOwner; - - /** - * Branch office's ZIP code - */ - @Basic (optional = false) - @Column (name = "branch_zip_code", length = 6, nullable = false) - private Integer branchZipCode; - - /** - * Default constructor for JPA - */ - public CompanyBranchOffice () { - } - - /** - * Constructor with all required fields. This constructor may throw - * exceptions when one parameter is not valid or NULL. - *

- * @param branchCity Branch office's city - * @param branchCompany Branch office's assigned company - * @param branchCountry Branch office's country - * @param branchStreet Branch office's street - * @param branchZipCode Branch office's ZIP code - * @param branchHouseNumber Branch office's house number - */ - public CompanyBranchOffice (final String branchCity, final BusinessBasicData branchCompany, final Country branchCountry, final String branchStreet, final Integer branchZipCode, final Short branchHouseNumber) { - // Call other constructor - this(); - - // Check all parameter - if (null == branchCity) { - // Throw NPE - throw new NullPointerException("branchCity is null"); //NOI18N - } else if (branchCity.isEmpty()) { - // Throw IAE - throw new IllegalArgumentException("branchCity is empty"); //NOI18N - } else if (null == branchCompany) { - // Throw NPE - throw new NullPointerException("branchCompany is null"); //NOI18N - } else if (branchCompany.getBasicDataId() == null) { - // Throw NPE again - throw new NullPointerException("branchCompany.basicDataId is null"); //NOI18N - } else if (branchCompany.getBasicDataId() < 1) { - // Throw IAE again - throw new IllegalArgumentException(MessageFormat.format("branchCompany.basicDataId={0} is invalid", branchCompany.getBasicDataId())); //NOI18N - } else if (null == branchCountry) { - // Throw NPE again - throw new NullPointerException("branchCountry is null"); //NOI18N - } else if (branchCountry.getCountryId() == null) { - // Throw NPE again - throw new NullPointerException("branchCountry.countryId is null"); //NOI18N - } else if (branchCountry.getCountryId() < 1) { - // Throw IAE again - throw new IllegalArgumentException(MessageFormat.format("branchCountry.countryId={0} is invalid", branchCountry.getCountryId())); //NOI18N - } else if (null == branchStreet) { - // Throw NPE - throw new NullPointerException("branchStreet is null"); //NOI18N - } else if (branchStreet.isEmpty()) { - // Throw IAE - throw new IllegalArgumentException("branchStreet is empty"); //NOI18N - } else if (null == branchZipCode) { - // Throw NPE - throw new NullPointerException("branchZipCode is null"); //NOI18N - } else if (branchZipCode < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("branchZipCode={0} is out of range.", branchZipCode)); //NOI18N - } else if (null == branchHouseNumber) { - // Throw NPE - throw new NullPointerException("branchHouseNumber is null"); //NOI18N - } else if (branchHouseNumber < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("branchHouseNumber={0} is out of range.", branchHouseNumber)); //NOI18N - } - - // Set all fields - this.branchCity = branchCity; - this.branchCompany = branchCompany; - this.branchCountry = branchCountry; - this.branchStreet = branchStreet; - this.branchZipCode = branchZipCode; - this.branchHouseNumber = branchHouseNumber; - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final BranchOffice other = (BranchOffice) object; - - if (!Objects.equals(this.getBranchId(), other.getBranchId())) { - return false; - } else if (!Objects.equals(this.getBranchCity(), other.getBranchCity())) { - return false; - } else if (!Objects.equals(this.getBranchCountry(), other.getBranchCountry())) { - return false; - } else if (!Objects.equals(this.getBranchHouseNumber(), other.getBranchHouseNumber())) { - return false; - } else if (!Objects.equals(this.getBranchStore(), other.getBranchStore())) { - return false; - } else if (!Objects.equals(this.getBranchStreet(), other.getBranchStreet())) { - return false; - } else if (!Objects.equals(this.getBranchSuiteNumber(), other.getBranchSuiteNumber())) { - return false; - } else if (!Objects.equals(this.getBranchZipCode(), other.getBranchZipCode())) { - return false; - } - - return true; - } - - @Override - public String getBranchCity () { - return this.branchCity; - } - - @Override - public void setBranchCity (final String branchCity) { - this.branchCity = branchCity; - } - - @Override - public BusinessBasicData getBranchCompany () { - return this.branchCompany; - } - - @Override - public void setBranchCompany (final BusinessBasicData branchCompany) { - this.branchCompany = branchCompany; - } - - @Override - public Employee getBranchContactEmployee () { - return this.branchContactEmployee; - } - - @Override - public void setBranchContactEmployee (final Employee branchContactEmployee) { - this.branchContactEmployee = branchContactEmployee; - } - - @Override - public Country getBranchCountry () { - return this.branchCountry; - } - - @Override - public void setBranchCountry (final Country branchCountry) { - this.branchCountry = branchCountry; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getBranchCreated () { - return this.branchCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setBranchCreated (final Calendar branchCreated) { - this.branchCreated = branchCreated; - } - - @Override - public String getBranchEmailAddress () { - return this.branchEmailAddress; - } - - @Override - public void setBranchEmailAddress (final String branchEmailAddress) { - this.branchEmailAddress = branchEmailAddress; - } - - @Override - public DialableFaxNumber getBranchFaxNumber () { - return this.branchFaxNumber; - } - - @Override - public void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber) { - this.branchFaxNumber = branchFaxNumber; - } - - @Override - public Short getBranchHouseNumber () { - return this.branchHouseNumber; - } - - @Override - public void setBranchHouseNumber (final Short branchHouseNumber) { - this.branchHouseNumber = branchHouseNumber; - } - - @Override - public Long getBranchId () { - return this.branchId; - } - - @Override - public void setBranchId (final Long branchId) { - this.branchId = branchId; - } - - @Override - public DialableLandLineNumber getBranchLandLineNumber () { - return this.branchLandLineNumber; - } - - @Override - public void setBranchLandLineNumber (final DialableLandLineNumber branchLandLineNumber) { - this.branchLandLineNumber = branchLandLineNumber; - } - - @Override - public Short getBranchStore () { - return this.branchStore; - } - - @Override - public void setBranchStore (final Short branchStore) { - this.branchStore = branchStore; - } - - @Override - public String getBranchStreet () { - return this.branchStreet; - } - - @Override - public void setBranchStreet (final String branchStreet) { - this.branchStreet = branchStreet; - } - - @Override - public Short getBranchSuiteNumber () { - return this.branchSuiteNumber; - } - - @Override - public void setBranchSuiteNumber (final Short branchSuiteNumber) { - this.branchSuiteNumber = branchSuiteNumber; - } - - @Override - public User getBranchUserOwner () { - return this.branchUserOwner; - } - - @Override - public void setBranchUserOwner (final User branchUserOwner) { - this.branchUserOwner = branchUserOwner; - } - - @Override - public Integer getBranchZipCode () { - return this.branchZipCode; - } - - @Override - public void setBranchZipCode (final Integer branchZipCode) { - this.branchZipCode = branchZipCode; - } - - @Override - public int hashCode () { - int hash = 7; - - hash = 53 * hash + Objects.hashCode(this.getBranchId()); - hash = 53 * hash + Objects.hashCode(this.getBranchCity()); - hash = 53 * hash + Objects.hashCode(this.getBranchCountry()); - hash = 53 * hash + Objects.hashCode(this.getBranchHouseNumber()); - hash = 53 * hash + Objects.hashCode(this.getBranchStore()); - hash = 53 * hash + Objects.hashCode(this.getBranchStreet()); - hash = 53 * hash + Objects.hashCode(this.getBranchSuiteNumber()); - hash = 53 * hash + Objects.hashCode(this.getBranchZipCode()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java deleted file mode 100644 index e49a2ce..0000000 --- a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java +++ /dev/null @@ -1,234 +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.department; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; -import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; -import org.mxchange.jcontactsbusiness.branchoffice.CompanyBranchOffice; -import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; -import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersData; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData; - -/** - * A POJO for company departments - *

- * @author Roland Häder - */ -@Entity (name = "company_departments") -@Table (name = "company_departments") -@SuppressWarnings ("PersistenceUnitPresent") -public class CompanyDepartment implements Department { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 94_835_918_958_717_660L; - - /** - * Where this department is located - */ - @JoinColumn (name = "department_headquarters_id") - @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) - private HeadquartersData departentHeadquarters; - - /** - * Where this department is located - */ - @JoinColumn (name = "department_branch_id") - @ManyToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) - private BranchOffice departmentBranchOffice; - - /** - * Connection to company contact - */ - @JoinColumn (name = "department_company_id", nullable = false, updatable = false) - @ManyToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.ALL, optional = false) - private BusinessBasicData departmentCompany; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "department_entry_created", nullable = false, updatable = false) - private Calendar departmentCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "department_id", nullable = false, updatable = false) - private Long departmentId; - - /** - * Department lead employee - */ - @JoinColumn (name = "department_lead_id", nullable = false) - @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) - private Employee departmentLead; - - /** - * Department name - */ - @Basic (optional = false) - @Column (name = "department_name", length = 100, nullable = false) - private String departmentName; - - /** - * User owner instance - */ - @JoinColumn (name = "department_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User departmentUserOwner; - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final Department other = (Department) object; - - if (!Objects.equals(this.getDepartmentId(), other.getDepartmentId())) { - return false; - } else if (!Objects.equals(this.getDepartmentCompany(), other.getDepartmentCompany())) { - return false; - } else if (!Objects.equals(this.getDepartmentName(), other.getDepartmentName())) { - return false; - } - - return true; - } - - @Override - public HeadquartersData getDepartentHeadquarters () { - return this.departentHeadquarters; - } - - @Override - public void setDepartentHeadquarters (final HeadquartersData departentHeadquarters) { - this.departentHeadquarters = departentHeadquarters; - } - - @Override - public BranchOffice getDepartmentBranchOffice () { - return this.departmentBranchOffice; - } - - @Override - public void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice) { - this.departmentBranchOffice = departmentBranchOffice; - } - - @Override - public BusinessBasicData getDepartmentCompany () { - return this.departmentCompany; - } - - @Override - public void setDepartmentCompany (final BusinessBasicData departmentCompany) { - this.departmentCompany = departmentCompany; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getDepartmentCreated () { - return this.departmentCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setDepartmentCreated (final Calendar departmentCreated) { - this.departmentCreated = departmentCreated; - } - - @Override - public Long getDepartmentId () { - return this.departmentId; - } - - @Override - public void setDepartmentId (final Long departmentId) { - this.departmentId = departmentId; - } - - @Override - public Employee getDepartmentLead () { - return this.departmentLead; - } - - @Override - public void setDepartmentLead (final Employee departmentLead) { - this.departmentLead = departmentLead; - } - - @Override - public String getDepartmentName () { - return this.departmentName; - } - - @Override - public void setDepartmentName (final String departmentName) { - this.departmentName = departmentName; - } - - @Override - public User getDepartmentUserOwner () { - return this.departmentUserOwner; - } - - @Override - public void setDepartmentUserOwner (final User departmentUserOwner) { - this.departmentUserOwner = departmentUserOwner; - } - - @Override - public int hashCode () { - int hash = 5; - - hash = 53 * hash + Objects.hashCode(this.getDepartmentId()); - hash = 53 * hash + Objects.hashCode(this.getDepartmentCompany()); - hash = 53 * hash + Objects.hashCode(this.getDepartmentName()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/department/Department.java b/src/org/mxchange/jcontactsbusiness/department/Department.java deleted file mode 100644 index 433b1f4..0000000 --- a/src/org/mxchange/jcontactsbusiness/department/Department.java +++ /dev/null @@ -1,151 +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.department; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; -import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jusercore.model.user.User; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData; - -/** - * A POJI for company departments - *

- * @author Roland Häder - */ -public interface Department extends Serializable { - - /** - * Getter for connection to company contact - *

- * @return Connection to company contact - */ - BusinessBasicData getDepartmentCompany (); - - /** - * Setter for connection to company contact - *

- * @param departmentCompany Connection to company contact - */ - void setDepartmentCompany (final BusinessBasicData departmentCompany); - - /** - * Getter for connection to company headquarters - *

- * @return Connection to company headquarters - */ - HeadquartersData getDepartentHeadquarters (); - - /** - * Setter for connection to company headquarters - *

- * @param departentHeadquarters Connection to company headquarters - */ - void setDepartentHeadquarters (final HeadquartersData departentHeadquarters); - - /** - * Getter for connection to company branch office - *

- * @return Connection to company branch office - */ - BranchOffice getDepartmentBranchOffice (); - - /** - * Setter for connection to company branch office - *

- * @param departmentBranchOffice Connection to company branch office - */ - void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice); - - /** - * Getter for department id - *

- * @return Department id - */ - Long getDepartmentId (); - - /** - * Setter for department id - *

- * @param departmentId Department id - */ - void setDepartmentId (final Long departmentId); - - /** - * Getter for department lead employee - *

- * @return Department lead employee - */ - Employee getDepartmentLead (); - - /** - * Setter for department lead employee - *

- * @param departmentLead Department lead employee - */ - void setDepartmentLead (final Employee departmentLead); - - /** - * Getter for department name - *

- * @return Department name - */ - String getDepartmentName (); - - /** - * Setter for department name - *

- * @param departmentName Department name - */ - void setDepartmentName (final String departmentName); - - /** - * Getter for user owner instance - *

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

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

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

- * @param departmentCreated Timestamp when this entry has been created - */ - void setDepartmentCreated (final Calendar departmentCreated); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java deleted file mode 100644 index 0e8fe24..0000000 --- a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java +++ /dev/null @@ -1,332 +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.employee; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; -import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; -import org.mxchange.jcontactsbusiness.branchoffice.CompanyBranchOffice; -import org.mxchange.jcontactsbusiness.department.CompanyDepartment; -import org.mxchange.jcontactsbusiness.department.Department; -import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadquartersData; -import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData; -import org.mxchange.jcontactsbusiness.jobposition.EmployeePosition; -import org.mxchange.jcontactsbusiness.jobposition.JobPosition; -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; - -/** - * A POJO for company employees (including CEO) - *

- * @author Roland Häder - */ -@Entity (name = "company_employees") -@Table (name = "company_employees") -@NamedQueries ( - { - @NamedQuery (name = "AllCompanyEmployees", query = "SELECT e FROM company_employees AS e ORDER BY e.employeeId ASC"), - @NamedQuery (name = "SearchCompanyEmployeeById", query = "SELECT e FROM company_employees AS e WHERE e.employeeId = :employeeId") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class CompanyEmployee implements Employee { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 48_959_819_859_812_076L; - - /** - * Branch office (if the employee works there) - */ - @JoinColumn (name = "employee_branch_id") - @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) - private BranchOffice employeeBranchOffice; - - /** - * Company the employee is working at - */ - @JoinColumn (name = "employee_company_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.ALL, optional = false) - private BusinessBasicData employeeCompany; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "employee_entry_created", nullable = false, updatable = false) - private Calendar employeeCreated; - - /** - * Department the employee works at - */ - @JoinColumn (name = "employee_department_id") - @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL) - private Department employeeDepartment; - - /** - * Employee's email address - */ - @Column (name = "employee_email_address", length = 30) - private String employeeEmailAddress; - - /** - * Head quarters id number (if the employee works there) - */ - @JoinColumn (name = "employee_headquarters_id") - @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) - private HeadquartersData employeeHeadquarter; - - /** - * Id number - */ - @Id - @Column (name = "employee_id", nullable = false, updatable = false) - @GeneratedValue (strategy = GenerationType.IDENTITY) - private Long employeeId; - - /** - * Employee's business mobile number - */ - @JoinColumn (name = "employee_mobile_number_id") - @OneToOne (targetEntity = MobileNumber.class, cascade = CascadeType.ALL) - private DialableMobileNumber employeeMobileNumber; - - /** - * Employee's staff number - */ - @Column (name = "employee_staff_number", length = 20) - private String employeeNumber; - - /** - * Employee's personal data - */ - @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false) - @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) - private Contact employeePersonalData; - - /** - * Employee's phone extension (or number if different) - */ - @Column (name = "employee_phone_extension", length = 10) - private Integer employeePhoneExtension; - - /** - * Employee's position (example: CEO) - */ - @JoinColumn (name = "employee_position_id") - @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.REFRESH) - private JobPosition employeePosition; - - /** - * User owner instance - */ - @JoinColumn (name = "employee_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User employeeUserOwner; - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final Employee other = (Employee) object; - - if (!Objects.equals(this.getEmployeeId(), other.getEmployeeId())) { - return false; - } else if (!Objects.equals(this.getEmployeeCompany(), other.getEmployeeCompany())) { - return false; - } else if (!Objects.equals(this.getEmployeeNumber(), other.getEmployeeNumber())) { - return false; - } else if (!Objects.equals(this.getEmployeePersonalData(), other.getEmployeePersonalData())) { - return false; - } - - return true; - } - - @Override - public BranchOffice getEmployeeBranchOffice () { - return this.employeeBranchOffice; - } - - @Override - public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice) { - this.employeeBranchOffice = employeeBranchOffice; - } - - @Override - public BusinessBasicData getEmployeeCompany () { - return this.employeeCompany; - } - - @Override - public void setEmployeeCompany (final BusinessBasicData employeeCompany) { - this.employeeCompany = employeeCompany; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getEmployeeCreated () { - return this.employeeCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setEmployeeCreated (final Calendar employeeCreated) { - this.employeeCreated = employeeCreated; - } - - @Override - public Department getEmployeeDepartment () { - return this.employeeDepartment; - } - - @Override - public void setEmployeeDepartment (final Department employeeDepartment) { - this.employeeDepartment = employeeDepartment; - } - - @Override - public String getEmployeeEmailAddress () { - return this.employeeEmailAddress; - } - - @Override - public void setEmployeeEmailAddress (final String employeeEmailAddress) { - this.employeeEmailAddress = employeeEmailAddress; - } - - @Override - public HeadquartersData getEmployeeHeadquarter () { - return this.employeeHeadquarter; - } - - @Override - public void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter) { - this.employeeHeadquarter = employeeHeadquarter; - } - - @Override - public Long getEmployeeId () { - return this.employeeId; - } - - @Override - public void setEmployeeId (final Long employeeId) { - this.employeeId = employeeId; - } - - @Override - public DialableMobileNumber getEmployeeMobileNumber () { - return this.employeeMobileNumber; - } - - @Override - public void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber) { - this.employeeMobileNumber = employeeMobileNumber; - } - - @Override - public String getEmployeeNumber () { - return this.employeeNumber; - } - - @Override - public void setEmployeeNumber (final String employeeNumber) { - this.employeeNumber = employeeNumber; - } - - @Override - public Contact getEmployeePersonalData () { - return this.employeePersonalData; - } - - @Override - public void setEmployeePersonalData (final Contact employeePersonalData) { - this.employeePersonalData = employeePersonalData; - } - - @Override - public Integer getEmployeePhoneExtension () { - return this.employeePhoneExtension; - } - - @Override - public void setEmployeePhoneExtension (final Integer employeePhoneExtension) { - this.employeePhoneExtension = employeePhoneExtension; - } - - @Override - public JobPosition getEmployeePosition () { - return this.employeePosition; - } - - @Override - public void setEmployeePosition (final JobPosition employeePosition) { - this.employeePosition = employeePosition; - } - - @Override - public User getEmployeeUserOwner () { - return this.employeeUserOwner; - } - - @Override - public void setEmployeeUserOwner (final User employeeUserOwner) { - this.employeeUserOwner = employeeUserOwner; - } - - @Override - public int hashCode () { - int hash = 3; - - hash = 97 * hash + Objects.hashCode(this.getEmployeeId()); - hash = 97 * hash + Objects.hashCode(this.getEmployeeCompany()); - hash = 97 * hash + Objects.hashCode(this.getEmployeeNumber()); - hash = 97 * hash + Objects.hashCode(this.getEmployeePersonalData()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/employee/Employee.java b/src/org/mxchange/jcontactsbusiness/employee/Employee.java deleted file mode 100644 index 5da72e1..0000000 --- a/src/org/mxchange/jcontactsbusiness/employee/Employee.java +++ /dev/null @@ -1,224 +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.employee; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; -import org.mxchange.jcontactsbusiness.department.Department; -import org.mxchange.jcontactsbusiness.jobposition.JobPosition; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jusercore.model.user.User; -import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData; - -/** - * A POJI for employees - *

- * @author Roland Häder - */ -public interface Employee extends Serializable { - - /** - * Getter for employee's branch office - *

- * @return Employee's branch office - */ - BranchOffice getEmployeeBranchOffice (); - - /** - * Setter for employee's branch office - *

- * @param employeeBranchOffice Employee's branch office - */ - void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice); - - /** - * Getter for employee's company - *

- * @return Company instance - */ - BusinessBasicData getEmployeeCompany (); - - /** - * Setter for employee's company - *

- * @param employeeCompany Company instance - */ - void setEmployeeCompany (final BusinessBasicData employeeCompany); - - /** - * Getter for employee's department - *

- * @return Employee's department - */ - Department getEmployeeDepartment (); - - /** - * Setter for employee's department - *

- * @param employeeDepartment Employee's department - */ - void setEmployeeDepartment (final Department employeeDepartment); - - /** - * Getter for employee's head quarters - *

- * @return Employee's head quarters - */ - HeadquartersData getEmployeeHeadquarter (); - - /** - * Getter for employee's head quarters - *

- * @param employeeHeadquarter Employee's head quarters - */ - void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter); - - /** - * Getter for employee's email address - *

- * @return Employee's email address - */ - String getEmployeeEmailAddress (); - - /** - * Setter for employee's email address - *

- * @param employeeEmailAddress Employee's email address - */ - void setEmployeeEmailAddress (final String employeeEmailAddress); - - /** - * Getter for employee's id number - *

- * @return Employee's id number - */ - Long getEmployeeId (); - - /** - * Setter for employee's id number - *

- * @param employeeId Employee's id number - */ - void setEmployeeId (final Long employeeId); - - /** - * Getter for employee's mobile number - *

- * @return Employee's mobile number - */ - DialableMobileNumber getEmployeeMobileNumber (); - - /** - * Setter for employee's mobile number - *

- * @param employeeMobileNumber Employee's mobile number - */ - void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber); - - /** - * Getter for employee's number - *

- * @return Employee's number - */ - String getEmployeeNumber (); - - /** - * Setter for employee's number - *

- * @param employeeNumber Employee's number - */ - void setEmployeeNumber (final String employeeNumber); - - /** - * Getter for employee's personal data - *

- * @return Employee's personal data - */ - Contact getEmployeePersonalData (); - - /** - * Setter for employee's personal data - *

- * @param employeePersonalData Employee's personal data - */ - void setEmployeePersonalData (final Contact employeePersonalData); - - /** - * Getter for employee's phone number/extension - *

- * @return Employee's phone number/extension - */ - Integer getEmployeePhoneExtension (); - - /** - * Setter for employee's phone number/extension - *

- * @param employeePhoneExtension Employee's phone number/extension - */ - void setEmployeePhoneExtension (final Integer employeePhoneExtension); - - /** - * Getter for employee's position - *

- * @return Employee's position - */ - JobPosition getEmployeePosition (); - - /** - * Setter for employee's position - *

- * @param employeePosition Employee's position - */ - void setEmployeePosition (final JobPosition employeePosition); - - /** - * Getter for user owner instance - *

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

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

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

- * @param employeeCreated Timestamp when this entry has been created - */ - void setEmployeeCreated (final Calendar employeeCreated); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jcontactsbusiness/events/basicdata/added/AdminAddedBusinessBasicDataEvent.java b/src/org/mxchange/jcontactsbusiness/events/basicdata/added/AdminAddedBusinessBasicDataEvent.java index 47cb704..44debeb 100644 --- a/src/org/mxchange/jcontactsbusiness/events/basicdata/added/AdminAddedBusinessBasicDataEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/basicdata/added/AdminAddedBusinessBasicDataEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.events.basicdata.added; import java.text.MessageFormat; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; /** * An event being thrown when new basic business data has been added. diff --git a/src/org/mxchange/jcontactsbusiness/events/basicdata/added/ObservableAdminAddedBusinessBasicDataEvent.java b/src/org/mxchange/jcontactsbusiness/events/basicdata/added/ObservableAdminAddedBusinessBasicDataEvent.java index 9bec912..b8051d6 100644 --- a/src/org/mxchange/jcontactsbusiness/events/basicdata/added/ObservableAdminAddedBusinessBasicDataEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/basicdata/added/ObservableAdminAddedBusinessBasicDataEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.events.basicdata.added; import java.io.Serializable; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; /** * An interface for events being fired when new basic business data has been diff --git a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/BranchOfficeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/BranchOfficeAddedEvent.java index c007de3..703bf3e 100644 --- a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/BranchOfficeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/BranchOfficeAddedEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.events.branchoffice.added; import java.text.MessageFormat; -import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; /** * An event being fired when a branch office has been added diff --git a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableBranchOfficeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableBranchOfficeAddedEvent.java index 23ec400..b6575fd 100644 --- a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableBranchOfficeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableBranchOfficeAddedEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.events.branchoffice.added; import java.io.Serializable; -import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; /** * An interface for events being triggered when a branch office has been added. diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataAlreadyAddedException.java b/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataAlreadyAddedException.java index dec174d..6b39838 100644 --- a/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataAlreadyAddedException.java +++ b/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataAlreadyAddedException.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.exceptions.basicdata; import java.text.MessageFormat; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; /** * Thrown if the given BusinessBasicData instance is already added diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeAlreadyAddedException.java b/src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeAlreadyAddedException.java index bfcd2b1..fcbd471 100644 --- a/src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeAlreadyAddedException.java +++ b/src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeAlreadyAddedException.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.exceptions.branchoffice; import java.text.MessageFormat; -import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; /** * Thrown if the given BusinessBasicData instance is already added diff --git a/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadquartersData.java b/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadquartersData.java deleted file mode 100644 index 0bafa1f..0000000 --- a/src/org/mxchange/jcontactsbusiness/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.headquarters; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.data.CountryData; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for company headquarts data - *

- * @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 Calendar headquartersCreated; - - /** - * Headquarters' fax number - */ - @JoinColumn (name = "headquarters_fax_number_id") - @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) - private DialableFaxNumber headquartersFaxNumber; - - /** - * Headquarters' house number - */ - @Basic (optional = false) - @Column (name = "headquarters_house_number", length = 4, nullable = false) - private Short headquartersHouseNumber; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "headquarters_id", nullable = false, updatable = false) - private Long headquartersId; - - /** - * Headquarters' phone number - */ - @JoinColumn (name = "headquarters_phone_number_id") - @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) - private DialableLandLineNumber headquartersPhoneNumber; - - /** - * Headquarters' store number (multi-store building only) - */ - @Column (name = "headquarters_store", length = 3) - private Short headquartersStore; - - /** - * Headquarters' street name - */ - @Basic (optional = false) - @Column (name = "headquarters_street", length = 100, nullable = false) - private String headquartersStreet; - - /** - * Headquarters' suite number - */ - @Column (name = "headquarters_suite_number", length = 4) - private Short headquartersSuiteNumber; - - /** - * User owner instance - */ - @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User headquartersUserOwner; - - /** - * Headquarters' ZIP code - */ - @Basic (optional = false) - @Column (name = "headquarters_zip_code", length = 6, nullable = false) - private Integer headquartersZipCode; - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final HeadquartersData other = (HeadquartersData) object; - - if (!Objects.equals(this.getHeadquartersId(), other.getHeadquartersId())) { - return false; - } else if (!Objects.equals(this.getHeadquartersCity(), other.getHeadquartersCity())) { - return false; - } else if (!Objects.equals(this.getHeadquartersCountry(), other.getHeadquartersCountry())) { - return false; - } else if (!Objects.equals(this.getHeadquartersHouseNumber(), other.getHeadquartersHouseNumber())) { - return false; - } else if (!Objects.equals(this.getHeadquartersStore(), other.getHeadquartersStore())) { - return false; - } else if (!Objects.equals(this.getHeadquartersStreet(), other.getHeadquartersStreet())) { - return false; - } else if (!Objects.equals(this.getHeadquartersSuiteNumber(), other.getHeadquartersSuiteNumber())) { - return false; - } else if (!Objects.equals(this.getHeadquartersZipCode(), other.getHeadquartersZipCode())) { - return false; - } - - return true; - } - - @Override - public String getHeadquartersCity () { - return this.headquartersCity; - } - - @Override - public void setHeadquartersCity (final String headquartersCity) { - this.headquartersCity = headquartersCity; - } - - @Override - public Country getHeadquartersCountry () { - return this.headquartersCountry; - } - - @Override - public void setHeadquartersCountry (final Country headquartersCountry) { - this.headquartersCountry = headquartersCountry; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getHeadquartersCreated () { - return this.headquartersCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setHeadquartersCreated (final Calendar headquartersCreated) { - this.headquartersCreated = headquartersCreated; - } - - @Override - public DialableFaxNumber getHeadquartersFaxNumber () { - return this.headquartersFaxNumber; - } - - @Override - public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) { - this.headquartersFaxNumber = headquartersFaxNumber; - } - - @Override - public Short getHeadquartersHouseNumber () { - return this.headquartersHouseNumber; - } - - @Override - public void setHeadquartersHouseNumber (final Short headquartersHouseNumber) { - this.headquartersHouseNumber = headquartersHouseNumber; - } - - @Override - public Long getHeadquartersId () { - return this.headquartersId; - } - - @Override - public void setHeadquartersId (final Long headquartersId) { - this.headquartersId = headquartersId; - } - - @Override - public DialableLandLineNumber getHeadquartersPhoneNumber () { - return this.headquartersPhoneNumber; - } - - @Override - public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) { - this.headquartersPhoneNumber = headquartersPhoneNumber; - } - - @Override - public Short getHeadquartersStore () { - return this.headquartersStore; - } - - @Override - public void setHeadquartersStore (final Short headquartersStore) { - this.headquartersStore = headquartersStore; - } - - @Override - public String getHeadquartersStreet () { - return this.headquartersStreet; - } - - @Override - public void setHeadquartersStreet (final String headquartersStreet) { - this.headquartersStreet = headquartersStreet; - } - - @Override - public Short getHeadquartersSuiteNumber () { - return this.headquartersSuiteNumber; - } - - @Override - public void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber) { - this.headquartersSuiteNumber = headquartersSuiteNumber; - } - - @Override - public User getHeadquartersUserOwner () { - return this.headquartersUserOwner; - } - - @Override - public void setHeadquartersUserOwner (final User headquartersUserOwner) { - this.headquartersUserOwner = headquartersUserOwner; - } - - @Override - public Integer getHeadquartersZipCode () { - return this.headquartersZipCode; - } - - @Override - public void setHeadquartersZipCode (final Integer headquartersZipCode) { - this.headquartersZipCode = headquartersZipCode; - } - - @Override - public int hashCode () { - int hash = 7; - - hash = 47 * hash + Objects.hashCode(this.getHeadquartersId()); - hash = 47 * hash + Objects.hashCode(this.getHeadquartersCity()); - hash = 47 * hash + Objects.hashCode(this.getHeadquartersCountry()); - hash = 47 * hash + Objects.hashCode(this.getHeadquartersHouseNumber()); - hash = 47 * hash + Objects.hashCode(this.getHeadquartersStore()); - hash = 47 * hash + Objects.hashCode(this.getHeadquartersStreet()); - hash = 47 * hash + Objects.hashCode(this.getHeadquartersSuiteNumber()); - hash = 47 * hash + Objects.hashCode(this.getHeadquartersZipCode()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/headquarters/HeadquartersData.java b/src/org/mxchange/jcontactsbusiness/headquarters/HeadquartersData.java deleted file mode 100644 index 598fe3d..0000000 --- a/src/org/mxchange/jcontactsbusiness/headquarters/HeadquartersData.java +++ /dev/null @@ -1,206 +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.headquarters; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for headquarters data - *

- * @author Roland Häder - */ -public interface HeadquartersData extends Serializable { - - /** - * Getter for headquarters' city name - *

- * @return Headquarters' city name - */ - String getHeadquartersCity (); - - /** - * Setter for headquarters' city name - *

- * @param headquartersCity Headquarters' city name - */ - void setHeadquartersCity (final String headquartersCity); - - /** - * Getter for headquarters' country code - *

- * @return Headquarters' country code - */ - Country getHeadquartersCountry (); - - /** - * Setter for headquarters' country code - *

- * @param headquartersCountryCode Headquarters' country code - */ - void setHeadquartersCountry (final Country headquartersCountryCode); - - /** - * Getter for headquarters' house number - *

- * @return Headquarters' house number - */ - Short getHeadquartersHouseNumber (); - - /** - * Setter for headquarters' house number - *

- * @param headquartersHouseNumber Headquarters' house number - */ - void setHeadquartersHouseNumber (final Short headquartersHouseNumber); - - /** - * Getter for headquarters' id number - *

- * @return Headquarters' id number - */ - Long getHeadquartersId (); - - /** - * Setter for headquarters' id number - *

- * @param headquartersId Headquarters' id number - */ - void setHeadquartersId (final Long headquartersId); - - /** - * Getter for headquarters' store number - *

- * @return Headquarters' store number - */ - Short getHeadquartersStore (); - - /** - * Setter for headquarters' store number - *

- * @param headquartersStore Headquarters' store number - */ - void setHeadquartersStore (final Short headquartersStore); - - /** - * Getter for headquarters' street name - *

- * @return Headquarters' street name - */ - String getHeadquartersStreet (); - - /** - * Setter for headquarters' street name - *

- * @param headquartersStreet Headquarters' street name - */ - void setHeadquartersStreet (final String headquartersStreet); - - /** - * Getter for headquarters' suite number - *

- * @return Headquarters' suite number - */ - Short getHeadquartersSuiteNumber (); - - /** - * Setter for headquarters' suite number - *

- * @param headquartersSuiteNumber Headquarters' suite number - */ - void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber); - - /** - * Getter for headquarters' ZIP code - *

- * @return Headquarters' ZIP code - */ - Integer getHeadquartersZipCode (); - - /** - * Setter for headquarters' ZIP code - *

- * @param headquartersZipCode Headquarters' ZIP code - */ - void setHeadquartersZipCode (final Integer headquartersZipCode); - - /** - * Getter for headquarters' phone number - *

- * @return Headquarters' phone number - */ - DialableLandLineNumber getHeadquartersPhoneNumber (); - - /** - * Setter for headquarters' phone number - *

- * @param headquartersPhoneNumber Headquarters' phone number - */ - void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber); - - /** - * Getter for headquarters' fax number - *

- * @return Headquarters' fax number - */ - DialableFaxNumber getHeadquartersFaxNumber (); - - /** - * Setter for headquarters' fax number - *

- * @param headquartersFaxNumber Headquarters' fax number - */ - void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber); - - /** - * Getter for user owner instance - *

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

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

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

- * @param headquartersCreated Timestamp when this entry has been created - */ - void setHeadquartersCreated (final Calendar headquartersCreated); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java b/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java deleted file mode 100644 index ce7d391..0000000 --- a/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java +++ /dev/null @@ -1,155 +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.jobposition; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; - -/** - * A POJO for job positions - *

- * @author Roland Häder - */ -@Entity (name = "company_job_positions") -@Table ( - name = "company_job_positions" -) -@SuppressWarnings ("PersistenceUnitPresent") -public class EmployeePosition implements JobPosition { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 18_427_587_187_609L; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "job_position_created", nullable = false, updatable = false) - private Calendar jobPositionCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "job_position_id", nullable = false, updatable = false) - private Long jobPositionId; - - /** - * Name/description of the job position (example: CEO) - */ - @Basic (optional = false) - @Column (name = "job_position_name", nullable = false, unique = true) - private String jobPositionName; - - /** - * Timestamp when this entry has been created - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "job_position_updated", insertable = false) - private Calendar jobPositionUpdated; - - @Override - public boolean equals (final Object object) { - if (this == object) { - return true; - } else if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final JobPosition other = (JobPosition) object; - - if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) { - return false; - } else if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) { - return false; - } - - return true; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getJobPositionCreated () { - return this.jobPositionCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setJobPositionCreated (final Calendar jobPositionCreated) { - this.jobPositionCreated = jobPositionCreated; - } - - @Override - public Long getJobPositionId () { - return this.jobPositionId; - } - - @Override - public void setJobPositionId (final Long jobPositionId) { - this.jobPositionId = jobPositionId; - } - - @Override - public String getJobPositionName () { - return this.jobPositionName; - } - - @Override - public void setJobPositionName (final String jobPositionName) { - this.jobPositionName = jobPositionName; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getJobPositionUpdated () { - return this.jobPositionUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setJobPositionUpdated (final Calendar jobPositionUpdated) { - this.jobPositionUpdated = jobPositionUpdated; - } - - @Override - public int hashCode () { - int hash = 7; - - hash = 37 * hash + Objects.hashCode(this.getJobPositionId()); - hash = 37 * hash + Objects.hashCode(this.getJobPositionName()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java b/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java deleted file mode 100644 index cc62d92..0000000 --- a/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java +++ /dev/null @@ -1,91 +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.jobposition; - -import java.io.Serializable; -import java.util.Calendar; - -/** - * A POJI for job positions - *

- * @author Roland Häder - */ -public interface JobPosition extends Serializable { - - /** - * Getter for id number - *

- * @return Id number - */ - Long getJobPositionId (); - - /** - * Setter for id number - *

- * @param jobPositionId Id number - */ - void setJobPositionId (final Long jobPositionId); - - /** - * Getter for job position name - *

- * @return Job position name - */ - String getJobPositionName (); - - /** - * Setter for job position name - *

- * @param jobPositionName Job position name - */ - void setJobPositionName (final String jobPositionName); - - /** - * Getter for timestamp when this entry has been created - *

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

- * @param jobPositionCreated Timestamp when this entry has been created - */ - void setJobPositionCreated (final Calendar jobPositionCreated); - - /** - * Getter for timestamp when this entry has been updated - *

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

- * @param jobPositionUpdated Timestamp when this entry has been updated - */ - void setJobPositionUpdated (final Calendar jobPositionUpdated); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jcontactsbusiness/logo/BusinessLogo.java b/src/org/mxchange/jcontactsbusiness/logo/BusinessLogo.java deleted file mode 100644 index bb2b350..0000000 --- a/src/org/mxchange/jcontactsbusiness/logo/BusinessLogo.java +++ /dev/null @@ -1,91 +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.logo; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for business logos - *

- * @author Roland Häder - */ -public interface BusinessLogo 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 - */ - Calendar getLogoCreated (); - - /** - * Setter for timestamp when this entry has been created - *

- * @param logoCreated Timestamp when this entry has been created - */ - void setLogoCreated (final Calendar logoCreated); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java b/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java deleted file mode 100644 index 4ce99b5..0000000 --- a/src/org/mxchange/jcontactsbusiness/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.logo; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.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 Calendar 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 Calendar getLogoCreated () { - return this.logoCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setLogoCreated (final Calendar 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/basicdata/BusinessBasicData.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java new file mode 100644 index 0000000..cad9f09 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/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.model.basicdata; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.employee.Employee; +import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; +import org.mxchange.jcontactsbusiness.model.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 getBasicDataId (); + + /** + * Setter for business contact id + *

+ * @param businessContactId Business contact id + */ + void setBasicDataId (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 getCompanyHeadQuartersData (); + + /** + * Setter for headquarters data + *

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

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

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

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

+ * @param contactCreated Timestamp when this entry has been created + */ + void setCompanyCreated (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 getCompanyLandLineNumber (); + + /** + * Setter for list of phone number + *

+ * @param companyPhoneNumber Phone numbers + */ + void setCompanyLandLineNumber (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/model/basicdata/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/model/basicdata/CompanyBasicData.java new file mode 100644 index 0000000..479d104 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/basicdata/CompanyBasicData.java @@ -0,0 +1,394 @@ +/* + * 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.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.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployee; +import org.mxchange.jcontactsbusiness.model.employee.Employee; +import org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersData; +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.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.basicDataId"), + @NamedQuery (name = "SearchBusinessDataById", query = "SELECT b FROM company_basic_data AS b WHERE b.basicDataId = :basicDataId") + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class CompanyBasicData implements BusinessBasicData { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 470_375_172_748_691L; + + /** + * Id number + */ + @Id + @Column (name = "company_data_id", nullable = false, updatable = false) + @GeneratedValue (strategy = GenerationType.IDENTITY) + private Long basicDataId; + + /** + * Reference to company branch offices + */ + @Transient + private List brancheOffices; + + /** + * 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; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "company_entry_created", nullable = false, updatable = false) + private Calendar companyCreated; + + /** + * 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; + + /** + * Reference to headquarters data + */ + @JoinColumn (name = "company_headquarters_data_id") + @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) + private HeadquartersData companyHeadQuartersData; + + /** + * Company's main phone number: +ccxxxxxxxxxx + */ + @JoinColumn (name = "company_landline_number_id") + @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) + private DialableLandLineNumber companyLandLineNumber; + + /** + * Id number of company logo + */ + @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, unique = true) + private String companyName; + + /** + * Tax number + */ + @Column (name = "company_tax_number", length = 30) + private String companyTaxNumber; + + /** + * User owner instance + */ + @JoinColumn (name = "company_owner_user_id") + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH) + private User companyUserOwner; + + /** + * URL for company website + */ + @Column (name = "company_website_url") + private String companyWebsiteUrl; + + /** + * Default constructor, required for JPA + */ + public CompanyBasicData () { + } + + /** + * Constructor with company name + *

+ * @param companyName Company name + */ + public CompanyBasicData (final String companyName) { + // First, validate all parameter + if (companyName == null) { + // Is null + throw new NullPointerException("companyName is null"); //NOI18N + } else if (companyName.isEmpty()) { + // Is null + throw new IllegalArgumentException("companyName is empty"); //NOI18N + } + + // Set company name + this.companyName = companyName; + } + + @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.getBasicDataId(), other.getBasicDataId())) { + return false; + } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) { + return false; + } else if (!Objects.equals(this.getCompanyHeadQuartersData(), other.getCompanyHeadQuartersData())) { + 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 + public Long getBasicDataId () { + return this.basicDataId; + } + + @Override + public void setBasicDataId (final Long basicDataId) { + this.basicDataId = basicDataId; + } + + @Override + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getBrancheOffices () { + return this.brancheOffices; + } + + @Override + @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") + public void setBrancheOffices (final List brancheOffices) { + this.brancheOffices = brancheOffices; + } + + @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 + @SuppressWarnings ("ReturnOfDateField") + public Calendar getCompanyCreated () { + return this.companyCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setCompanyCreated (final Calendar companyCreated) { + this.companyCreated = companyCreated; + } + + @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 HeadquartersData getCompanyHeadQuartersData () { + return this.companyHeadQuartersData; + } + + @Override + public void setCompanyHeadQuartersData (final HeadquartersData companyHeadQuartersData) { + this.companyHeadQuartersData = companyHeadQuartersData; + } + + @Override + public DialableLandLineNumber getCompanyLandLineNumber () { + return this.companyLandLineNumber; + } + + @Override + public void setCompanyLandLineNumber (final DialableLandLineNumber companyLandLineNumber) { + this.companyLandLineNumber = companyLandLineNumber; + } + + @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 String getCompanyTaxNumber () { + return this.companyTaxNumber; + } + + @Override + public void setCompanyTaxNumber (final String companyTaxNumber) { + this.companyTaxNumber = companyTaxNumber; + } + + @Override + public User getCompanyUserOwner () { + return this.companyUserOwner; + } + + @Override + public void setCompanyUserOwner (final User companyUserOwner) { + this.companyUserOwner = companyUserOwner; + } + + @Override + public String getCompanyWebsiteUrl () { + return this.companyWebsiteUrl; + } + + @Override + public void setCompanyWebsiteUrl (final String companyWebsiteUrl) { + this.companyWebsiteUrl = companyWebsiteUrl; + } + + @Override + public int hashCode () { + int hash = 3; + + hash = 37 * hash + Objects.hashCode(this.getBasicDataId()); + hash = 37 * hash + Objects.hashCode(this.getCompanyName()); + hash = 37 * hash + Objects.hashCode(this.getCompanyHeadQuartersData()); + hash = 37 * hash + Objects.hashCode(this.getCompanyContactEmployee()); + hash = 37 * hash + Objects.hashCode(this.getCompanyFounder()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java new file mode 100644 index 0000000..24435f7 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffice.java @@ -0,0 +1,250 @@ +/* + * 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.branchoffice; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.employee.Employee; +import org.mxchange.jcountry.data.Country; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for branch offices + *

+ * @author Roland Häder + */ +public interface BranchOffice extends Serializable { + + /** + * Getter for branch office's city name + *

+ * @return Branch office's city name + */ + String getBranchCity (); + + /** + * Setter for branch office's city name + *

+ * @param branchCity Branch office's city name + */ + void setBranchCity (final String branchCity); + + /** + * Getter for branch office's email address + *

+ * @return Branch office's email address + */ + String getBranchEmailAddress (); + + /** + * Setter for branch office's email address + *

+ * @param branchEmailAddress Branch office's email address + */ + void setBranchEmailAddress (final String branchEmailAddress); + + /** + * Getter for branch office's fax number + *

+ * @return Branch office's fax number + */ + DialableFaxNumber getBranchFaxNumber (); + + /** + * Setter for branch office's fax number + *

+ * @param branchFaxNumber Branch office's fax number + */ + void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber); + + /** + * Getter for branch office's house number + *

+ * @return Branch office's house number + */ + Short getBranchHouseNumber (); + + /** + * Setter for branch office's house number + *

+ * @param branchHouseNumber Branch office's house number + */ + void setBranchHouseNumber (final Short branchHouseNumber); + + /** + * Getter for branch office's phone number + *

+ * @return Branch office's phone number + */ + DialableLandLineNumber getBranchLandLineNumber (); + + /** + * Setter for branch office's phone number + *

+ * @param branchPhoneNumber Branch office's phone number + */ + void setBranchLandLineNumber (final DialableLandLineNumber branchPhoneNumber); + + /** + * Getter for branch office's store + *

+ * @return Branch office's store + */ + Short getBranchStore (); + + /** + * Setter for branch office's store + *

+ * @param branchStore Branch office's store + */ + void setBranchStore (final Short branchStore); + + /** + * Getter for branch office's street name + *

+ * @return Branch office's street name + */ + String getBranchStreet (); + + /** + * Setter for branch office's street name + *

+ * @param branchStreet Branch office's street name + */ + void setBranchStreet (final String branchStreet); + + /** + * Getter for branch office's suite number + *

+ * @return Branch office's suite number + */ + Short getBranchSuiteNumber (); + + /** + * Setter for branch office's suite number + *

+ * @param branchSuiteNumber Branch office's suite number + */ + void setBranchSuiteNumber (final Short branchSuiteNumber); + + /** + * Getter for branch office's ZIP code + *

+ * @return Branch office's ZIP code + */ + Integer getBranchZipCode (); + + /** + * Setter for branch office's ZIP code + *

+ * @param branchZipCode Branch office's ZIP code + */ + void setBranchZipCode (final Integer branchZipCode); + + /** + * Getter for branch office's id number + *

+ * @return Branch office's id number + */ + Long getBranchId (); + + /** + * Setter for branch office's id number + *

+ * @param branchId Branch office's id number + */ + void setBranchId (final Long branchId); + + /** + * Getter for branch office's country + *

+ * @return Branch office's country + */ + Country getBranchCountry (); + + /** + * Setter for branch office's country + *

+ * @param branchCountryCode Branch office's country + */ + void setBranchCountry (final Country branchCountryCode); + + /** + * Getter for branch office's company + *

+ * @return Branch office's company + */ + BusinessBasicData getBranchCompany (); + + /** + * Setter for branch office's company + *

+ * @param branchCompany Branch office's company + */ + void setBranchCompany (final BusinessBasicData branchCompany); + + /** + * Getter branch office's contact person + *

+ * @return Branch office's contact person + */ + Employee getBranchContactEmployee (); + + /** + * Setter branch office's contact person + *

+ * @param branchEmployee Branch office's contact person + */ + void setBranchContactEmployee (final Employee branchEmployee); + + /** + * Getter for user owner instance + *

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

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

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

+ * @param branchCreated Timestamp when this entry has been created + */ + void setBranchCreated (final Calendar branchCreated); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOfficeUtils.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOfficeUtils.java new file mode 100644 index 0000000..9ca468a --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOfficeUtils.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontactsbusiness.model.branchoffice; + +import java.io.Serializable; +import java.util.Objects; + +/** + * An utilities class for branch offices + * + * @author Roland Häder + */ +public class BranchOfficeUtils implements Serializable { + + /** + * Serial number + */ + private static final long serialVersionUID = 69_537_867_224_651L; + + /** + * Checks if both branch offices have same address. This method will throw + * an {@code NullPointerException} if one of the instances is null. + *

+ * @param branchOffice1 Branch office 1 + * @param branchOffice2 Branch office 2 + *

+ * @return Whether both branch office addresses are the same + *

+ * @throws NullPointerException If one of the instances is null + */ + public static boolean isSameAddress (final BranchOffice branchOffice1, final BranchOffice branchOffice2) { + // Check that both parameters are not null + if (null == branchOffice1) { + // Throw NPE + throw new NullPointerException("branchOffice1 is null"); //NOI18N + } else if (null == branchOffice2) { + // Throw NPE + throw new NullPointerException("branchOffice2 is null"); //NOI18N + } + + // Default is the same + boolean isSameAddress = true; + + // Compare both addresses + if (!Objects.equals(branchOffice1.getBranchCompany(), branchOffice2.getBranchCompany())) { + // Not the same + isSameAddress = false; + } else if (!Objects.equals(branchOffice1.getBranchCountry(), branchOffice2.getBranchCountry())) { + // Not the same + isSameAddress = false; + } else if (!Objects.equals(branchOffice1.getBranchCity(), branchOffice2.getBranchCity())) { + // Not the same + isSameAddress = false; + } else if (!Objects.equals(branchOffice1.getBranchZipCode(), branchOffice2.getBranchZipCode())) { + // Not the same + isSameAddress = false; + } else if (!Objects.equals(branchOffice1.getBranchStreet(), branchOffice2.getBranchStreet())) { + // Not the same + isSameAddress = false; + } else if (!Objects.equals(branchOffice1.getBranchHouseNumber(), branchOffice2.getBranchHouseNumber())) { + // Not the same + isSameAddress = false; + } else if (!Objects.equals(branchOffice1.getBranchStore(), branchOffice2.getBranchStore())) { + // Not the same + isSameAddress = false; + } else if (!Objects.equals(branchOffice1.getBranchSuiteNumber(), branchOffice2.getBranchSuiteNumber())) { + // Not the same + isSameAddress = false; + } + + // Return flag + return isSameAddress; + } + + /** + * Private default constructor + */ + private BranchOfficeUtils () { + // Utilities don't have instances + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java new file mode 100644 index 0000000..7d001c1 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java @@ -0,0 +1,447 @@ +/* + * 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.branchoffice; + +import java.text.MessageFormat; +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.basicdata.CompanyBasicData; +import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployee; +import org.mxchange.jcontactsbusiness.model.employee.Employee; +import org.mxchange.jcountry.data.Country; +import org.mxchange.jcountry.data.CountryData; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.fax.FaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO for company branch offices + *

+ * @author Roland Häder + */ +@Entity (name = "company_branch_offices") +@Table (name = "company_branch_offices") +@NamedQueries ({ + @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC") +}) +@SuppressWarnings ("PersistenceUnitPresent") +public class CompanyBranchOffice implements BranchOffice { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 47_957_817_276_871_852L; + + /** + * Branch office's city name + */ + @Basic (optional = false) + @Column (name = "branch_city", length = 100, nullable = false) + private String branchCity; + + /** + * Company that has this branch office + */ + @JoinColumn (name = "branch_company_id", nullable = false, updatable = false) + @OneToOne (targetEntity = CompanyBasicData.class, optional = false, cascade = CascadeType.REFRESH) + private BusinessBasicData branchCompany; + + /** + * Reference to contact person + */ + @JoinColumn (name = "branch_contact_employee_id") + @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.REFRESH) + private Employee branchContactEmployee; + + /** + * Branch office's country code + */ + @JoinColumn (name = "branch_country_id", nullable = false) + @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) + private Country branchCountry; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "branch_entry_created", nullable = false, updatable = false) + private Calendar branchCreated; + + /** + * Branch office's main email address (example: branch-name@company.com) + */ + @Column (name = "branch_email_address", length = 100) + private String branchEmailAddress; + + /** + * Branch office's main fax number: +ccxxxxxxxxxx + */ + @JoinColumn (name = "branch_fax_number_id") + @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) + private DialableFaxNumber branchFaxNumber; + + /** + * Branch office's house number + */ + @Basic (optional = false) + @Column (name = "branch_house_number", length = 3, nullable = false) + private Short branchHouseNumber; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "branch_id", nullable = false, updatable = false) + private Long branchId; + + /** + * Branch office's main land-line number: +ccxxxxxxxxxx + */ + @JoinColumn (name = "branch_landline_number_id") + @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) + private DialableLandLineNumber branchLandLineNumber; + + /** + * Branch office's store (if multiple-store building) + */ + @Column (name = "branch_store", length = 3) + private Short branchStore; + + /** + * Branch office's street name + */ + @Basic (optional = false) + @Column (name = "branch_street", length = 100, nullable = false) + private String branchStreet; + + /** + * Branch office's suite number (if applyable) + */ + @Column (name = "branch_suite_number", length = 4) + private Short branchSuiteNumber; + + /** + * User owner instance + */ + @JoinColumn (name = "branch_user_id") + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH) + private User branchUserOwner; + + /** + * Branch office's ZIP code + */ + @Basic (optional = false) + @Column (name = "branch_zip_code", length = 6, nullable = false) + private Integer branchZipCode; + + /** + * Default constructor for JPA + */ + public CompanyBranchOffice () { + } + + /** + * Constructor with all required fields. This constructor may throw + * exceptions when one parameter is not valid or NULL. + *

+ * @param branchCity Branch office's city + * @param branchCompany Branch office's assigned company + * @param branchCountry Branch office's country + * @param branchStreet Branch office's street + * @param branchZipCode Branch office's ZIP code + * @param branchHouseNumber Branch office's house number + */ + public CompanyBranchOffice (final String branchCity, final BusinessBasicData branchCompany, final Country branchCountry, final String branchStreet, final Integer branchZipCode, final Short branchHouseNumber) { + // Call other constructor + this(); + + // Check all parameter + if (null == branchCity) { + // Throw NPE + throw new NullPointerException("branchCity is null"); //NOI18N + } else if (branchCity.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("branchCity is empty"); //NOI18N + } else if (null == branchCompany) { + // Throw NPE + throw new NullPointerException("branchCompany is null"); //NOI18N + } else if (branchCompany.getBasicDataId() == null) { + // Throw NPE again + throw new NullPointerException("branchCompany.basicDataId is null"); //NOI18N + } else if (branchCompany.getBasicDataId() < 1) { + // Throw IAE again + throw new IllegalArgumentException(MessageFormat.format("branchCompany.basicDataId={0} is invalid", branchCompany.getBasicDataId())); //NOI18N + } else if (null == branchCountry) { + // Throw NPE again + throw new NullPointerException("branchCountry is null"); //NOI18N + } else if (branchCountry.getCountryId() == null) { + // Throw NPE again + throw new NullPointerException("branchCountry.countryId is null"); //NOI18N + } else if (branchCountry.getCountryId() < 1) { + // Throw IAE again + throw new IllegalArgumentException(MessageFormat.format("branchCountry.countryId={0} is invalid", branchCountry.getCountryId())); //NOI18N + } else if (null == branchStreet) { + // Throw NPE + throw new NullPointerException("branchStreet is null"); //NOI18N + } else if (branchStreet.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("branchStreet is empty"); //NOI18N + } else if (null == branchZipCode) { + // Throw NPE + throw new NullPointerException("branchZipCode is null"); //NOI18N + } else if (branchZipCode < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("branchZipCode={0} is out of range.", branchZipCode)); //NOI18N + } else if (null == branchHouseNumber) { + // Throw NPE + throw new NullPointerException("branchHouseNumber is null"); //NOI18N + } else if (branchHouseNumber < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("branchHouseNumber={0} is out of range.", branchHouseNumber)); //NOI18N + } + + // Set all fields + this.branchCity = branchCity; + this.branchCompany = branchCompany; + this.branchCountry = branchCountry; + this.branchStreet = branchStreet; + this.branchZipCode = branchZipCode; + this.branchHouseNumber = branchHouseNumber; + } + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final BranchOffice other = (BranchOffice) object; + + if (!Objects.equals(this.getBranchId(), other.getBranchId())) { + return false; + } else if (!Objects.equals(this.getBranchCity(), other.getBranchCity())) { + return false; + } else if (!Objects.equals(this.getBranchCountry(), other.getBranchCountry())) { + return false; + } else if (!Objects.equals(this.getBranchHouseNumber(), other.getBranchHouseNumber())) { + return false; + } else if (!Objects.equals(this.getBranchStore(), other.getBranchStore())) { + return false; + } else if (!Objects.equals(this.getBranchStreet(), other.getBranchStreet())) { + return false; + } else if (!Objects.equals(this.getBranchSuiteNumber(), other.getBranchSuiteNumber())) { + return false; + } else if (!Objects.equals(this.getBranchZipCode(), other.getBranchZipCode())) { + return false; + } + + return true; + } + + @Override + public String getBranchCity () { + return this.branchCity; + } + + @Override + public void setBranchCity (final String branchCity) { + this.branchCity = branchCity; + } + + @Override + public BusinessBasicData getBranchCompany () { + return this.branchCompany; + } + + @Override + public void setBranchCompany (final BusinessBasicData branchCompany) { + this.branchCompany = branchCompany; + } + + @Override + public Employee getBranchContactEmployee () { + return this.branchContactEmployee; + } + + @Override + public void setBranchContactEmployee (final Employee branchContactEmployee) { + this.branchContactEmployee = branchContactEmployee; + } + + @Override + public Country getBranchCountry () { + return this.branchCountry; + } + + @Override + public void setBranchCountry (final Country branchCountry) { + this.branchCountry = branchCountry; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getBranchCreated () { + return this.branchCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setBranchCreated (final Calendar branchCreated) { + this.branchCreated = branchCreated; + } + + @Override + public String getBranchEmailAddress () { + return this.branchEmailAddress; + } + + @Override + public void setBranchEmailAddress (final String branchEmailAddress) { + this.branchEmailAddress = branchEmailAddress; + } + + @Override + public DialableFaxNumber getBranchFaxNumber () { + return this.branchFaxNumber; + } + + @Override + public void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber) { + this.branchFaxNumber = branchFaxNumber; + } + + @Override + public Short getBranchHouseNumber () { + return this.branchHouseNumber; + } + + @Override + public void setBranchHouseNumber (final Short branchHouseNumber) { + this.branchHouseNumber = branchHouseNumber; + } + + @Override + public Long getBranchId () { + return this.branchId; + } + + @Override + public void setBranchId (final Long branchId) { + this.branchId = branchId; + } + + @Override + public DialableLandLineNumber getBranchLandLineNumber () { + return this.branchLandLineNumber; + } + + @Override + public void setBranchLandLineNumber (final DialableLandLineNumber branchLandLineNumber) { + this.branchLandLineNumber = branchLandLineNumber; + } + + @Override + public Short getBranchStore () { + return this.branchStore; + } + + @Override + public void setBranchStore (final Short branchStore) { + this.branchStore = branchStore; + } + + @Override + public String getBranchStreet () { + return this.branchStreet; + } + + @Override + public void setBranchStreet (final String branchStreet) { + this.branchStreet = branchStreet; + } + + @Override + public Short getBranchSuiteNumber () { + return this.branchSuiteNumber; + } + + @Override + public void setBranchSuiteNumber (final Short branchSuiteNumber) { + this.branchSuiteNumber = branchSuiteNumber; + } + + @Override + public User getBranchUserOwner () { + return this.branchUserOwner; + } + + @Override + public void setBranchUserOwner (final User branchUserOwner) { + this.branchUserOwner = branchUserOwner; + } + + @Override + public Integer getBranchZipCode () { + return this.branchZipCode; + } + + @Override + public void setBranchZipCode (final Integer branchZipCode) { + this.branchZipCode = branchZipCode; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 53 * hash + Objects.hashCode(this.getBranchId()); + hash = 53 * hash + Objects.hashCode(this.getBranchCity()); + hash = 53 * hash + Objects.hashCode(this.getBranchCountry()); + hash = 53 * hash + Objects.hashCode(this.getBranchHouseNumber()); + hash = 53 * hash + Objects.hashCode(this.getBranchStore()); + hash = 53 * hash + Objects.hashCode(this.getBranchStreet()); + hash = 53 * hash + Objects.hashCode(this.getBranchSuiteNumber()); + hash = 53 * hash + Objects.hashCode(this.getBranchZipCode()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java new file mode 100644 index 0000000..c5fe6e8 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java @@ -0,0 +1,234 @@ +/* + * 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.department; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcontactsbusiness.model.basicdata.CompanyBasicData; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.branchoffice.CompanyBranchOffice; +import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployee; +import org.mxchange.jcontactsbusiness.model.employee.Employee; +import org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersData; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; + +/** + * A POJO for company departments + *

+ * @author Roland Häder + */ +@Entity (name = "company_departments") +@Table (name = "company_departments") +@SuppressWarnings ("PersistenceUnitPresent") +public class CompanyDepartment implements Department { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 94_835_918_958_717_660L; + + /** + * Where this department is located + */ + @JoinColumn (name = "department_headquarters_id") + @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) + private HeadquartersData departentHeadquarters; + + /** + * Where this department is located + */ + @JoinColumn (name = "department_branch_id") + @ManyToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) + private BranchOffice departmentBranchOffice; + + /** + * Connection to company contact + */ + @JoinColumn (name = "department_company_id", nullable = false, updatable = false) + @ManyToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.ALL, optional = false) + private BusinessBasicData departmentCompany; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "department_entry_created", nullable = false, updatable = false) + private Calendar departmentCreated; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "department_id", nullable = false, updatable = false) + private Long departmentId; + + /** + * Department lead employee + */ + @JoinColumn (name = "department_lead_id", nullable = false) + @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) + private Employee departmentLead; + + /** + * Department name + */ + @Basic (optional = false) + @Column (name = "department_name", length = 100, nullable = false) + private String departmentName; + + /** + * User owner instance + */ + @JoinColumn (name = "department_user_id", nullable = false, updatable = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + private User departmentUserOwner; + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final Department other = (Department) object; + + if (!Objects.equals(this.getDepartmentId(), other.getDepartmentId())) { + return false; + } else if (!Objects.equals(this.getDepartmentCompany(), other.getDepartmentCompany())) { + return false; + } else if (!Objects.equals(this.getDepartmentName(), other.getDepartmentName())) { + return false; + } + + return true; + } + + @Override + public HeadquartersData getDepartentHeadquarters () { + return this.departentHeadquarters; + } + + @Override + public void setDepartentHeadquarters (final HeadquartersData departentHeadquarters) { + this.departentHeadquarters = departentHeadquarters; + } + + @Override + public BranchOffice getDepartmentBranchOffice () { + return this.departmentBranchOffice; + } + + @Override + public void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice) { + this.departmentBranchOffice = departmentBranchOffice; + } + + @Override + public BusinessBasicData getDepartmentCompany () { + return this.departmentCompany; + } + + @Override + public void setDepartmentCompany (final BusinessBasicData departmentCompany) { + this.departmentCompany = departmentCompany; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getDepartmentCreated () { + return this.departmentCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setDepartmentCreated (final Calendar departmentCreated) { + this.departmentCreated = departmentCreated; + } + + @Override + public Long getDepartmentId () { + return this.departmentId; + } + + @Override + public void setDepartmentId (final Long departmentId) { + this.departmentId = departmentId; + } + + @Override + public Employee getDepartmentLead () { + return this.departmentLead; + } + + @Override + public void setDepartmentLead (final Employee departmentLead) { + this.departmentLead = departmentLead; + } + + @Override + public String getDepartmentName () { + return this.departmentName; + } + + @Override + public void setDepartmentName (final String departmentName) { + this.departmentName = departmentName; + } + + @Override + public User getDepartmentUserOwner () { + return this.departmentUserOwner; + } + + @Override + public void setDepartmentUserOwner (final User departmentUserOwner) { + this.departmentUserOwner = departmentUserOwner; + } + + @Override + public int hashCode () { + int hash = 5; + + hash = 53 * hash + Objects.hashCode(this.getDepartmentId()); + hash = 53 * hash + Objects.hashCode(this.getDepartmentCompany()); + hash = 53 * hash + Objects.hashCode(this.getDepartmentName()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/department/Department.java b/src/org/mxchange/jcontactsbusiness/model/department/Department.java new file mode 100644 index 0000000..9ca6f9b --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/department/Department.java @@ -0,0 +1,151 @@ +/* + * 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.department; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.employee.Employee; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; + +/** + * A POJI for company departments + *

+ * @author Roland Häder + */ +public interface Department extends Serializable { + + /** + * Getter for connection to company contact + *

+ * @return Connection to company contact + */ + BusinessBasicData getDepartmentCompany (); + + /** + * Setter for connection to company contact + *

+ * @param departmentCompany Connection to company contact + */ + void setDepartmentCompany (final BusinessBasicData departmentCompany); + + /** + * Getter for connection to company headquarters + *

+ * @return Connection to company headquarters + */ + HeadquartersData getDepartentHeadquarters (); + + /** + * Setter for connection to company headquarters + *

+ * @param departentHeadquarters Connection to company headquarters + */ + void setDepartentHeadquarters (final HeadquartersData departentHeadquarters); + + /** + * Getter for connection to company branch office + *

+ * @return Connection to company branch office + */ + BranchOffice getDepartmentBranchOffice (); + + /** + * Setter for connection to company branch office + *

+ * @param departmentBranchOffice Connection to company branch office + */ + void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice); + + /** + * Getter for department id + *

+ * @return Department id + */ + Long getDepartmentId (); + + /** + * Setter for department id + *

+ * @param departmentId Department id + */ + void setDepartmentId (final Long departmentId); + + /** + * Getter for department lead employee + *

+ * @return Department lead employee + */ + Employee getDepartmentLead (); + + /** + * Setter for department lead employee + *

+ * @param departmentLead Department lead employee + */ + void setDepartmentLead (final Employee departmentLead); + + /** + * Getter for department name + *

+ * @return Department name + */ + String getDepartmentName (); + + /** + * Setter for department name + *

+ * @param departmentName Department name + */ + void setDepartmentName (final String departmentName); + + /** + * Getter for user owner instance + *

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

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

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

+ * @param departmentCreated Timestamp when this entry has been created + */ + void setDepartmentCreated (final Calendar departmentCreated); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jcontactsbusiness/model/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/model/employee/CompanyEmployee.java new file mode 100644 index 0000000..d2bd7da --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/employee/CompanyEmployee.java @@ -0,0 +1,332 @@ +/* + * 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.employee; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontacts.contact.UserContact; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.basicdata.CompanyBasicData; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.branchoffice.CompanyBranchOffice; +import org.mxchange.jcontactsbusiness.model.department.CompanyDepartment; +import org.mxchange.jcontactsbusiness.model.department.Department; +import org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersData; +import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; +import org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition; +import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition; +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; + +/** + * A POJO for company employees (including CEO) + *

+ * @author Roland Häder + */ +@Entity (name = "company_employees") +@Table (name = "company_employees") +@NamedQueries ( + { + @NamedQuery (name = "AllCompanyEmployees", query = "SELECT e FROM company_employees AS e ORDER BY e.employeeId ASC"), + @NamedQuery (name = "SearchCompanyEmployeeById", query = "SELECT e FROM company_employees AS e WHERE e.employeeId = :employeeId") + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class CompanyEmployee implements Employee { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 48_959_819_859_812_076L; + + /** + * Branch office (if the employee works there) + */ + @JoinColumn (name = "employee_branch_id") + @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) + private BranchOffice employeeBranchOffice; + + /** + * Company the employee is working at + */ + @JoinColumn (name = "employee_company_id", nullable = false, updatable = false) + @OneToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.ALL, optional = false) + private BusinessBasicData employeeCompany; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "employee_entry_created", nullable = false, updatable = false) + private Calendar employeeCreated; + + /** + * Department the employee works at + */ + @JoinColumn (name = "employee_department_id") + @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL) + private Department employeeDepartment; + + /** + * Employee's email address + */ + @Column (name = "employee_email_address", length = 30) + private String employeeEmailAddress; + + /** + * Head quarters id number (if the employee works there) + */ + @JoinColumn (name = "employee_headquarters_id") + @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL) + private HeadquartersData employeeHeadquarter; + + /** + * Id number + */ + @Id + @Column (name = "employee_id", nullable = false, updatable = false) + @GeneratedValue (strategy = GenerationType.IDENTITY) + private Long employeeId; + + /** + * Employee's business mobile number + */ + @JoinColumn (name = "employee_mobile_number_id") + @OneToOne (targetEntity = MobileNumber.class, cascade = CascadeType.ALL) + private DialableMobileNumber employeeMobileNumber; + + /** + * Employee's staff number + */ + @Column (name = "employee_staff_number", length = 20) + private String employeeNumber; + + /** + * Employee's personal data + */ + @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false) + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) + private Contact employeePersonalData; + + /** + * Employee's phone extension (or number if different) + */ + @Column (name = "employee_phone_extension", length = 10) + private Integer employeePhoneExtension; + + /** + * Employee's position (example: CEO) + */ + @JoinColumn (name = "employee_position_id") + @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.REFRESH) + private JobPosition employeePosition; + + /** + * User owner instance + */ + @JoinColumn (name = "employee_user_id", nullable = false, updatable = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + private User employeeUserOwner; + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final Employee other = (Employee) object; + + if (!Objects.equals(this.getEmployeeId(), other.getEmployeeId())) { + return false; + } else if (!Objects.equals(this.getEmployeeCompany(), other.getEmployeeCompany())) { + return false; + } else if (!Objects.equals(this.getEmployeeNumber(), other.getEmployeeNumber())) { + return false; + } else if (!Objects.equals(this.getEmployeePersonalData(), other.getEmployeePersonalData())) { + return false; + } + + return true; + } + + @Override + public BranchOffice getEmployeeBranchOffice () { + return this.employeeBranchOffice; + } + + @Override + public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice) { + this.employeeBranchOffice = employeeBranchOffice; + } + + @Override + public BusinessBasicData getEmployeeCompany () { + return this.employeeCompany; + } + + @Override + public void setEmployeeCompany (final BusinessBasicData employeeCompany) { + this.employeeCompany = employeeCompany; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getEmployeeCreated () { + return this.employeeCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setEmployeeCreated (final Calendar employeeCreated) { + this.employeeCreated = employeeCreated; + } + + @Override + public Department getEmployeeDepartment () { + return this.employeeDepartment; + } + + @Override + public void setEmployeeDepartment (final Department employeeDepartment) { + this.employeeDepartment = employeeDepartment; + } + + @Override + public String getEmployeeEmailAddress () { + return this.employeeEmailAddress; + } + + @Override + public void setEmployeeEmailAddress (final String employeeEmailAddress) { + this.employeeEmailAddress = employeeEmailAddress; + } + + @Override + public HeadquartersData getEmployeeHeadquarter () { + return this.employeeHeadquarter; + } + + @Override + public void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter) { + this.employeeHeadquarter = employeeHeadquarter; + } + + @Override + public Long getEmployeeId () { + return this.employeeId; + } + + @Override + public void setEmployeeId (final Long employeeId) { + this.employeeId = employeeId; + } + + @Override + public DialableMobileNumber getEmployeeMobileNumber () { + return this.employeeMobileNumber; + } + + @Override + public void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber) { + this.employeeMobileNumber = employeeMobileNumber; + } + + @Override + public String getEmployeeNumber () { + return this.employeeNumber; + } + + @Override + public void setEmployeeNumber (final String employeeNumber) { + this.employeeNumber = employeeNumber; + } + + @Override + public Contact getEmployeePersonalData () { + return this.employeePersonalData; + } + + @Override + public void setEmployeePersonalData (final Contact employeePersonalData) { + this.employeePersonalData = employeePersonalData; + } + + @Override + public Integer getEmployeePhoneExtension () { + return this.employeePhoneExtension; + } + + @Override + public void setEmployeePhoneExtension (final Integer employeePhoneExtension) { + this.employeePhoneExtension = employeePhoneExtension; + } + + @Override + public JobPosition getEmployeePosition () { + return this.employeePosition; + } + + @Override + public void setEmployeePosition (final JobPosition employeePosition) { + this.employeePosition = employeePosition; + } + + @Override + public User getEmployeeUserOwner () { + return this.employeeUserOwner; + } + + @Override + public void setEmployeeUserOwner (final User employeeUserOwner) { + this.employeeUserOwner = employeeUserOwner; + } + + @Override + public int hashCode () { + int hash = 3; + + hash = 97 * hash + Objects.hashCode(this.getEmployeeId()); + hash = 97 * hash + Objects.hashCode(this.getEmployeeCompany()); + hash = 97 * hash + Objects.hashCode(this.getEmployeeNumber()); + hash = 97 * hash + Objects.hashCode(this.getEmployeePersonalData()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/employee/Employee.java b/src/org/mxchange/jcontactsbusiness/model/employee/Employee.java new file mode 100644 index 0000000..4f709f4 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/employee/Employee.java @@ -0,0 +1,224 @@ +/* + * 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.employee; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.department.Department; +import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; + +/** + * A POJI for employees + *

+ * @author Roland Häder + */ +public interface Employee extends Serializable { + + /** + * Getter for employee's branch office + *

+ * @return Employee's branch office + */ + BranchOffice getEmployeeBranchOffice (); + + /** + * Setter for employee's branch office + *

+ * @param employeeBranchOffice Employee's branch office + */ + void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice); + + /** + * Getter for employee's company + *

+ * @return Company instance + */ + BusinessBasicData getEmployeeCompany (); + + /** + * Setter for employee's company + *

+ * @param employeeCompany Company instance + */ + void setEmployeeCompany (final BusinessBasicData employeeCompany); + + /** + * Getter for employee's department + *

+ * @return Employee's department + */ + Department getEmployeeDepartment (); + + /** + * Setter for employee's department + *

+ * @param employeeDepartment Employee's department + */ + void setEmployeeDepartment (final Department employeeDepartment); + + /** + * Getter for employee's head quarters + *

+ * @return Employee's head quarters + */ + HeadquartersData getEmployeeHeadquarter (); + + /** + * Getter for employee's head quarters + *

+ * @param employeeHeadquarter Employee's head quarters + */ + void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter); + + /** + * Getter for employee's email address + *

+ * @return Employee's email address + */ + String getEmployeeEmailAddress (); + + /** + * Setter for employee's email address + *

+ * @param employeeEmailAddress Employee's email address + */ + void setEmployeeEmailAddress (final String employeeEmailAddress); + + /** + * Getter for employee's id number + *

+ * @return Employee's id number + */ + Long getEmployeeId (); + + /** + * Setter for employee's id number + *

+ * @param employeeId Employee's id number + */ + void setEmployeeId (final Long employeeId); + + /** + * Getter for employee's mobile number + *

+ * @return Employee's mobile number + */ + DialableMobileNumber getEmployeeMobileNumber (); + + /** + * Setter for employee's mobile number + *

+ * @param employeeMobileNumber Employee's mobile number + */ + void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber); + + /** + * Getter for employee's number + *

+ * @return Employee's number + */ + String getEmployeeNumber (); + + /** + * Setter for employee's number + *

+ * @param employeeNumber Employee's number + */ + void setEmployeeNumber (final String employeeNumber); + + /** + * Getter for employee's personal data + *

+ * @return Employee's personal data + */ + Contact getEmployeePersonalData (); + + /** + * Setter for employee's personal data + *

+ * @param employeePersonalData Employee's personal data + */ + void setEmployeePersonalData (final Contact employeePersonalData); + + /** + * Getter for employee's phone number/extension + *

+ * @return Employee's phone number/extension + */ + Integer getEmployeePhoneExtension (); + + /** + * Setter for employee's phone number/extension + *

+ * @param employeePhoneExtension Employee's phone number/extension + */ + void setEmployeePhoneExtension (final Integer employeePhoneExtension); + + /** + * Getter for employee's position + *

+ * @return Employee's position + */ + JobPosition getEmployeePosition (); + + /** + * Setter for employee's position + *

+ * @param employeePosition Employee's position + */ + void setEmployeePosition (final JobPosition employeePosition); + + /** + * Getter for user owner instance + *

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

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

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

+ * @param employeeCreated Timestamp when this entry has been created + */ + void setEmployeeCreated (final Calendar employeeCreated); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.java new file mode 100644 index 0000000..77b5360 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersData.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.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcountry.data.Country; +import org.mxchange.jcountry.data.CountryData; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.fax.FaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO for company headquarts data + *

+ * @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 Calendar headquartersCreated; + + /** + * Headquarters' fax number + */ + @JoinColumn (name = "headquarters_fax_number_id") + @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) + private DialableFaxNumber headquartersFaxNumber; + + /** + * Headquarters' house number + */ + @Basic (optional = false) + @Column (name = "headquarters_house_number", length = 4, nullable = false) + private Short headquartersHouseNumber; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "headquarters_id", nullable = false, updatable = false) + private Long headquartersId; + + /** + * Headquarters' phone number + */ + @JoinColumn (name = "headquarters_phone_number_id") + @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) + private DialableLandLineNumber headquartersPhoneNumber; + + /** + * Headquarters' store number (multi-store building only) + */ + @Column (name = "headquarters_store", length = 3) + private Short headquartersStore; + + /** + * Headquarters' street name + */ + @Basic (optional = false) + @Column (name = "headquarters_street", length = 100, nullable = false) + private String headquartersStreet; + + /** + * Headquarters' suite number + */ + @Column (name = "headquarters_suite_number", length = 4) + private Short headquartersSuiteNumber; + + /** + * User owner instance + */ + @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + private User headquartersUserOwner; + + /** + * Headquarters' ZIP code + */ + @Basic (optional = false) + @Column (name = "headquarters_zip_code", length = 6, nullable = false) + private Integer headquartersZipCode; + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final HeadquartersData other = (HeadquartersData) object; + + if (!Objects.equals(this.getHeadquartersId(), other.getHeadquartersId())) { + return false; + } else if (!Objects.equals(this.getHeadquartersCity(), other.getHeadquartersCity())) { + return false; + } else if (!Objects.equals(this.getHeadquartersCountry(), other.getHeadquartersCountry())) { + return false; + } else if (!Objects.equals(this.getHeadquartersHouseNumber(), other.getHeadquartersHouseNumber())) { + return false; + } else if (!Objects.equals(this.getHeadquartersStore(), other.getHeadquartersStore())) { + return false; + } else if (!Objects.equals(this.getHeadquartersStreet(), other.getHeadquartersStreet())) { + return false; + } else if (!Objects.equals(this.getHeadquartersSuiteNumber(), other.getHeadquartersSuiteNumber())) { + return false; + } else if (!Objects.equals(this.getHeadquartersZipCode(), other.getHeadquartersZipCode())) { + return false; + } + + return true; + } + + @Override + public String getHeadquartersCity () { + return this.headquartersCity; + } + + @Override + public void setHeadquartersCity (final String headquartersCity) { + this.headquartersCity = headquartersCity; + } + + @Override + public Country getHeadquartersCountry () { + return this.headquartersCountry; + } + + @Override + public void setHeadquartersCountry (final Country headquartersCountry) { + this.headquartersCountry = headquartersCountry; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getHeadquartersCreated () { + return this.headquartersCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setHeadquartersCreated (final Calendar headquartersCreated) { + this.headquartersCreated = headquartersCreated; + } + + @Override + public DialableFaxNumber getHeadquartersFaxNumber () { + return this.headquartersFaxNumber; + } + + @Override + public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) { + this.headquartersFaxNumber = headquartersFaxNumber; + } + + @Override + public Short getHeadquartersHouseNumber () { + return this.headquartersHouseNumber; + } + + @Override + public void setHeadquartersHouseNumber (final Short headquartersHouseNumber) { + this.headquartersHouseNumber = headquartersHouseNumber; + } + + @Override + public Long getHeadquartersId () { + return this.headquartersId; + } + + @Override + public void setHeadquartersId (final Long headquartersId) { + this.headquartersId = headquartersId; + } + + @Override + public DialableLandLineNumber getHeadquartersPhoneNumber () { + return this.headquartersPhoneNumber; + } + + @Override + public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) { + this.headquartersPhoneNumber = headquartersPhoneNumber; + } + + @Override + public Short getHeadquartersStore () { + return this.headquartersStore; + } + + @Override + public void setHeadquartersStore (final Short headquartersStore) { + this.headquartersStore = headquartersStore; + } + + @Override + public String getHeadquartersStreet () { + return this.headquartersStreet; + } + + @Override + public void setHeadquartersStreet (final String headquartersStreet) { + this.headquartersStreet = headquartersStreet; + } + + @Override + public Short getHeadquartersSuiteNumber () { + return this.headquartersSuiteNumber; + } + + @Override + public void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber) { + this.headquartersSuiteNumber = headquartersSuiteNumber; + } + + @Override + public User getHeadquartersUserOwner () { + return this.headquartersUserOwner; + } + + @Override + public void setHeadquartersUserOwner (final User headquartersUserOwner) { + this.headquartersUserOwner = headquartersUserOwner; + } + + @Override + public Integer getHeadquartersZipCode () { + return this.headquartersZipCode; + } + + @Override + public void setHeadquartersZipCode (final Integer headquartersZipCode) { + this.headquartersZipCode = headquartersZipCode; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 47 * hash + Objects.hashCode(this.getHeadquartersId()); + hash = 47 * hash + Objects.hashCode(this.getHeadquartersCity()); + hash = 47 * hash + Objects.hashCode(this.getHeadquartersCountry()); + hash = 47 * hash + Objects.hashCode(this.getHeadquartersHouseNumber()); + hash = 47 * hash + Objects.hashCode(this.getHeadquartersStore()); + hash = 47 * hash + Objects.hashCode(this.getHeadquartersStreet()); + hash = 47 * hash + Objects.hashCode(this.getHeadquartersSuiteNumber()); + hash = 47 * hash + Objects.hashCode(this.getHeadquartersZipCode()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersData.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersData.java new file mode 100644 index 0000000..e0e1138 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersData.java @@ -0,0 +1,206 @@ +/* + * 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.headquarters; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcountry.data.Country; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for headquarters data + *

+ * @author Roland Häder + */ +public interface HeadquartersData extends Serializable { + + /** + * Getter for headquarters' city name + *

+ * @return Headquarters' city name + */ + String getHeadquartersCity (); + + /** + * Setter for headquarters' city name + *

+ * @param headquartersCity Headquarters' city name + */ + void setHeadquartersCity (final String headquartersCity); + + /** + * Getter for headquarters' country code + *

+ * @return Headquarters' country code + */ + Country getHeadquartersCountry (); + + /** + * Setter for headquarters' country code + *

+ * @param headquartersCountryCode Headquarters' country code + */ + void setHeadquartersCountry (final Country headquartersCountryCode); + + /** + * Getter for headquarters' house number + *

+ * @return Headquarters' house number + */ + Short getHeadquartersHouseNumber (); + + /** + * Setter for headquarters' house number + *

+ * @param headquartersHouseNumber Headquarters' house number + */ + void setHeadquartersHouseNumber (final Short headquartersHouseNumber); + + /** + * Getter for headquarters' id number + *

+ * @return Headquarters' id number + */ + Long getHeadquartersId (); + + /** + * Setter for headquarters' id number + *

+ * @param headquartersId Headquarters' id number + */ + void setHeadquartersId (final Long headquartersId); + + /** + * Getter for headquarters' store number + *

+ * @return Headquarters' store number + */ + Short getHeadquartersStore (); + + /** + * Setter for headquarters' store number + *

+ * @param headquartersStore Headquarters' store number + */ + void setHeadquartersStore (final Short headquartersStore); + + /** + * Getter for headquarters' street name + *

+ * @return Headquarters' street name + */ + String getHeadquartersStreet (); + + /** + * Setter for headquarters' street name + *

+ * @param headquartersStreet Headquarters' street name + */ + void setHeadquartersStreet (final String headquartersStreet); + + /** + * Getter for headquarters' suite number + *

+ * @return Headquarters' suite number + */ + Short getHeadquartersSuiteNumber (); + + /** + * Setter for headquarters' suite number + *

+ * @param headquartersSuiteNumber Headquarters' suite number + */ + void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber); + + /** + * Getter for headquarters' ZIP code + *

+ * @return Headquarters' ZIP code + */ + Integer getHeadquartersZipCode (); + + /** + * Setter for headquarters' ZIP code + *

+ * @param headquartersZipCode Headquarters' ZIP code + */ + void setHeadquartersZipCode (final Integer headquartersZipCode); + + /** + * Getter for headquarters' phone number + *

+ * @return Headquarters' phone number + */ + DialableLandLineNumber getHeadquartersPhoneNumber (); + + /** + * Setter for headquarters' phone number + *

+ * @param headquartersPhoneNumber Headquarters' phone number + */ + void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber); + + /** + * Getter for headquarters' fax number + *

+ * @return Headquarters' fax number + */ + DialableFaxNumber getHeadquartersFaxNumber (); + + /** + * Setter for headquarters' fax number + *

+ * @param headquartersFaxNumber Headquarters' fax number + */ + void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber); + + /** + * Getter for user owner instance + *

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

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

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

+ * @param headquartersCreated Timestamp when this entry has been created + */ + void setHeadquartersCreated (final Calendar headquartersCreated); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java b/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java new file mode 100644 index 0000000..76733c3 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java @@ -0,0 +1,155 @@ +/* + * 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.jobposition; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * A POJO for job positions + *

+ * @author Roland Häder + */ +@Entity (name = "company_job_positions") +@Table ( + name = "company_job_positions" +) +@SuppressWarnings ("PersistenceUnitPresent") +public class EmployeePosition implements JobPosition { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 18_427_587_187_609L; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "job_position_created", nullable = false, updatable = false) + private Calendar jobPositionCreated; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "job_position_id", nullable = false, updatable = false) + private Long jobPositionId; + + /** + * Name/description of the job position (example: CEO) + */ + @Basic (optional = false) + @Column (name = "job_position_name", nullable = false, unique = true) + private String jobPositionName; + + /** + * Timestamp when this entry has been created + */ + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "job_position_updated", insertable = false) + private Calendar jobPositionUpdated; + + @Override + public boolean equals (final Object object) { + if (this == object) { + return true; + } else if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final JobPosition other = (JobPosition) object; + + if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) { + return false; + } else if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) { + return false; + } + + return true; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionCreated () { + return this.jobPositionCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionCreated (final Calendar jobPositionCreated) { + this.jobPositionCreated = jobPositionCreated; + } + + @Override + public Long getJobPositionId () { + return this.jobPositionId; + } + + @Override + public void setJobPositionId (final Long jobPositionId) { + this.jobPositionId = jobPositionId; + } + + @Override + public String getJobPositionName () { + return this.jobPositionName; + } + + @Override + public void setJobPositionName (final String jobPositionName) { + this.jobPositionName = jobPositionName; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionUpdated () { + return this.jobPositionUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionUpdated (final Calendar jobPositionUpdated) { + this.jobPositionUpdated = jobPositionUpdated; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 37 * hash + Objects.hashCode(this.getJobPositionId()); + hash = 37 * hash + Objects.hashCode(this.getJobPositionName()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/JobPosition.java b/src/org/mxchange/jcontactsbusiness/model/jobposition/JobPosition.java new file mode 100644 index 0000000..3048c8f --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/jobposition/JobPosition.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.jobposition; + +import java.io.Serializable; +import java.util.Calendar; + +/** + * A POJI for job positions + *

+ * @author Roland Häder + */ +public interface JobPosition extends Serializable { + + /** + * Getter for id number + *

+ * @return Id number + */ + Long getJobPositionId (); + + /** + * Setter for id number + *

+ * @param jobPositionId Id number + */ + void setJobPositionId (final Long jobPositionId); + + /** + * Getter for job position name + *

+ * @return Job position name + */ + String getJobPositionName (); + + /** + * Setter for job position name + *

+ * @param jobPositionName Job position name + */ + void setJobPositionName (final String jobPositionName); + + /** + * Getter for timestamp when this entry has been created + *

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

+ * @param jobPositionCreated Timestamp when this entry has been created + */ + void setJobPositionCreated (final Calendar jobPositionCreated); + + /** + * Getter for timestamp when this entry has been updated + *

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

+ * @param jobPositionUpdated Timestamp when this entry has been updated + */ + void setJobPositionUpdated (final Calendar jobPositionUpdated); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java new file mode 100644 index 0000000..f899901 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.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.Calendar; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for business logos + *

+ * @author Roland Häder + */ +public interface BusinessLogo 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 + */ + Calendar getLogoCreated (); + + /** + * Setter for timestamp when this entry has been created + *

+ * @param logoCreated Timestamp when this entry has been created + */ + void setLogoCreated (final Calendar logoCreated); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jcontactsbusiness/model/logo/CompanyLogo.java b/src/org/mxchange/jcontactsbusiness/model/logo/CompanyLogo.java new file mode 100644 index 0000000..0549435 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/logo/CompanyLogo.java @@ -0,0 +1,157 @@ +/* + * 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.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.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 Calendar 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 Calendar getLogoCreated () { + return this.logoCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setLogoCreated (final Calendar 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/opening_times/BusinessOpeningTimes.java b/src/org/mxchange/jcontactsbusiness/model/opening_times/BusinessOpeningTimes.java new file mode 100644 index 0000000..dbb950d --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/opening_times/BusinessOpeningTimes.java @@ -0,0 +1,223 @@ +/* + * 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.opening_times; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcontactsbusiness.model.opening_times.dayofweek.DayOfTheWeek; + +/** + * A POJO for business opening hours + *

+ * @author Roland Häder + */ +@Entity (name = "company_opening_times") +@Table (name = "company_opening_times") +@SuppressWarnings ("PersistenceUnitPresent") +public class BusinessOpeningTimes implements OpeningTimes { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 19_578_871_756_871L; + + /** + * Ending day of opening hours (if applyable) + */ + @Column (name = "opening_times_end_day") + @Enumerated (EnumType.STRING) + private DayOfTheWeek endDay; + + /** + * Ending time (hh:mm) + */ + @Basic (optional = false) + @Column (name = "opening_times_end_time", nullable = false) + @Temporal (TemporalType.TIME) + private Calendar endTime; + + /** + * Id number + */ + @Id + @Column (name = "opening_times_id", nullable = false, updatable = false) + @GeneratedValue (strategy = GenerationType.IDENTITY) + private Long id; + + /** + * Starting day of opening times + */ + @Basic (optional = false) + @Column (name = "opening_times_start_day", nullable = false) + @Enumerated (EnumType.STRING) + private DayOfTheWeek startDay; + + /** + * Starting time (hh:mm) + */ + @Basic (optional = false) + @Column (name = "opening_times_start_time", nullable = false) + @Temporal (TemporalType.TIME) + private Calendar startTime; + + /** + * Default constructor + */ + public BusinessOpeningTimes () { + } + + /** + * Constructor with all field + *

+ * @param endDay End day + * @param endTime End time + * @param id Id number + * @param startDay Start day + * @param startTime Start time + */ + public BusinessOpeningTimes (final DayOfTheWeek endDay, final Calendar endTime, final Long id, final DayOfTheWeek startDay, final Calendar startTime) { + // Call other constructor + this(endDay, endTime, startDay, startTime); + + // Set id number + this.id = id; + } + + /** + * Constructor with all fields except id number + *

+ * @param endDay End day + * @param endTime End time + * @param startDay Start day + * @param startTime Start time + */ + public BusinessOpeningTimes (final DayOfTheWeek endDay, final Calendar endTime, final DayOfTheWeek startDay, final Calendar startTime) { + // Set all fields + this.endDay = endDay; + this.endTime = endTime; + this.startDay = startDay; + this.startTime = startTime; + } + + @Override + public boolean equals (final Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } + + final OpeningTimes openingTimes = (OpeningTimes) obj; + + if (!Objects.equals(this.getId(), openingTimes.getId())) { + return false; + } else if (this.getStartDay() != openingTimes.getStartDay()) { + return false; + } else if (this.getEndDay() != openingTimes.getEndDay()) { + return false; + } else if (!Objects.equals(this.getStartTime(), openingTimes.getStartTime())) { + return false; + } else if (!Objects.equals(this.getEndTime(), openingTimes.getEndTime())) { + return false; + } + + return true; + } + + @Override + public DayOfTheWeek getEndDay () { + return this.endDay; + } + + @Override + public void setEndDay (final DayOfTheWeek endDay) { + this.endDay = endDay; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getEndTime () { + return this.endTime; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setEndTime (final Calendar endTime) { + this.endTime = endTime; + } + + @Override + public Long getId () { + return this.id; + } + + @Override + public void setId (Long id) { + this.id = id; + } + + @Override + public DayOfTheWeek getStartDay () { + return this.startDay; + } + + @Override + public void setStartDay (final DayOfTheWeek startDay) { + this.startDay = startDay; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getStartTime () { + return this.startTime; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setStartTime (final Calendar startTime) { + this.startTime = startTime; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 97 * hash + Objects.hashCode(this.getId()); + hash = 97 * hash + Objects.hashCode(this.getStartDay()); + hash = 97 * hash + Objects.hashCode(this.getEndDay()); + hash = 97 * hash + Objects.hashCode(this.getStartTime()); + hash = 97 * hash + Objects.hashCode(this.getEndTime()); + + return hash; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/opening_times/OpeningTimes.java b/src/org/mxchange/jcontactsbusiness/model/opening_times/OpeningTimes.java new file mode 100644 index 0000000..f5111e8 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/opening_times/OpeningTimes.java @@ -0,0 +1,106 @@ +/* + * 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.opening_times; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcontactsbusiness.model.opening_times.dayofweek.DayOfTheWeek; + +/** + * A POJI for opening times + * + * @author Roland Häder + */ +public interface OpeningTimes extends Serializable { + + /** + * Getter for id number + *

+ * @return Id number + */ + Long getId (); + + /** + * Setter for id number + *

+ * @param id Id number + */ + void setId (final Long id); + + /** + * Getter for starting day + *

+ * @return Starting day + */ + DayOfTheWeek getStartDay (); + + /** + * Setter for starting day + *

+ * @param startDay Starting day + */ + void setStartDay (final DayOfTheWeek startDay); + + /** + * Getter for ending day + *

+ * @return Ending day + */ + DayOfTheWeek getEndDay (); + + /** + * Setter for ending day + *

+ * @param endDay Ending day + */ + void setEndDay (final DayOfTheWeek endDay); + + /** + * Getter for starting time + *

+ * @return Starting time + */ + Calendar getStartTime (); + + /** + * Setter for starting time + *

+ * @param startTime Starting time + */ + void setStartTime (final Calendar startTime); + + /** + * Getter for ending time + *

+ * @return Ending time + */ + Calendar getEndTime (); + + /** + * Setter for ending time + *

+ * @param endTime Ending time + */ + void setEndTime (final Calendar endTime); + + @Override + boolean equals (final Object obj); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/opening_times/dayofweek/DayOfTheWeek.java b/src/org/mxchange/jcontactsbusiness/model/opening_times/dayofweek/DayOfTheWeek.java new file mode 100644 index 0000000..74f45b9 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/opening_times/dayofweek/DayOfTheWeek.java @@ -0,0 +1,107 @@ +/* + * 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.opening_times.dayofweek; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * An enumeration suitable for persisting + *

+ * @author Roland Häder + */ +public enum DayOfTheWeek { + SUNDAY { + @Override + public int toCalendar () { + return Calendar.SUNDAY; + } + + }, + MONDAY { + @Override + public int toCalendar () { + return Calendar.MONDAY; + } + }, + TUESDAY { + @Override + public int toCalendar () { + return Calendar.TUESDAY; + } + }, + WEDNESDAY { + @Override + public int toCalendar () { + return Calendar.WEDNESDAY; + } + }, + THURSDAY { + @Override + public int toCalendar () { + return Calendar.THURSDAY; + } + }, + FRIDAY { + @Override + public int toCalendar () { + return Calendar.FRIDAY; + } + }, + SATURDAY { + @Override + public int toCalendar () { + return Calendar.SATURDAY; + } + }; + + public abstract int toCalendar (); + + public static DayOfTheWeek fromCalendarDay (final int day) { + + for (DayOfTheWeek dayOfWeek : DayOfTheWeek.values()) { + if (dayOfWeek.toCalendar() == day) { + return dayOfWeek; + } + } + + return null; // Consider throwing IllegalArgumentException + } + + public static DayOfTheWeek getByDate (final Date date) { + Calendar calendar = GregorianCalendar.getInstance(); + calendar.setTime(date); + return fromCalendarDay(calendar.get(Calendar.DAY_OF_WEEK)); + } + + /* + * Should return the localized day of the week + */ + @Override + public String toString () { + Calendar c = new GregorianCalendar(); + c.set(Calendar.DAY_OF_WEEK, this.toCalendar()); + SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat + .getInstance(); + sdf.applyPattern("EEEEEEEEEE"); //NOI18N + + return sdf.format(c.getTime()); + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java b/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java deleted file mode 100644 index 1262030..0000000 --- a/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java +++ /dev/null @@ -1,223 +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.opening_times; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcontactsbusiness.opening_times.dayofweek.DayOfTheWeek; - -/** - * A POJO for business opening hours - *

- * @author Roland Häder - */ -@Entity (name = "company_opening_times") -@Table (name = "company_opening_times") -@SuppressWarnings ("PersistenceUnitPresent") -public class BusinessOpeningTimes implements OpeningTimes { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 19_578_871_756_871L; - - /** - * Ending day of opening hours (if applyable) - */ - @Column (name = "opening_times_end_day") - @Enumerated (EnumType.STRING) - private DayOfTheWeek endDay; - - /** - * Ending time (hh:mm) - */ - @Basic (optional = false) - @Column (name = "opening_times_end_time", nullable = false) - @Temporal (TemporalType.TIME) - private Calendar endTime; - - /** - * Id number - */ - @Id - @Column (name = "opening_times_id", nullable = false, updatable = false) - @GeneratedValue (strategy = GenerationType.IDENTITY) - private Long id; - - /** - * Starting day of opening times - */ - @Basic (optional = false) - @Column (name = "opening_times_start_day", nullable = false) - @Enumerated (EnumType.STRING) - private DayOfTheWeek startDay; - - /** - * Starting time (hh:mm) - */ - @Basic (optional = false) - @Column (name = "opening_times_start_time", nullable = false) - @Temporal (TemporalType.TIME) - private Calendar startTime; - - /** - * Default constructor - */ - public BusinessOpeningTimes () { - } - - /** - * Constructor with all field - *

- * @param endDay End day - * @param endTime End time - * @param id Id number - * @param startDay Start day - * @param startTime Start time - */ - public BusinessOpeningTimes (final DayOfTheWeek endDay, final Calendar endTime, final Long id, final DayOfTheWeek startDay, final Calendar startTime) { - // Call other constructor - this(endDay, endTime, startDay, startTime); - - // Set id number - this.id = id; - } - - /** - * Constructor with all fields except id number - *

- * @param endDay End day - * @param endTime End time - * @param startDay Start day - * @param startTime Start time - */ - public BusinessOpeningTimes (final DayOfTheWeek endDay, final Calendar endTime, final DayOfTheWeek startDay, final Calendar startTime) { - // Set all fields - this.endDay = endDay; - this.endTime = endTime; - this.startDay = startDay; - this.startTime = startTime; - } - - @Override - public boolean equals (final Object obj) { - if (this == obj) { - return true; - } else if (obj == null) { - return false; - } else if (this.getClass() != obj.getClass()) { - return false; - } - - final OpeningTimes openingTimes = (OpeningTimes) obj; - - if (!Objects.equals(this.getId(), openingTimes.getId())) { - return false; - } else if (this.getStartDay() != openingTimes.getStartDay()) { - return false; - } else if (this.getEndDay() != openingTimes.getEndDay()) { - return false; - } else if (!Objects.equals(this.getStartTime(), openingTimes.getStartTime())) { - return false; - } else if (!Objects.equals(this.getEndTime(), openingTimes.getEndTime())) { - return false; - } - - return true; - } - - @Override - public DayOfTheWeek getEndDay () { - return this.endDay; - } - - @Override - public void setEndDay (final DayOfTheWeek endDay) { - this.endDay = endDay; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getEndTime () { - return this.endTime; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setEndTime (final Calendar endTime) { - this.endTime = endTime; - } - - @Override - public Long getId () { - return this.id; - } - - @Override - public void setId (Long id) { - this.id = id; - } - - @Override - public DayOfTheWeek getStartDay () { - return this.startDay; - } - - @Override - public void setStartDay (final DayOfTheWeek startDay) { - this.startDay = startDay; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getStartTime () { - return this.startTime; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setStartTime (final Calendar startTime) { - this.startTime = startTime; - } - - @Override - public int hashCode () { - int hash = 7; - - hash = 97 * hash + Objects.hashCode(this.getId()); - hash = 97 * hash + Objects.hashCode(this.getStartDay()); - hash = 97 * hash + Objects.hashCode(this.getEndDay()); - hash = 97 * hash + Objects.hashCode(this.getStartTime()); - hash = 97 * hash + Objects.hashCode(this.getEndTime()); - - return hash; - } - -} diff --git a/src/org/mxchange/jcontactsbusiness/opening_times/OpeningTimes.java b/src/org/mxchange/jcontactsbusiness/opening_times/OpeningTimes.java deleted file mode 100644 index e5ae213..0000000 --- a/src/org/mxchange/jcontactsbusiness/opening_times/OpeningTimes.java +++ /dev/null @@ -1,106 +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.opening_times; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcontactsbusiness.opening_times.dayofweek.DayOfTheWeek; - -/** - * A POJI for opening times - * - * @author Roland Häder - */ -public interface OpeningTimes extends Serializable { - - /** - * Getter for id number - *

- * @return Id number - */ - Long getId (); - - /** - * Setter for id number - *

- * @param id Id number - */ - void setId (final Long id); - - /** - * Getter for starting day - *

- * @return Starting day - */ - DayOfTheWeek getStartDay (); - - /** - * Setter for starting day - *

- * @param startDay Starting day - */ - void setStartDay (final DayOfTheWeek startDay); - - /** - * Getter for ending day - *

- * @return Ending day - */ - DayOfTheWeek getEndDay (); - - /** - * Setter for ending day - *

- * @param endDay Ending day - */ - void setEndDay (final DayOfTheWeek endDay); - - /** - * Getter for starting time - *

- * @return Starting time - */ - Calendar getStartTime (); - - /** - * Setter for starting time - *

- * @param startTime Starting time - */ - void setStartTime (final Calendar startTime); - - /** - * Getter for ending time - *

- * @return Ending time - */ - Calendar getEndTime (); - - /** - * Setter for ending time - *

- * @param endTime Ending time - */ - void setEndTime (final Calendar endTime); - - @Override - boolean equals (final Object obj); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jcontactsbusiness/opening_times/dayofweek/DayOfTheWeek.java b/src/org/mxchange/jcontactsbusiness/opening_times/dayofweek/DayOfTheWeek.java deleted file mode 100644 index cfb9b15..0000000 --- a/src/org/mxchange/jcontactsbusiness/opening_times/dayofweek/DayOfTheWeek.java +++ /dev/null @@ -1,107 +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.opening_times.dayofweek; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -/** - * An enumeration suitable for persisting - *

- * @author Roland Häder - */ -public enum DayOfTheWeek { - SUNDAY { - @Override - public int toCalendar () { - return Calendar.SUNDAY; - } - - }, - MONDAY { - @Override - public int toCalendar () { - return Calendar.MONDAY; - } - }, - TUESDAY { - @Override - public int toCalendar () { - return Calendar.TUESDAY; - } - }, - WEDNESDAY { - @Override - public int toCalendar () { - return Calendar.WEDNESDAY; - } - }, - THURSDAY { - @Override - public int toCalendar () { - return Calendar.THURSDAY; - } - }, - FRIDAY { - @Override - public int toCalendar () { - return Calendar.FRIDAY; - } - }, - SATURDAY { - @Override - public int toCalendar () { - return Calendar.SATURDAY; - } - }; - - public abstract int toCalendar (); - - public static DayOfTheWeek fromCalendarDay (final int day) { - - for (DayOfTheWeek dayOfWeek : DayOfTheWeek.values()) { - if (dayOfWeek.toCalendar() == day) { - return dayOfWeek; - } - } - - return null; // Consider throwing IllegalArgumentException - } - - public static DayOfTheWeek getByDate (final Date date) { - Calendar calendar = GregorianCalendar.getInstance(); - calendar.setTime(date); - return fromCalendarDay(calendar.get(Calendar.DAY_OF_WEEK)); - } - - /* - * Should return the localized day of the week - */ - @Override - public String toString () { - Calendar c = new GregorianCalendar(); - c.set(Calendar.DAY_OF_WEEK, this.toCalendar()); - SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat - .getInstance(); - sdf.applyPattern("EEEEEEEEEE"); //NOI18N - - return sdf.format(c.getTime()); - } - -}