]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/CompanyContact.java
1a049a2ef941348213fdd30b7f022b062ead15a1
[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.BasicBusinessData;
30 import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
31 import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
32 import org.mxchange.jcontactsbusiness.employee.Employee;
33 import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData;
34 import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
35
36 /**
37  * A POJO for business contacts
38  * <p>
39  * @author Roland Haeder
40  */
41 @Entity (name = "company_contacts")
42 @Table (name = "company_contacts")
43 public class CompanyContact implements BusinessContact, Comparable<BusinessContact> {
44
45         /**
46          * Serial number
47          */
48         private static final long serialVersionUID = 478_378_178_748_691L;
49
50         /**
51          * Id number
52          */
53         @Id
54         @Column (name = "company_contact_id", length = 20, nullable = false, unique = true, updatable = false)
55         @GeneratedValue (strategy = GenerationType.IDENTITY)
56         private Long companyContactId;
57
58         /**
59          * Reference to basic data
60          */
61         @JoinColumn (name = "basic_data_id", nullable = false, updatable = false, unique = true)
62         @OneToOne (targetEntity = CompanyBasicData.class, optional = false)
63         private BasicBusinessData basicBusinessData;
64
65         /**
66          * Reference to headquarters data
67          */
68         @JoinColumn (name = "headquarters_data_id", nullable = false, updatable = false, unique = true)
69         @OneToOne (targetEntity = CompanyHeadQuartersData.class, optional = false)
70         private HeadQuartersData headQuartersData;
71
72         /**
73          * Reference to CEO "employee"
74          */
75         @JoinColumn(name = "company_founder_id", nullable = false, updatable = false)
76         @OneToOne(targetEntity = CompanyEmployee.class, optional = false)
77         private Employee companyFounder;
78
79         /**
80          * Reference to employee list
81          */
82         @JoinColumn (name = "employees_id", nullable = false, updatable = false, unique = true)
83         @OneToMany(targetEntity = CompanyEmployee.class)
84         private List<Employee> employees;
85
86         @Override
87         public int compareTo (final BusinessContact businessContact) {
88                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
89         }
90
91         @Override
92         public BasicBusinessData getBasicBusinessData () {
93                 return this.basicBusinessData;
94         }
95
96         @Override
97         public void setBasicBusinessData (final BasicBusinessData basicBusinessData) {
98                 this.basicBusinessData = basicBusinessData;
99         }
100
101         @Override
102         public Long getCompanyContactId () {
103                 return this.companyContactId;
104         }
105
106         @Override
107         public void setCompanyContactId (final Long companyContactId) {
108                 this.companyContactId = companyContactId;
109         }
110
111         @Override
112         public Employee getCompanyFounder () {
113                 return this.companyFounder;
114         }
115
116         @Override
117         public void setCompanyFounder (final Employee companyFounder) {
118                 this.companyFounder = companyFounder;
119         }
120
121         @Override
122         public List<Employee> getEmployees () {
123                 return this.employees;
124         }
125
126         @Override
127         public void setEmployees (final List<Employee> employees) {
128                 this.employees = employees;
129         }
130
131         @Override
132         public HeadQuartersData getHeadQuartersData () {
133                 return this.headQuartersData;
134         }
135
136         @Override
137         public void setHeadQuartersData (final HeadQuartersData headQuartersData) {
138                 this.headQuartersData = headQuartersData;
139         }
140 }