+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface BusinessBasicData extends Serializable {
-
- /**
- * Getter for branches list
- * <p>
- * @return Branches list
- */
- List<BranchOffice> getBrancheOffices ();
-
- /**
- * Setter for branches list
- * <p>
- * @param branches Branches list
- */
- void setBrancheOffices (final List<BranchOffice> branches);
-
- /**
- * Getter for company contact person
- * <p>
- * @return Company contact person
- */
- Employee getCompanyContactEmployee ();
-
- /**
- * Setter for company contact person
- * <p>
- * @param companyContact Company contact person
- */
- void setCompanyContactEmployee (final Employee companyContact);
-
- /**
- * Getter for business contact id
- * <p>
- * @return Business contact id
- */
- Long getBasicDataId ();
-
- /**
- * Setter for business contact id
- * <p>
- * @param businessContactId Business contact id
- */
- void setBasicDataId (final Long businessContactId);
-
- /**
- * Getter for company founder
- * <p>
- * @return Company founder
- */
- Employee getCompanyFounder ();
-
- /**
- * Setter for company founder
- * <p>
- * @param companyFounder Company founder
- */
- void setCompanyFounder (final Employee companyFounder);
-
- /**
- * Getter for headquarters data
- * <p>
- * @return Headquarters data
- */
- HeadquartersData getCompanyHeadQuartersData ();
-
- /**
- * Setter for headquarters data
- * <p>
- * @param headQuartersData Headquarters data
- */
- void setCompanyHeadQuartersData (final HeadquartersData headQuartersData);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getCompanyUserOwner ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param contactUserOwner User owner instance
- */
- void setCompanyUserOwner (final User contactUserOwner);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getCompanyCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param contactCreated Timestamp when this entry has been created
- */
- void setCompanyCreated (final Calendar contactCreated);
-
- /**
- * Getter for comments
- * <p>
- * @return Comments
- */
- String getCompanyComments ();
-
- /**
- * Setter for comments
- * <p>
- * @param companyComments Comments
- */
- void setCompanyComments (final String companyComments);
-
- /**
- * Getter for email address
- * <p>
- * @return Email address
- */
- String getCompanyEmailAddress ();
-
- /**
- * Setter for email address
- * <p>
- * @param companyEmailAddress Email address
- */
- void setCompanyEmailAddress (final String companyEmailAddress);
-
- /**
- * Getter for list of fax number
- * <p>
- * @return Fax numbers
- */
- DialableFaxNumber getCompanyFaxNumber ();
-
- /**
- * Setter for list of fax number
- * <p>
- * @param companyFaxNumber Fax numbers
- */
- void setCompanyFaxNumber (final DialableFaxNumber companyFaxNumber);
-
- /**
- * Getter for company logo
- * <p>
- * @return Company logo
- */
- BusinessLogo getCompanyLogo ();
-
- /**
- * Setter for company logo
- * <p>
- * @param companyLogo Company logo
- */
- void setCompanyLogo (final BusinessLogo companyLogo);
-
- /**
- * Getter for company name
- * <p>
- * @return Company name
- */
- String getCompanyName ();
-
- /**
- * Setter for company name
- * <p>
- * @param companyName Company name
- */
- void setCompanyName (final String companyName);
-
- /**
- * Getter for list of phone number
- * <p>
- * @return Phone numbers
- */
- DialableLandLineNumber getCompanyLandLineNumber ();
-
- /**
- * Setter for list of phone number
- * <p>
- * @param companyPhoneNumber Phone numbers
- */
- void setCompanyLandLineNumber (final DialableLandLineNumber companyPhoneNumber);
-
- /**
- * Getter for tax number
- * <p>
- * @return Tax number
- */
- String getCompanyTaxNumber ();
-
- /**
- * Setter for tax number
- * <p>
- * @param companyTaxNumber Tax number
- */
- void setCompanyTaxNumber (final String companyTaxNumber);
-
- /**
- * Getter for website URL
- * <p>
- * @return Website URL
- */
- String getCompanyWebsiteUrl ();
-
- /**
- * Setter for website URL
- * <p>
- * @param companyWebsiteUrl Website URL
- */
- void setCompanyWebsiteUrl (final String companyWebsiteUrl);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@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<BranchOffice> 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
- * <p>
- * @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<BranchOffice> getBrancheOffices () {
- return this.brancheOffices;
- }
-
- @Override
- @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
- public void setBrancheOffices (final List<BranchOffice> 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;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.branchoffice;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
-import org.mxchange.jcontactsbusiness.employee.Employee;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A POJI for branch offices
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface BranchOffice extends Serializable {
-
- /**
- * Getter for branch office's city name
- * <p>
- * @return Branch office's city name
- */
- String getBranchCity ();
-
- /**
- * Setter for branch office's city name
- * <p>
- * @param branchCity Branch office's city name
- */
- void setBranchCity (final String branchCity);
-
- /**
- * Getter for branch office's email address
- * <p>
- * @return Branch office's email address
- */
- String getBranchEmailAddress ();
-
- /**
- * Setter for branch office's email address
- * <p>
- * @param branchEmailAddress Branch office's email address
- */
- void setBranchEmailAddress (final String branchEmailAddress);
-
- /**
- * Getter for branch office's fax number
- * <p>
- * @return Branch office's fax number
- */
- DialableFaxNumber getBranchFaxNumber ();
-
- /**
- * Setter for branch office's fax number
- * <p>
- * @param branchFaxNumber Branch office's fax number
- */
- void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber);
-
- /**
- * Getter for branch office's house number
- * <p>
- * @return Branch office's house number
- */
- Short getBranchHouseNumber ();
-
- /**
- * Setter for branch office's house number
- * <p>
- * @param branchHouseNumber Branch office's house number
- */
- void setBranchHouseNumber (final Short branchHouseNumber);
-
- /**
- * Getter for branch office's phone number
- * <p>
- * @return Branch office's phone number
- */
- DialableLandLineNumber getBranchLandLineNumber ();
-
- /**
- * Setter for branch office's phone number
- * <p>
- * @param branchPhoneNumber Branch office's phone number
- */
- void setBranchLandLineNumber (final DialableLandLineNumber branchPhoneNumber);
-
- /**
- * Getter for branch office's store
- * <p>
- * @return Branch office's store
- */
- Short getBranchStore ();
-
- /**
- * Setter for branch office's store
- * <p>
- * @param branchStore Branch office's store
- */
- void setBranchStore (final Short branchStore);
-
- /**
- * Getter for branch office's street name
- * <p>
- * @return Branch office's street name
- */
- String getBranchStreet ();
-
- /**
- * Setter for branch office's street name
- * <p>
- * @param branchStreet Branch office's street name
- */
- void setBranchStreet (final String branchStreet);
-
- /**
- * Getter for branch office's suite number
- * <p>
- * @return Branch office's suite number
- */
- Short getBranchSuiteNumber ();
-
- /**
- * Setter for branch office's suite number
- * <p>
- * @param branchSuiteNumber Branch office's suite number
- */
- void setBranchSuiteNumber (final Short branchSuiteNumber);
-
- /**
- * Getter for branch office's ZIP code
- * <p>
- * @return Branch office's ZIP code
- */
- Integer getBranchZipCode ();
-
- /**
- * Setter for branch office's ZIP code
- * <p>
- * @param branchZipCode Branch office's ZIP code
- */
- void setBranchZipCode (final Integer branchZipCode);
-
- /**
- * Getter for branch office's id number
- * <p>
- * @return Branch office's id number
- */
- Long getBranchId ();
-
- /**
- * Setter for branch office's id number
- * <p>
- * @param branchId Branch office's id number
- */
- void setBranchId (final Long branchId);
-
- /**
- * Getter for branch office's country
- * <p>
- * @return Branch office's country
- */
- Country getBranchCountry ();
-
- /**
- * Setter for branch office's country
- * <p>
- * @param branchCountryCode Branch office's country
- */
- void setBranchCountry (final Country branchCountryCode);
-
- /**
- * Getter for branch office's company
- * <p>
- * @return Branch office's company
- */
- BusinessBasicData getBranchCompany ();
-
- /**
- * Setter for branch office's company
- * <p>
- * @param branchCompany Branch office's company
- */
- void setBranchCompany (final BusinessBasicData branchCompany);
-
- /**
- * Getter branch office's contact person
- * <p>
- * @return Branch office's contact person
- */
- Employee getBranchContactEmployee ();
-
- /**
- * Setter branch office's contact person
- * <p>
- * @param branchEmployee Branch office's contact person
- */
- void setBranchContactEmployee (final Employee branchEmployee);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getBranchUserOwner ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param branchUserOwner User owner instance
- */
- void setBranchUserOwner (final User branchUserOwner);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getBranchCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param branchCreated Timestamp when this entry has been created
- */
- void setBranchCreated (final Calendar branchCreated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
+++ /dev/null
-/*
- * Copyright (C) 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.branchoffice;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-/**
- * An utilities class for branch offices
- *
- * @author Roland Häder<roland@mxchange.org>
- */
-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.
- * <p>
- * @param branchOffice1 Branch office 1
- * @param branchOffice2 Branch office 2
- * <p>
- * @return Whether both branch office addresses are the same
- * <p>
- * @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
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.branchoffice;
-
-import java.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "company_branch_offices")
-@Table (name = "company_branch_offices")
-@NamedQueries ({
- @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC")
-})
-@SuppressWarnings ("PersistenceUnitPresent")
-public class CompanyBranchOffice implements BranchOffice {
-
- /**
- * Serial number
- */
- @Transient
- private static final long serialVersionUID = 47_957_817_276_871_852L;
-
- /**
- * Branch office's city name
- */
- @Basic (optional = false)
- @Column (name = "branch_city", length = 100, nullable = false)
- private String branchCity;
-
- /**
- * Company that has this branch office
- */
- @JoinColumn (name = "branch_company_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = CompanyBasicData.class, optional = false, cascade = CascadeType.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.
- * <p>
- * @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;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@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;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface Department extends Serializable {
-
- /**
- * Getter for connection to company contact
- * <p>
- * @return Connection to company contact
- */
- BusinessBasicData getDepartmentCompany ();
-
- /**
- * Setter for connection to company contact
- * <p>
- * @param departmentCompany Connection to company contact
- */
- void setDepartmentCompany (final BusinessBasicData departmentCompany);
-
- /**
- * Getter for connection to company headquarters
- * <p>
- * @return Connection to company headquarters
- */
- HeadquartersData getDepartentHeadquarters ();
-
- /**
- * Setter for connection to company headquarters
- * <p>
- * @param departentHeadquarters Connection to company headquarters
- */
- void setDepartentHeadquarters (final HeadquartersData departentHeadquarters);
-
- /**
- * Getter for connection to company branch office
- * <p>
- * @return Connection to company branch office
- */
- BranchOffice getDepartmentBranchOffice ();
-
- /**
- * Setter for connection to company branch office
- * <p>
- * @param departmentBranchOffice Connection to company branch office
- */
- void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice);
-
- /**
- * Getter for department id
- * <p>
- * @return Department id
- */
- Long getDepartmentId ();
-
- /**
- * Setter for department id
- * <p>
- * @param departmentId Department id
- */
- void setDepartmentId (final Long departmentId);
-
- /**
- * Getter for department lead employee
- * <p>
- * @return Department lead employee
- */
- Employee getDepartmentLead ();
-
- /**
- * Setter for department lead employee
- * <p>
- * @param departmentLead Department lead employee
- */
- void setDepartmentLead (final Employee departmentLead);
-
- /**
- * Getter for department name
- * <p>
- * @return Department name
- */
- String getDepartmentName ();
-
- /**
- * Setter for department name
- * <p>
- * @param departmentName Department name
- */
- void setDepartmentName (final String departmentName);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getDepartmentUserOwner ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param departmentUserOwner User owner instance
- */
- void setDepartmentUserOwner (final User departmentUserOwner);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getDepartmentCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param departmentCreated Timestamp when this entry has been created
- */
- void setDepartmentCreated (final Calendar departmentCreated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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)
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@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;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface Employee extends Serializable {
-
- /**
- * Getter for employee's branch office
- * <p>
- * @return Employee's branch office
- */
- BranchOffice getEmployeeBranchOffice ();
-
- /**
- * Setter for employee's branch office
- * <p>
- * @param employeeBranchOffice Employee's branch office
- */
- void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice);
-
- /**
- * Getter for employee's company
- * <p>
- * @return Company instance
- */
- BusinessBasicData getEmployeeCompany ();
-
- /**
- * Setter for employee's company
- * <p>
- * @param employeeCompany Company instance
- */
- void setEmployeeCompany (final BusinessBasicData employeeCompany);
-
- /**
- * Getter for employee's department
- * <p>
- * @return Employee's department
- */
- Department getEmployeeDepartment ();
-
- /**
- * Setter for employee's department
- * <p>
- * @param employeeDepartment Employee's department
- */
- void setEmployeeDepartment (final Department employeeDepartment);
-
- /**
- * Getter for employee's head quarters
- * <p>
- * @return Employee's head quarters
- */
- HeadquartersData getEmployeeHeadquarter ();
-
- /**
- * Getter for employee's head quarters
- * <p>
- * @param employeeHeadquarter Employee's head quarters
- */
- void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter);
-
- /**
- * Getter for employee's email address
- * <p>
- * @return Employee's email address
- */
- String getEmployeeEmailAddress ();
-
- /**
- * Setter for employee's email address
- * <p>
- * @param employeeEmailAddress Employee's email address
- */
- void setEmployeeEmailAddress (final String employeeEmailAddress);
-
- /**
- * Getter for employee's id number
- * <p>
- * @return Employee's id number
- */
- Long getEmployeeId ();
-
- /**
- * Setter for employee's id number
- * <p>
- * @param employeeId Employee's id number
- */
- void setEmployeeId (final Long employeeId);
-
- /**
- * Getter for employee's mobile number
- * <p>
- * @return Employee's mobile number
- */
- DialableMobileNumber getEmployeeMobileNumber ();
-
- /**
- * Setter for employee's mobile number
- * <p>
- * @param employeeMobileNumber Employee's mobile number
- */
- void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber);
-
- /**
- * Getter for employee's number
- * <p>
- * @return Employee's number
- */
- String getEmployeeNumber ();
-
- /**
- * Setter for employee's number
- * <p>
- * @param employeeNumber Employee's number
- */
- void setEmployeeNumber (final String employeeNumber);
-
- /**
- * Getter for employee's personal data
- * <p>
- * @return Employee's personal data
- */
- Contact getEmployeePersonalData ();
-
- /**
- * Setter for employee's personal data
- * <p>
- * @param employeePersonalData Employee's personal data
- */
- void setEmployeePersonalData (final Contact employeePersonalData);
-
- /**
- * Getter for employee's phone number/extension
- * <p>
- * @return Employee's phone number/extension
- */
- Integer getEmployeePhoneExtension ();
-
- /**
- * Setter for employee's phone number/extension
- * <p>
- * @param employeePhoneExtension Employee's phone number/extension
- */
- void setEmployeePhoneExtension (final Integer employeePhoneExtension);
-
- /**
- * Getter for employee's position
- * <p>
- * @return Employee's position
- */
- JobPosition getEmployeePosition ();
-
- /**
- * Setter for employee's position
- * <p>
- * @param employeePosition Employee's position
- */
- void setEmployeePosition (final JobPosition employeePosition);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getEmployeeUserOwner ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param employeeUserOwner User owner instance
- */
- void setEmployeeUserOwner (final User employeeUserOwner);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getEmployeeCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param employeeCreated Timestamp when this entry has been created
- */
- void setEmployeeCreated (final Calendar employeeCreated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
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.
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
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
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.
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
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
+++ /dev/null
-/*
- * Copyright (C) 2016 KLC
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.headquarters;
-
-import java.util.Calendar;
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jcountry.data.CountryData;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jusercore.model.user.LoginUser;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A POJO for company headquarts data
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "company_headquarters")
-@Table (name = "company_headquarters")
-@SuppressWarnings ("PersistenceUnitPresent")
-public class CompanyHeadquartersData implements HeadquartersData {
-
- /**
- * Serial number
- */
- @Transient
- private static final long serialVersionUID = 385_752_948_781_761L;
-
- /**
- * Headquarters' city name
- */
- @Basic (optional = false)
- @Column (name = "headquarters_city", length = 100, nullable = false)
- private String headquartersCity;
-
- /**
- * Headquarter's country code
- */
- @JoinColumn (name = "headquarters_country_id", nullable = false)
- @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
- private Country headquartersCountry;
-
- /**
- * Timestamp when this entry has been created
- */
- @Basic (optional = false)
- @Temporal (TemporalType.TIMESTAMP)
- @Column (name = "headquarters_entry_created", nullable = false, updatable = false)
- private Calendar headquartersCreated;
-
- /**
- * Headquarters' fax number
- */
- @JoinColumn (name = "headquarters_fax_number_id")
- @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
- private DialableFaxNumber headquartersFaxNumber;
-
- /**
- * Headquarters' house number
- */
- @Basic (optional = false)
- @Column (name = "headquarters_house_number", length = 4, nullable = false)
- private Short headquartersHouseNumber;
-
- /**
- * Id number
- */
- @Id
- @GeneratedValue (strategy = GenerationType.IDENTITY)
- @Column (name = "headquarters_id", nullable = false, updatable = false)
- private Long headquartersId;
-
- /**
- * Headquarters' phone number
- */
- @JoinColumn (name = "headquarters_phone_number_id")
- @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
- private DialableLandLineNumber headquartersPhoneNumber;
-
- /**
- * Headquarters' store number (multi-store building only)
- */
- @Column (name = "headquarters_store", length = 3)
- private Short headquartersStore;
-
- /**
- * Headquarters' street name
- */
- @Basic (optional = false)
- @Column (name = "headquarters_street", length = 100, nullable = false)
- private String headquartersStreet;
-
- /**
- * Headquarters' suite number
- */
- @Column (name = "headquarters_suite_number", length = 4)
- private Short headquartersSuiteNumber;
-
- /**
- * User owner instance
- */
- @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
- private User headquartersUserOwner;
-
- /**
- * Headquarters' ZIP code
- */
- @Basic (optional = false)
- @Column (name = "headquarters_zip_code", length = 6, nullable = false)
- private Integer headquartersZipCode;
-
- @Override
- public boolean equals (final Object object) {
- if (null == object) {
- return false;
- } else if (this.getClass() != object.getClass()) {
- return false;
- }
-
- final HeadquartersData other = (HeadquartersData) object;
-
- if (!Objects.equals(this.getHeadquartersId(), other.getHeadquartersId())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersCity(), other.getHeadquartersCity())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersCountry(), other.getHeadquartersCountry())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersHouseNumber(), other.getHeadquartersHouseNumber())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersStore(), other.getHeadquartersStore())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersStreet(), other.getHeadquartersStreet())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersSuiteNumber(), other.getHeadquartersSuiteNumber())) {
- return false;
- } else if (!Objects.equals(this.getHeadquartersZipCode(), other.getHeadquartersZipCode())) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public String getHeadquartersCity () {
- return this.headquartersCity;
- }
-
- @Override
- public void setHeadquartersCity (final String headquartersCity) {
- this.headquartersCity = headquartersCity;
- }
-
- @Override
- public Country getHeadquartersCountry () {
- return this.headquartersCountry;
- }
-
- @Override
- public void setHeadquartersCountry (final Country headquartersCountry) {
- this.headquartersCountry = headquartersCountry;
- }
-
- @Override
- @SuppressWarnings ("ReturnOfDateField")
- public Calendar getHeadquartersCreated () {
- return this.headquartersCreated;
- }
-
- @Override
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setHeadquartersCreated (final Calendar headquartersCreated) {
- this.headquartersCreated = headquartersCreated;
- }
-
- @Override
- public DialableFaxNumber getHeadquartersFaxNumber () {
- return this.headquartersFaxNumber;
- }
-
- @Override
- public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) {
- this.headquartersFaxNumber = headquartersFaxNumber;
- }
-
- @Override
- public Short getHeadquartersHouseNumber () {
- return this.headquartersHouseNumber;
- }
-
- @Override
- public void setHeadquartersHouseNumber (final Short headquartersHouseNumber) {
- this.headquartersHouseNumber = headquartersHouseNumber;
- }
-
- @Override
- public Long getHeadquartersId () {
- return this.headquartersId;
- }
-
- @Override
- public void setHeadquartersId (final Long headquartersId) {
- this.headquartersId = headquartersId;
- }
-
- @Override
- public DialableLandLineNumber getHeadquartersPhoneNumber () {
- return this.headquartersPhoneNumber;
- }
-
- @Override
- public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) {
- this.headquartersPhoneNumber = headquartersPhoneNumber;
- }
-
- @Override
- public Short getHeadquartersStore () {
- return this.headquartersStore;
- }
-
- @Override
- public void setHeadquartersStore (final Short headquartersStore) {
- this.headquartersStore = headquartersStore;
- }
-
- @Override
- public String getHeadquartersStreet () {
- return this.headquartersStreet;
- }
-
- @Override
- public void setHeadquartersStreet (final String headquartersStreet) {
- this.headquartersStreet = headquartersStreet;
- }
-
- @Override
- public Short getHeadquartersSuiteNumber () {
- return this.headquartersSuiteNumber;
- }
-
- @Override
- public void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber) {
- this.headquartersSuiteNumber = headquartersSuiteNumber;
- }
-
- @Override
- public User getHeadquartersUserOwner () {
- return this.headquartersUserOwner;
- }
-
- @Override
- public void setHeadquartersUserOwner (final User headquartersUserOwner) {
- this.headquartersUserOwner = headquartersUserOwner;
- }
-
- @Override
- public Integer getHeadquartersZipCode () {
- return this.headquartersZipCode;
- }
-
- @Override
- public void setHeadquartersZipCode (final Integer headquartersZipCode) {
- this.headquartersZipCode = headquartersZipCode;
- }
-
- @Override
- public int hashCode () {
- int hash = 7;
-
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersId());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersCity());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersCountry());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersHouseNumber());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersStore());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersStreet());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersSuiteNumber());
- hash = 47 * hash + Objects.hashCode(this.getHeadquartersZipCode());
-
- return hash;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.headquarters;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A POJI for headquarters data
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface HeadquartersData extends Serializable {
-
- /**
- * Getter for headquarters' city name
- * <p>
- * @return Headquarters' city name
- */
- String getHeadquartersCity ();
-
- /**
- * Setter for headquarters' city name
- * <p>
- * @param headquartersCity Headquarters' city name
- */
- void setHeadquartersCity (final String headquartersCity);
-
- /**
- * Getter for headquarters' country code
- * <p>
- * @return Headquarters' country code
- */
- Country getHeadquartersCountry ();
-
- /**
- * Setter for headquarters' country code
- * <p>
- * @param headquartersCountryCode Headquarters' country code
- */
- void setHeadquartersCountry (final Country headquartersCountryCode);
-
- /**
- * Getter for headquarters' house number
- * <p>
- * @return Headquarters' house number
- */
- Short getHeadquartersHouseNumber ();
-
- /**
- * Setter for headquarters' house number
- * <p>
- * @param headquartersHouseNumber Headquarters' house number
- */
- void setHeadquartersHouseNumber (final Short headquartersHouseNumber);
-
- /**
- * Getter for headquarters' id number
- * <p>
- * @return Headquarters' id number
- */
- Long getHeadquartersId ();
-
- /**
- * Setter for headquarters' id number
- * <p>
- * @param headquartersId Headquarters' id number
- */
- void setHeadquartersId (final Long headquartersId);
-
- /**
- * Getter for headquarters' store number
- * <p>
- * @return Headquarters' store number
- */
- Short getHeadquartersStore ();
-
- /**
- * Setter for headquarters' store number
- * <p>
- * @param headquartersStore Headquarters' store number
- */
- void setHeadquartersStore (final Short headquartersStore);
-
- /**
- * Getter for headquarters' street name
- * <p>
- * @return Headquarters' street name
- */
- String getHeadquartersStreet ();
-
- /**
- * Setter for headquarters' street name
- * <p>
- * @param headquartersStreet Headquarters' street name
- */
- void setHeadquartersStreet (final String headquartersStreet);
-
- /**
- * Getter for headquarters' suite number
- * <p>
- * @return Headquarters' suite number
- */
- Short getHeadquartersSuiteNumber ();
-
- /**
- * Setter for headquarters' suite number
- * <p>
- * @param headquartersSuiteNumber Headquarters' suite number
- */
- void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber);
-
- /**
- * Getter for headquarters' ZIP code
- * <p>
- * @return Headquarters' ZIP code
- */
- Integer getHeadquartersZipCode ();
-
- /**
- * Setter for headquarters' ZIP code
- * <p>
- * @param headquartersZipCode Headquarters' ZIP code
- */
- void setHeadquartersZipCode (final Integer headquartersZipCode);
-
- /**
- * Getter for headquarters' phone number
- * <p>
- * @return Headquarters' phone number
- */
- DialableLandLineNumber getHeadquartersPhoneNumber ();
-
- /**
- * Setter for headquarters' phone number
- * <p>
- * @param headquartersPhoneNumber Headquarters' phone number
- */
- void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber);
-
- /**
- * Getter for headquarters' fax number
- * <p>
- * @return Headquarters' fax number
- */
- DialableFaxNumber getHeadquartersFaxNumber ();
-
- /**
- * Setter for headquarters' fax number
- * <p>
- * @param headquartersFaxNumber Headquarters' fax number
- */
- void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getHeadquartersUserOwner ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param headquartersUserOwner User owner instance
- */
- void setHeadquartersUserOwner (final User headquartersUserOwner);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getHeadquartersCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param headquartersCreated Timestamp when this entry has been created
- */
- void setHeadquartersCreated (final Calendar headquartersCreated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@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;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.jobposition;
-
-import java.io.Serializable;
-import java.util.Calendar;
-
-/**
- * A POJI for job positions
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface JobPosition extends Serializable {
-
- /**
- * Getter for id number
- * <p>
- * @return Id number
- */
- Long getJobPositionId ();
-
- /**
- * Setter for id number
- * <p>
- * @param jobPositionId Id number
- */
- void setJobPositionId (final Long jobPositionId);
-
- /**
- * Getter for job position name
- * <p>
- * @return Job position name
- */
- String getJobPositionName ();
-
- /**
- * Setter for job position name
- * <p>
- * @param jobPositionName Job position name
- */
- void setJobPositionName (final String jobPositionName);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getJobPositionCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param jobPositionCreated Timestamp when this entry has been created
- */
- void setJobPositionCreated (final Calendar jobPositionCreated);
-
- /**
- * Getter for timestamp when this entry has been updated
- * <p>
- * @return Timestamp when this entry has been updated
- */
- Calendar getJobPositionUpdated ();
-
- /**
- * Setter for timestamp when this entry has been updated
- * <p>
- * @param jobPositionUpdated Timestamp when this entry has been updated
- */
- void setJobPositionUpdated (final Calendar jobPositionUpdated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.logo;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A POJI for business logos
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface BusinessLogo extends Serializable {
-
- /**
- * Getter for logo's local file name
- * <p>
- * @return Logo's local file name
- */
- String getLogoFileName ();
-
- /**
- * Setter for logo's local file name
- * <p>
- * @param logoFileName Logo's local file name
- */
- void setLogoFileName (final String logoFileName);
-
- /**
- * Getter for logo's id number
- * <p>
- * @return Logo's id number
- */
- Long getLogoId ();
-
- /**
- * Setter for logo's id number
- * <p>
- * @param logoId Logo's id number
- */
- void setLogoId (final Long logoId);
-
- /**
- * Getter for user owner instance
- * <p>
- * @return User owner instance
- */
- User getLogoUploader ();
-
- /**
- * Setter for user owner instance
- * <p>
- * @param logoUploader User owner instance
- */
- void setLogoUploader (final User logoUploader);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Calendar getLogoCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param logoCreated Timestamp when this entry has been created
- */
- void setLogoCreated (final Calendar logoCreated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@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;
- }
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface BusinessBasicData extends Serializable {
+
+ /**
+ * Getter for branches list
+ * <p>
+ * @return Branches list
+ */
+ List<BranchOffice> getBrancheOffices ();
+
+ /**
+ * Setter for branches list
+ * <p>
+ * @param branches Branches list
+ */
+ void setBrancheOffices (final List<BranchOffice> branches);
+
+ /**
+ * Getter for company contact person
+ * <p>
+ * @return Company contact person
+ */
+ Employee getCompanyContactEmployee ();
+
+ /**
+ * Setter for company contact person
+ * <p>
+ * @param companyContact Company contact person
+ */
+ void setCompanyContactEmployee (final Employee companyContact);
+
+ /**
+ * Getter for business contact id
+ * <p>
+ * @return Business contact id
+ */
+ Long getBasicDataId ();
+
+ /**
+ * Setter for business contact id
+ * <p>
+ * @param businessContactId Business contact id
+ */
+ void setBasicDataId (final Long businessContactId);
+
+ /**
+ * Getter for company founder
+ * <p>
+ * @return Company founder
+ */
+ Employee getCompanyFounder ();
+
+ /**
+ * Setter for company founder
+ * <p>
+ * @param companyFounder Company founder
+ */
+ void setCompanyFounder (final Employee companyFounder);
+
+ /**
+ * Getter for headquarters data
+ * <p>
+ * @return Headquarters data
+ */
+ HeadquartersData getCompanyHeadQuartersData ();
+
+ /**
+ * Setter for headquarters data
+ * <p>
+ * @param headQuartersData Headquarters data
+ */
+ void setCompanyHeadQuartersData (final HeadquartersData headQuartersData);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getCompanyUserOwner ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param contactUserOwner User owner instance
+ */
+ void setCompanyUserOwner (final User contactUserOwner);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getCompanyCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param contactCreated Timestamp when this entry has been created
+ */
+ void setCompanyCreated (final Calendar contactCreated);
+
+ /**
+ * Getter for comments
+ * <p>
+ * @return Comments
+ */
+ String getCompanyComments ();
+
+ /**
+ * Setter for comments
+ * <p>
+ * @param companyComments Comments
+ */
+ void setCompanyComments (final String companyComments);
+
+ /**
+ * Getter for email address
+ * <p>
+ * @return Email address
+ */
+ String getCompanyEmailAddress ();
+
+ /**
+ * Setter for email address
+ * <p>
+ * @param companyEmailAddress Email address
+ */
+ void setCompanyEmailAddress (final String companyEmailAddress);
+
+ /**
+ * Getter for list of fax number
+ * <p>
+ * @return Fax numbers
+ */
+ DialableFaxNumber getCompanyFaxNumber ();
+
+ /**
+ * Setter for list of fax number
+ * <p>
+ * @param companyFaxNumber Fax numbers
+ */
+ void setCompanyFaxNumber (final DialableFaxNumber companyFaxNumber);
+
+ /**
+ * Getter for company logo
+ * <p>
+ * @return Company logo
+ */
+ BusinessLogo getCompanyLogo ();
+
+ /**
+ * Setter for company logo
+ * <p>
+ * @param companyLogo Company logo
+ */
+ void setCompanyLogo (final BusinessLogo companyLogo);
+
+ /**
+ * Getter for company name
+ * <p>
+ * @return Company name
+ */
+ String getCompanyName ();
+
+ /**
+ * Setter for company name
+ * <p>
+ * @param companyName Company name
+ */
+ void setCompanyName (final String companyName);
+
+ /**
+ * Getter for list of phone number
+ * <p>
+ * @return Phone numbers
+ */
+ DialableLandLineNumber getCompanyLandLineNumber ();
+
+ /**
+ * Setter for list of phone number
+ * <p>
+ * @param companyPhoneNumber Phone numbers
+ */
+ void setCompanyLandLineNumber (final DialableLandLineNumber companyPhoneNumber);
+
+ /**
+ * Getter for tax number
+ * <p>
+ * @return Tax number
+ */
+ String getCompanyTaxNumber ();
+
+ /**
+ * Setter for tax number
+ * <p>
+ * @param companyTaxNumber Tax number
+ */
+ void setCompanyTaxNumber (final String companyTaxNumber);
+
+ /**
+ * Getter for website URL
+ * <p>
+ * @return Website URL
+ */
+ String getCompanyWebsiteUrl ();
+
+ /**
+ * Setter for website URL
+ * <p>
+ * @param companyWebsiteUrl Website URL
+ */
+ void setCompanyWebsiteUrl (final String companyWebsiteUrl);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@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<BranchOffice> 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
+ * <p>
+ * @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<BranchOffice> getBrancheOffices () {
+ return this.brancheOffices;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+ public void setBrancheOffices (final List<BranchOffice> 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;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface BranchOffice extends Serializable {
+
+ /**
+ * Getter for branch office's city name
+ * <p>
+ * @return Branch office's city name
+ */
+ String getBranchCity ();
+
+ /**
+ * Setter for branch office's city name
+ * <p>
+ * @param branchCity Branch office's city name
+ */
+ void setBranchCity (final String branchCity);
+
+ /**
+ * Getter for branch office's email address
+ * <p>
+ * @return Branch office's email address
+ */
+ String getBranchEmailAddress ();
+
+ /**
+ * Setter for branch office's email address
+ * <p>
+ * @param branchEmailAddress Branch office's email address
+ */
+ void setBranchEmailAddress (final String branchEmailAddress);
+
+ /**
+ * Getter for branch office's fax number
+ * <p>
+ * @return Branch office's fax number
+ */
+ DialableFaxNumber getBranchFaxNumber ();
+
+ /**
+ * Setter for branch office's fax number
+ * <p>
+ * @param branchFaxNumber Branch office's fax number
+ */
+ void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber);
+
+ /**
+ * Getter for branch office's house number
+ * <p>
+ * @return Branch office's house number
+ */
+ Short getBranchHouseNumber ();
+
+ /**
+ * Setter for branch office's house number
+ * <p>
+ * @param branchHouseNumber Branch office's house number
+ */
+ void setBranchHouseNumber (final Short branchHouseNumber);
+
+ /**
+ * Getter for branch office's phone number
+ * <p>
+ * @return Branch office's phone number
+ */
+ DialableLandLineNumber getBranchLandLineNumber ();
+
+ /**
+ * Setter for branch office's phone number
+ * <p>
+ * @param branchPhoneNumber Branch office's phone number
+ */
+ void setBranchLandLineNumber (final DialableLandLineNumber branchPhoneNumber);
+
+ /**
+ * Getter for branch office's store
+ * <p>
+ * @return Branch office's store
+ */
+ Short getBranchStore ();
+
+ /**
+ * Setter for branch office's store
+ * <p>
+ * @param branchStore Branch office's store
+ */
+ void setBranchStore (final Short branchStore);
+
+ /**
+ * Getter for branch office's street name
+ * <p>
+ * @return Branch office's street name
+ */
+ String getBranchStreet ();
+
+ /**
+ * Setter for branch office's street name
+ * <p>
+ * @param branchStreet Branch office's street name
+ */
+ void setBranchStreet (final String branchStreet);
+
+ /**
+ * Getter for branch office's suite number
+ * <p>
+ * @return Branch office's suite number
+ */
+ Short getBranchSuiteNumber ();
+
+ /**
+ * Setter for branch office's suite number
+ * <p>
+ * @param branchSuiteNumber Branch office's suite number
+ */
+ void setBranchSuiteNumber (final Short branchSuiteNumber);
+
+ /**
+ * Getter for branch office's ZIP code
+ * <p>
+ * @return Branch office's ZIP code
+ */
+ Integer getBranchZipCode ();
+
+ /**
+ * Setter for branch office's ZIP code
+ * <p>
+ * @param branchZipCode Branch office's ZIP code
+ */
+ void setBranchZipCode (final Integer branchZipCode);
+
+ /**
+ * Getter for branch office's id number
+ * <p>
+ * @return Branch office's id number
+ */
+ Long getBranchId ();
+
+ /**
+ * Setter for branch office's id number
+ * <p>
+ * @param branchId Branch office's id number
+ */
+ void setBranchId (final Long branchId);
+
+ /**
+ * Getter for branch office's country
+ * <p>
+ * @return Branch office's country
+ */
+ Country getBranchCountry ();
+
+ /**
+ * Setter for branch office's country
+ * <p>
+ * @param branchCountryCode Branch office's country
+ */
+ void setBranchCountry (final Country branchCountryCode);
+
+ /**
+ * Getter for branch office's company
+ * <p>
+ * @return Branch office's company
+ */
+ BusinessBasicData getBranchCompany ();
+
+ /**
+ * Setter for branch office's company
+ * <p>
+ * @param branchCompany Branch office's company
+ */
+ void setBranchCompany (final BusinessBasicData branchCompany);
+
+ /**
+ * Getter branch office's contact person
+ * <p>
+ * @return Branch office's contact person
+ */
+ Employee getBranchContactEmployee ();
+
+ /**
+ * Setter branch office's contact person
+ * <p>
+ * @param branchEmployee Branch office's contact person
+ */
+ void setBranchContactEmployee (final Employee branchEmployee);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getBranchUserOwner ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param branchUserOwner User owner instance
+ */
+ void setBranchUserOwner (final User branchUserOwner);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getBranchCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param branchCreated Timestamp when this entry has been created
+ */
+ void setBranchCreated (final Calendar branchCreated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.model.branchoffice;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * An utilities class for branch offices
+ *
+ * @author Roland Häder<roland@mxchange.org>
+ */
+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.
+ * <p>
+ * @param branchOffice1 Branch office 1
+ * @param branchOffice2 Branch office 2
+ * <p>
+ * @return Whether both branch office addresses are the same
+ * <p>
+ * @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
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Entity (name = "company_branch_offices")
+@Table (name = "company_branch_offices")
+@NamedQueries ({
+ @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC")
+})
+@SuppressWarnings ("PersistenceUnitPresent")
+public class CompanyBranchOffice implements BranchOffice {
+
+ /**
+ * Serial number
+ */
+ @Transient
+ private static final long serialVersionUID = 47_957_817_276_871_852L;
+
+ /**
+ * Branch office's city name
+ */
+ @Basic (optional = false)
+ @Column (name = "branch_city", length = 100, nullable = false)
+ private String branchCity;
+
+ /**
+ * Company that has this branch office
+ */
+ @JoinColumn (name = "branch_company_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = CompanyBasicData.class, optional = false, cascade = CascadeType.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.
+ * <p>
+ * @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;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@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;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface Department extends Serializable {
+
+ /**
+ * Getter for connection to company contact
+ * <p>
+ * @return Connection to company contact
+ */
+ BusinessBasicData getDepartmentCompany ();
+
+ /**
+ * Setter for connection to company contact
+ * <p>
+ * @param departmentCompany Connection to company contact
+ */
+ void setDepartmentCompany (final BusinessBasicData departmentCompany);
+
+ /**
+ * Getter for connection to company headquarters
+ * <p>
+ * @return Connection to company headquarters
+ */
+ HeadquartersData getDepartentHeadquarters ();
+
+ /**
+ * Setter for connection to company headquarters
+ * <p>
+ * @param departentHeadquarters Connection to company headquarters
+ */
+ void setDepartentHeadquarters (final HeadquartersData departentHeadquarters);
+
+ /**
+ * Getter for connection to company branch office
+ * <p>
+ * @return Connection to company branch office
+ */
+ BranchOffice getDepartmentBranchOffice ();
+
+ /**
+ * Setter for connection to company branch office
+ * <p>
+ * @param departmentBranchOffice Connection to company branch office
+ */
+ void setDepartmentBranchOffice (final BranchOffice departmentBranchOffice);
+
+ /**
+ * Getter for department id
+ * <p>
+ * @return Department id
+ */
+ Long getDepartmentId ();
+
+ /**
+ * Setter for department id
+ * <p>
+ * @param departmentId Department id
+ */
+ void setDepartmentId (final Long departmentId);
+
+ /**
+ * Getter for department lead employee
+ * <p>
+ * @return Department lead employee
+ */
+ Employee getDepartmentLead ();
+
+ /**
+ * Setter for department lead employee
+ * <p>
+ * @param departmentLead Department lead employee
+ */
+ void setDepartmentLead (final Employee departmentLead);
+
+ /**
+ * Getter for department name
+ * <p>
+ * @return Department name
+ */
+ String getDepartmentName ();
+
+ /**
+ * Setter for department name
+ * <p>
+ * @param departmentName Department name
+ */
+ void setDepartmentName (final String departmentName);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getDepartmentUserOwner ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param departmentUserOwner User owner instance
+ */
+ void setDepartmentUserOwner (final User departmentUserOwner);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getDepartmentCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param departmentCreated Timestamp when this entry has been created
+ */
+ void setDepartmentCreated (final Calendar departmentCreated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@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;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface Employee extends Serializable {
+
+ /**
+ * Getter for employee's branch office
+ * <p>
+ * @return Employee's branch office
+ */
+ BranchOffice getEmployeeBranchOffice ();
+
+ /**
+ * Setter for employee's branch office
+ * <p>
+ * @param employeeBranchOffice Employee's branch office
+ */
+ void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice);
+
+ /**
+ * Getter for employee's company
+ * <p>
+ * @return Company instance
+ */
+ BusinessBasicData getEmployeeCompany ();
+
+ /**
+ * Setter for employee's company
+ * <p>
+ * @param employeeCompany Company instance
+ */
+ void setEmployeeCompany (final BusinessBasicData employeeCompany);
+
+ /**
+ * Getter for employee's department
+ * <p>
+ * @return Employee's department
+ */
+ Department getEmployeeDepartment ();
+
+ /**
+ * Setter for employee's department
+ * <p>
+ * @param employeeDepartment Employee's department
+ */
+ void setEmployeeDepartment (final Department employeeDepartment);
+
+ /**
+ * Getter for employee's head quarters
+ * <p>
+ * @return Employee's head quarters
+ */
+ HeadquartersData getEmployeeHeadquarter ();
+
+ /**
+ * Getter for employee's head quarters
+ * <p>
+ * @param employeeHeadquarter Employee's head quarters
+ */
+ void setEmployeeHeadquarter (final HeadquartersData employeeHeadquarter);
+
+ /**
+ * Getter for employee's email address
+ * <p>
+ * @return Employee's email address
+ */
+ String getEmployeeEmailAddress ();
+
+ /**
+ * Setter for employee's email address
+ * <p>
+ * @param employeeEmailAddress Employee's email address
+ */
+ void setEmployeeEmailAddress (final String employeeEmailAddress);
+
+ /**
+ * Getter for employee's id number
+ * <p>
+ * @return Employee's id number
+ */
+ Long getEmployeeId ();
+
+ /**
+ * Setter for employee's id number
+ * <p>
+ * @param employeeId Employee's id number
+ */
+ void setEmployeeId (final Long employeeId);
+
+ /**
+ * Getter for employee's mobile number
+ * <p>
+ * @return Employee's mobile number
+ */
+ DialableMobileNumber getEmployeeMobileNumber ();
+
+ /**
+ * Setter for employee's mobile number
+ * <p>
+ * @param employeeMobileNumber Employee's mobile number
+ */
+ void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber);
+
+ /**
+ * Getter for employee's number
+ * <p>
+ * @return Employee's number
+ */
+ String getEmployeeNumber ();
+
+ /**
+ * Setter for employee's number
+ * <p>
+ * @param employeeNumber Employee's number
+ */
+ void setEmployeeNumber (final String employeeNumber);
+
+ /**
+ * Getter for employee's personal data
+ * <p>
+ * @return Employee's personal data
+ */
+ Contact getEmployeePersonalData ();
+
+ /**
+ * Setter for employee's personal data
+ * <p>
+ * @param employeePersonalData Employee's personal data
+ */
+ void setEmployeePersonalData (final Contact employeePersonalData);
+
+ /**
+ * Getter for employee's phone number/extension
+ * <p>
+ * @return Employee's phone number/extension
+ */
+ Integer getEmployeePhoneExtension ();
+
+ /**
+ * Setter for employee's phone number/extension
+ * <p>
+ * @param employeePhoneExtension Employee's phone number/extension
+ */
+ void setEmployeePhoneExtension (final Integer employeePhoneExtension);
+
+ /**
+ * Getter for employee's position
+ * <p>
+ * @return Employee's position
+ */
+ JobPosition getEmployeePosition ();
+
+ /**
+ * Setter for employee's position
+ * <p>
+ * @param employeePosition Employee's position
+ */
+ void setEmployeePosition (final JobPosition employeePosition);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getEmployeeUserOwner ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param employeeUserOwner User owner instance
+ */
+ void setEmployeeUserOwner (final User employeeUserOwner);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getEmployeeCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param employeeCreated Timestamp when this entry has been created
+ */
+ void setEmployeeCreated (final Calendar employeeCreated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 KLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Entity (name = "company_headquarters")
+@Table (name = "company_headquarters")
+@SuppressWarnings ("PersistenceUnitPresent")
+public class CompanyHeadquartersData implements HeadquartersData {
+
+ /**
+ * Serial number
+ */
+ @Transient
+ private static final long serialVersionUID = 385_752_948_781_761L;
+
+ /**
+ * Headquarters' city name
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_city", length = 100, nullable = false)
+ private String headquartersCity;
+
+ /**
+ * Headquarter's country code
+ */
+ @JoinColumn (name = "headquarters_country_id", nullable = false)
+ @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
+ private Country headquartersCountry;
+
+ /**
+ * Timestamp when this entry has been created
+ */
+ @Basic (optional = false)
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "headquarters_entry_created", nullable = false, updatable = false)
+ private Calendar headquartersCreated;
+
+ /**
+ * Headquarters' fax number
+ */
+ @JoinColumn (name = "headquarters_fax_number_id")
+ @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
+ private DialableFaxNumber headquartersFaxNumber;
+
+ /**
+ * Headquarters' house number
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_house_number", length = 4, nullable = false)
+ private Short headquartersHouseNumber;
+
+ /**
+ * Id number
+ */
+ @Id
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ @Column (name = "headquarters_id", nullable = false, updatable = false)
+ private Long headquartersId;
+
+ /**
+ * Headquarters' phone number
+ */
+ @JoinColumn (name = "headquarters_phone_number_id")
+ @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
+ private DialableLandLineNumber headquartersPhoneNumber;
+
+ /**
+ * Headquarters' store number (multi-store building only)
+ */
+ @Column (name = "headquarters_store", length = 3)
+ private Short headquartersStore;
+
+ /**
+ * Headquarters' street name
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_street", length = 100, nullable = false)
+ private String headquartersStreet;
+
+ /**
+ * Headquarters' suite number
+ */
+ @Column (name = "headquarters_suite_number", length = 4)
+ private Short headquartersSuiteNumber;
+
+ /**
+ * User owner instance
+ */
+ @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+ private User headquartersUserOwner;
+
+ /**
+ * Headquarters' ZIP code
+ */
+ @Basic (optional = false)
+ @Column (name = "headquarters_zip_code", length = 6, nullable = false)
+ private Integer headquartersZipCode;
+
+ @Override
+ public boolean equals (final Object object) {
+ if (null == object) {
+ return false;
+ } else if (this.getClass() != object.getClass()) {
+ return false;
+ }
+
+ final HeadquartersData other = (HeadquartersData) object;
+
+ if (!Objects.equals(this.getHeadquartersId(), other.getHeadquartersId())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersCity(), other.getHeadquartersCity())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersCountry(), other.getHeadquartersCountry())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersHouseNumber(), other.getHeadquartersHouseNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersStore(), other.getHeadquartersStore())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersStreet(), other.getHeadquartersStreet())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersSuiteNumber(), other.getHeadquartersSuiteNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getHeadquartersZipCode(), other.getHeadquartersZipCode())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getHeadquartersCity () {
+ return this.headquartersCity;
+ }
+
+ @Override
+ public void setHeadquartersCity (final String headquartersCity) {
+ this.headquartersCity = headquartersCity;
+ }
+
+ @Override
+ public Country getHeadquartersCountry () {
+ return this.headquartersCountry;
+ }
+
+ @Override
+ public void setHeadquartersCountry (final Country headquartersCountry) {
+ this.headquartersCountry = headquartersCountry;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Calendar getHeadquartersCreated () {
+ return this.headquartersCreated;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setHeadquartersCreated (final Calendar headquartersCreated) {
+ this.headquartersCreated = headquartersCreated;
+ }
+
+ @Override
+ public DialableFaxNumber getHeadquartersFaxNumber () {
+ return this.headquartersFaxNumber;
+ }
+
+ @Override
+ public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) {
+ this.headquartersFaxNumber = headquartersFaxNumber;
+ }
+
+ @Override
+ public Short getHeadquartersHouseNumber () {
+ return this.headquartersHouseNumber;
+ }
+
+ @Override
+ public void setHeadquartersHouseNumber (final Short headquartersHouseNumber) {
+ this.headquartersHouseNumber = headquartersHouseNumber;
+ }
+
+ @Override
+ public Long getHeadquartersId () {
+ return this.headquartersId;
+ }
+
+ @Override
+ public void setHeadquartersId (final Long headquartersId) {
+ this.headquartersId = headquartersId;
+ }
+
+ @Override
+ public DialableLandLineNumber getHeadquartersPhoneNumber () {
+ return this.headquartersPhoneNumber;
+ }
+
+ @Override
+ public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) {
+ this.headquartersPhoneNumber = headquartersPhoneNumber;
+ }
+
+ @Override
+ public Short getHeadquartersStore () {
+ return this.headquartersStore;
+ }
+
+ @Override
+ public void setHeadquartersStore (final Short headquartersStore) {
+ this.headquartersStore = headquartersStore;
+ }
+
+ @Override
+ public String getHeadquartersStreet () {
+ return this.headquartersStreet;
+ }
+
+ @Override
+ public void setHeadquartersStreet (final String headquartersStreet) {
+ this.headquartersStreet = headquartersStreet;
+ }
+
+ @Override
+ public Short getHeadquartersSuiteNumber () {
+ return this.headquartersSuiteNumber;
+ }
+
+ @Override
+ public void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber) {
+ this.headquartersSuiteNumber = headquartersSuiteNumber;
+ }
+
+ @Override
+ public User getHeadquartersUserOwner () {
+ return this.headquartersUserOwner;
+ }
+
+ @Override
+ public void setHeadquartersUserOwner (final User headquartersUserOwner) {
+ this.headquartersUserOwner = headquartersUserOwner;
+ }
+
+ @Override
+ public Integer getHeadquartersZipCode () {
+ return this.headquartersZipCode;
+ }
+
+ @Override
+ public void setHeadquartersZipCode (final Integer headquartersZipCode) {
+ this.headquartersZipCode = headquartersZipCode;
+ }
+
+ @Override
+ public int hashCode () {
+ int hash = 7;
+
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersId());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersCity());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersCountry());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersHouseNumber());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersStore());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersStreet());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersSuiteNumber());
+ hash = 47 * hash + Objects.hashCode(this.getHeadquartersZipCode());
+
+ return hash;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface HeadquartersData extends Serializable {
+
+ /**
+ * Getter for headquarters' city name
+ * <p>
+ * @return Headquarters' city name
+ */
+ String getHeadquartersCity ();
+
+ /**
+ * Setter for headquarters' city name
+ * <p>
+ * @param headquartersCity Headquarters' city name
+ */
+ void setHeadquartersCity (final String headquartersCity);
+
+ /**
+ * Getter for headquarters' country code
+ * <p>
+ * @return Headquarters' country code
+ */
+ Country getHeadquartersCountry ();
+
+ /**
+ * Setter for headquarters' country code
+ * <p>
+ * @param headquartersCountryCode Headquarters' country code
+ */
+ void setHeadquartersCountry (final Country headquartersCountryCode);
+
+ /**
+ * Getter for headquarters' house number
+ * <p>
+ * @return Headquarters' house number
+ */
+ Short getHeadquartersHouseNumber ();
+
+ /**
+ * Setter for headquarters' house number
+ * <p>
+ * @param headquartersHouseNumber Headquarters' house number
+ */
+ void setHeadquartersHouseNumber (final Short headquartersHouseNumber);
+
+ /**
+ * Getter for headquarters' id number
+ * <p>
+ * @return Headquarters' id number
+ */
+ Long getHeadquartersId ();
+
+ /**
+ * Setter for headquarters' id number
+ * <p>
+ * @param headquartersId Headquarters' id number
+ */
+ void setHeadquartersId (final Long headquartersId);
+
+ /**
+ * Getter for headquarters' store number
+ * <p>
+ * @return Headquarters' store number
+ */
+ Short getHeadquartersStore ();
+
+ /**
+ * Setter for headquarters' store number
+ * <p>
+ * @param headquartersStore Headquarters' store number
+ */
+ void setHeadquartersStore (final Short headquartersStore);
+
+ /**
+ * Getter for headquarters' street name
+ * <p>
+ * @return Headquarters' street name
+ */
+ String getHeadquartersStreet ();
+
+ /**
+ * Setter for headquarters' street name
+ * <p>
+ * @param headquartersStreet Headquarters' street name
+ */
+ void setHeadquartersStreet (final String headquartersStreet);
+
+ /**
+ * Getter for headquarters' suite number
+ * <p>
+ * @return Headquarters' suite number
+ */
+ Short getHeadquartersSuiteNumber ();
+
+ /**
+ * Setter for headquarters' suite number
+ * <p>
+ * @param headquartersSuiteNumber Headquarters' suite number
+ */
+ void setHeadquartersSuiteNumber (final Short headquartersSuiteNumber);
+
+ /**
+ * Getter for headquarters' ZIP code
+ * <p>
+ * @return Headquarters' ZIP code
+ */
+ Integer getHeadquartersZipCode ();
+
+ /**
+ * Setter for headquarters' ZIP code
+ * <p>
+ * @param headquartersZipCode Headquarters' ZIP code
+ */
+ void setHeadquartersZipCode (final Integer headquartersZipCode);
+
+ /**
+ * Getter for headquarters' phone number
+ * <p>
+ * @return Headquarters' phone number
+ */
+ DialableLandLineNumber getHeadquartersPhoneNumber ();
+
+ /**
+ * Setter for headquarters' phone number
+ * <p>
+ * @param headquartersPhoneNumber Headquarters' phone number
+ */
+ void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber);
+
+ /**
+ * Getter for headquarters' fax number
+ * <p>
+ * @return Headquarters' fax number
+ */
+ DialableFaxNumber getHeadquartersFaxNumber ();
+
+ /**
+ * Setter for headquarters' fax number
+ * <p>
+ * @param headquartersFaxNumber Headquarters' fax number
+ */
+ void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getHeadquartersUserOwner ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param headquartersUserOwner User owner instance
+ */
+ void setHeadquartersUserOwner (final User headquartersUserOwner);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getHeadquartersCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param headquartersCreated Timestamp when this entry has been created
+ */
+ void setHeadquartersCreated (final Calendar headquartersCreated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@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;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.model.jobposition;
+
+import java.io.Serializable;
+import java.util.Calendar;
+
+/**
+ * A POJI for job positions
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobPosition extends Serializable {
+
+ /**
+ * Getter for id number
+ * <p>
+ * @return Id number
+ */
+ Long getJobPositionId ();
+
+ /**
+ * Setter for id number
+ * <p>
+ * @param jobPositionId Id number
+ */
+ void setJobPositionId (final Long jobPositionId);
+
+ /**
+ * Getter for job position name
+ * <p>
+ * @return Job position name
+ */
+ String getJobPositionName ();
+
+ /**
+ * Setter for job position name
+ * <p>
+ * @param jobPositionName Job position name
+ */
+ void setJobPositionName (final String jobPositionName);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getJobPositionCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param jobPositionCreated Timestamp when this entry has been created
+ */
+ void setJobPositionCreated (final Calendar jobPositionCreated);
+
+ /**
+ * Getter for timestamp when this entry has been updated
+ * <p>
+ * @return Timestamp when this entry has been updated
+ */
+ Calendar getJobPositionUpdated ();
+
+ /**
+ * Setter for timestamp when this entry has been updated
+ * <p>
+ * @param jobPositionUpdated Timestamp when this entry has been updated
+ */
+ void setJobPositionUpdated (final Calendar jobPositionUpdated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.model.logo;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJI for business logos
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface BusinessLogo extends Serializable {
+
+ /**
+ * Getter for logo's local file name
+ * <p>
+ * @return Logo's local file name
+ */
+ String getLogoFileName ();
+
+ /**
+ * Setter for logo's local file name
+ * <p>
+ * @param logoFileName Logo's local file name
+ */
+ void setLogoFileName (final String logoFileName);
+
+ /**
+ * Getter for logo's id number
+ * <p>
+ * @return Logo's id number
+ */
+ Long getLogoId ();
+
+ /**
+ * Setter for logo's id number
+ * <p>
+ * @param logoId Logo's id number
+ */
+ void setLogoId (final Long logoId);
+
+ /**
+ * Getter for user owner instance
+ * <p>
+ * @return User owner instance
+ */
+ User getLogoUploader ();
+
+ /**
+ * Setter for user owner instance
+ * <p>
+ * @param logoUploader User owner instance
+ */
+ void setLogoUploader (final User logoUploader);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Calendar getLogoCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param logoCreated Timestamp when this entry has been created
+ */
+ void setLogoCreated (final Calendar logoCreated);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@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;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@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
+ * <p>
+ * @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
+ * <p>
+ * @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;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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<roland@mxchange.org>
+ */
+public interface OpeningTimes extends Serializable {
+
+ /**
+ * Getter for id number
+ * <p>
+ * @return Id number
+ */
+ Long getId ();
+
+ /**
+ * Setter for id number
+ * <p>
+ * @param id Id number
+ */
+ void setId (final Long id);
+
+ /**
+ * Getter for starting day
+ * <p>
+ * @return Starting day
+ */
+ DayOfTheWeek getStartDay ();
+
+ /**
+ * Setter for starting day
+ * <p>
+ * @param startDay Starting day
+ */
+ void setStartDay (final DayOfTheWeek startDay);
+
+ /**
+ * Getter for ending day
+ * <p>
+ * @return Ending day
+ */
+ DayOfTheWeek getEndDay ();
+
+ /**
+ * Setter for ending day
+ * <p>
+ * @param endDay Ending day
+ */
+ void setEndDay (final DayOfTheWeek endDay);
+
+ /**
+ * Getter for starting time
+ * <p>
+ * @return Starting time
+ */
+ Calendar getStartTime ();
+
+ /**
+ * Setter for starting time
+ * <p>
+ * @param startTime Starting time
+ */
+ void setStartTime (final Calendar startTime);
+
+ /**
+ * Getter for ending time
+ * <p>
+ * @return Ending time
+ */
+ Calendar getEndTime ();
+
+ /**
+ * Setter for ending time
+ * <p>
+ * @param endTime Ending time
+ */
+ void setEndTime (final Calendar endTime);
+
+ @Override
+ boolean equals (final Object obj);
+
+ @Override
+ int hashCode ();
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+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());
+ }
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@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
- * <p>
- * @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
- * <p>
- * @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;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.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<roland@mxchange.org>
- */
-public interface OpeningTimes extends Serializable {
-
- /**
- * Getter for id number
- * <p>
- * @return Id number
- */
- Long getId ();
-
- /**
- * Setter for id number
- * <p>
- * @param id Id number
- */
- void setId (final Long id);
-
- /**
- * Getter for starting day
- * <p>
- * @return Starting day
- */
- DayOfTheWeek getStartDay ();
-
- /**
- * Setter for starting day
- * <p>
- * @param startDay Starting day
- */
- void setStartDay (final DayOfTheWeek startDay);
-
- /**
- * Getter for ending day
- * <p>
- * @return Ending day
- */
- DayOfTheWeek getEndDay ();
-
- /**
- * Setter for ending day
- * <p>
- * @param endDay Ending day
- */
- void setEndDay (final DayOfTheWeek endDay);
-
- /**
- * Getter for starting time
- * <p>
- * @return Starting time
- */
- Calendar getStartTime ();
-
- /**
- * Setter for starting time
- * <p>
- * @param startTime Starting time
- */
- void setStartTime (final Calendar startTime);
-
- /**
- * Getter for ending time
- * <p>
- * @return Ending time
- */
- Calendar getEndTime ();
-
- /**
- * Setter for ending time
- * <p>
- * @param endTime Ending time
- */
- void setEndTime (final Calendar endTime);
-
- @Override
- boolean equals (final Object obj);
-
- @Override
- int hashCode ();
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.opening_times.dayofweek;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-/**
- * An enumeration suitable for persisting
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-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());
- }
-
-}