2 * Copyright (C) 2016 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jcontactsbusiness.basicdata;
19 import java.util.Calendar;
20 import java.util.Objects;
21 import javax.persistence.Basic;
22 import javax.persistence.CascadeType;
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.GeneratedValue;
26 import javax.persistence.GenerationType;
27 import javax.persistence.Id;
28 import javax.persistence.JoinColumn;
29 import javax.persistence.Lob;
30 import javax.persistence.OneToOne;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34 import javax.persistence.Transient;
35 import org.mxchange.jcontactsbusiness.logo.BusinessLogo;
36 import org.mxchange.jcontactsbusiness.logo.CompanyLogo;
37 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
38 import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
39 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
40 import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
41 import org.mxchange.jusercore.model.user.LoginUser;
42 import org.mxchange.jusercore.model.user.User;
45 * A POJO for basic company data
47 * @author Roland Haeder<roland@mxchange.org>
49 @Entity (name = "company_basic_data")
50 @Table (name = "company_basic_data")
51 @SuppressWarnings ("PersistenceUnitPresent")
52 public class CompanyBasicData implements BusinessBasicData {
58 private static final long serialVersionUID = 486_895_878_178_761L;
61 * Timestamp when this entry has been created
63 @Basic (optional = false)
64 @Temporal (TemporalType.TIMESTAMP)
65 @Column (name = "company_entry_created", nullable = false, updatable = false)
66 private Calendar basicCreated;
71 @JoinColumn (name = "company_user_id", nullable = false, updatable = false)
72 @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
73 private User basicUserOwner;
79 @Column (name = "company_basic_id", nullable = false, updatable = false)
80 @GeneratedValue (strategy = GenerationType.IDENTITY)
81 private Long companyBasicId;
87 @Column (name = "company_comments")
88 private String companyComments;
91 * Company's main email address (example: info@company.com)
93 @Column (name = "company_email_address", length = 100)
94 private String companyEmailAddress;
97 * Company's main fax numbers: +ccxxxxxxxxxx
99 @JoinColumn (name = "company_fax_number_id")
100 @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
101 private DialableFaxNumber companyFaxNumber;
104 * Legal status of company (example: "Inc.", "GmbH")
106 @Basic (optional = false)
107 @Column (name = "company_legal_status", nullable = false)
108 private String companyLegalStatus;
111 * Id number of company logo
113 @JoinColumn (name = "company_logo_id")
114 @OneToOne (targetEntity = CompanyLogo.class, cascade = CascadeType.ALL)
115 private BusinessLogo companyLogo;
120 @Basic (optional = false)
121 @Column (name = "company_name", length = 100, nullable = false)
122 private String companyName;
125 * Company's main phone number: +ccxxxxxxxxxx
127 @JoinColumn (name = "company_phone_number_id")
128 @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
129 private DialableLandLineNumber companyPhoneNumber;
134 @Column (name = "company_tax_number", length = 30)
135 private String companyTaxNumber;
138 * URL for company website
140 @Column (name = "company_website_url")
141 private String companyWebsiteUrl;
144 public boolean equals (final Object object) {
145 if (null == object) {
147 } else if (this.getClass() != object.getClass()) {
151 final BusinessBasicData other = (BusinessBasicData) object;
153 if (!Objects.equals(this.getCompanyLegalStatus(), other.getCompanyLegalStatus())) {
155 } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) {
157 } else if (!Objects.equals(this.getCompanyTaxNumber(), other.getCompanyTaxNumber())) {
165 public int hashCode () {
167 hash = 53 * hash + Objects.hashCode(this.getCompanyLegalStatus());
168 hash = 53 * hash + Objects.hashCode(this.getCompanyName());
169 hash = 53 * hash + Objects.hashCode(this.getCompanyTaxNumber());
174 @SuppressWarnings ("ReturnOfDateField")
175 public Calendar getBasicCreated () {
176 return this.basicCreated;
180 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
181 public void setBasicCreated (final Calendar basicCreated) {
182 this.basicCreated = basicCreated;
186 public User getBasicUserOwner () {
187 return this.basicUserOwner;
191 public void setBasicUserOwner (final User basicUserOwner) {
192 this.basicUserOwner = basicUserOwner;
196 public Long getCompanyBasicId () {
197 return this.companyBasicId;
201 public void setCompanyBasicId (final Long companyBasicId) {
202 this.companyBasicId = companyBasicId;
206 public String getCompanyComments () {
207 return this.companyComments;
211 public void setCompanyComments (final String companyComments) {
212 this.companyComments = companyComments;
216 public String getCompanyEmailAddress () {
217 return this.companyEmailAddress;
221 public void setCompanyEmailAddress (final String companyEmailAddress) {
222 this.companyEmailAddress = companyEmailAddress;
226 public DialableFaxNumber getCompanyFaxNumber () {
227 return this.companyFaxNumber;
231 public void setCompanyFaxNumber (final DialableFaxNumber companyFaxNumber) {
232 this.companyFaxNumber = companyFaxNumber;
236 public String getCompanyLegalStatus () {
237 return this.companyLegalStatus;
241 public void setCompanyLegalStatus (final String companyLegalStatus) {
242 this.companyLegalStatus = companyLegalStatus;
246 public BusinessLogo getCompanyLogo () {
247 return this.companyLogo;
251 public void setCompanyLogo (final BusinessLogo companyLogoId) {
252 this.companyLogo = companyLogoId;
256 public String getCompanyName () {
257 return this.companyName;
261 public void setCompanyName (final String companyName) {
262 this.companyName = companyName;
266 public DialableLandLineNumber getCompanyPhoneNumber () {
267 return this.companyPhoneNumber;
271 public void setCompanyPhoneNumber (final DialableLandLineNumber companyPhoneNumber) {
272 this.companyPhoneNumber = companyPhoneNumber;
276 public String getCompanyTaxNumber () {
277 return this.companyTaxNumber;
281 public void setCompanyTaxNumber (final String companyTaxNumber) {
282 this.companyTaxNumber = companyTaxNumber;
286 public String getCompanyWebsiteUrl () {
287 return this.companyWebsiteUrl;
291 public void setCompanyWebsiteUrl (final String companyWebsiteUrl) {
292 this.companyWebsiteUrl = companyWebsiteUrl;