]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/CompanyContact.java
ea8e6f3cc9f7f06a2c01e46838cf7abb87352a2a
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / CompanyContact.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17 package org.mxchange.jcontactsbusiness;
18
19 import java.util.List;
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.GenerationType;
24 import javax.persistence.Id;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.OneToMany;
27 import javax.persistence.OneToOne;
28 import javax.persistence.Table;
29 import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
30 import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
31 import org.mxchange.jcontactsbusiness.branch.BranchOffice;
32 import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
33 import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
34 import org.mxchange.jcontactsbusiness.employee.Employee;
35 import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData;
36 import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
37
38 /**
39  * A POJO for business contacts
40  * <p>
41  * @author Roland Haeder
42  */
43 @Entity (name = "company_contacts")
44 @Table (name = "company_contacts")
45 public class CompanyContact implements BusinessContact, Comparable<BusinessContact> {
46
47         /**
48          * Serial number
49          */
50         private static final long serialVersionUID = 478_378_178_748_691L;
51
52         /**
53          * Reference to basic data
54          */
55         @JoinColumn (name = "company_basic_data_id", nullable = false, updatable = false)
56         @OneToOne (targetEntity = CompanyBasicData.class, optional = false)
57         private BusinessBasicData basicBusinessData;
58
59         /**
60          * Reference to employee branches
61          */
62         @JoinColumn (name = "company_branches_id", nullable = false, updatable = false)
63         @OneToMany (targetEntity = CompanyBranchOffice.class)
64         private List<BranchOffice> branches;
65
66         /**
67          * Id number
68          */
69         @Id
70         @Column (name = "company_contact_id", length = 20, nullable = false, updatable = false)
71         @GeneratedValue (strategy = GenerationType.IDENTITY)
72         private Long companyContactId;
73
74         /**
75          * Reference to CEO "employee"
76          */
77         @JoinColumn (name = "company_founder_id", nullable = false, updatable = false)
78         @OneToOne (targetEntity = CompanyEmployee.class, optional = false)
79         private Employee companyFounder;
80
81         /**
82          * Reference to employee list
83          */
84         @JoinColumn (name = "company_employees_id", nullable = false, updatable = false)
85         @OneToMany (targetEntity = CompanyEmployee.class)
86         private List<Employee> employees;
87
88         /**
89          * Reference to headquarters data
90          */
91         @JoinColumn (name = "company_headquarters_data_id", nullable = false, updatable = false)
92         @OneToOne (targetEntity = CompanyHeadQuartersData.class, optional = false)
93         private HeadQuartersData headQuartersData;
94
95         @Override
96         public int compareTo (final BusinessContact businessContact) {
97                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
98         }
99
100         @Override
101         public BusinessBasicData getBasicBusinessData () {
102                 return this.basicBusinessData;
103         }
104
105         @Override
106         public void setBasicBusinessData (final BusinessBasicData basicBusinessData) {
107                 this.basicBusinessData = basicBusinessData;
108         }
109
110         @Override
111         public List<BranchOffice> getBranches () {
112                 return this.branches;
113         }
114
115         @Override
116         public void setBranches (final List<BranchOffice> branches) {
117                 this.branches = branches;
118         }
119
120         @Override
121         public Long getCompanyContactId () {
122                 return this.companyContactId;
123         }
124
125         @Override
126         public void setCompanyContactId (final Long companyContactId) {
127                 this.companyContactId = companyContactId;
128         }
129
130         @Override
131         public Employee getCompanyFounder () {
132                 return this.companyFounder;
133         }
134
135         @Override
136         public void setCompanyFounder (final Employee companyFounder) {
137                 this.companyFounder = companyFounder;
138         }
139
140         @Override
141         public List<Employee> getEmployees () {
142                 return this.employees;
143         }
144
145         @Override
146         public void setEmployees (final List<Employee> employees) {
147                 this.employees = employees;
148         }
149
150         @Override
151         public HeadQuartersData getHeadQuartersData () {
152                 return this.headQuartersData;
153         }
154
155         @Override
156         public void setHeadQuartersData (final HeadQuartersData headQuartersData) {
157                 this.headQuartersData = headQuartersData;
158         }
159 }