]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
Rewrite:
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / employee / CompanyEmployee.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.employee;
18
19 import javax.persistence.CascadeType;
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.FetchType;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.JoinColumn;
27 import javax.persistence.OneToOne;
28 import javax.persistence.Table;
29 import org.mxchange.jcontacts.contact.Contact;
30 import org.mxchange.jcontacts.contact.UserContact;
31 import org.mxchange.jcontactsbusiness.branch.BranchOffice;
32 import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
33 import org.mxchange.jcontactsbusiness.department.CompanyDepartment;
34 import org.mxchange.jcontactsbusiness.department.Department;
35 import org.mxchange.jcontactsbusiness.jobposition.EmployeePosition;
36 import org.mxchange.jcontactsbusiness.jobposition.JobPosition;
37 import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
38 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
39
40 /**
41  * A POJO for company employees (including CEO)
42  * <p>
43  * @author Roland Haeder
44  */
45 @Entity (name = "employees")
46 @Table (name = "employees")
47 public class CompanyEmployee implements Employee, Comparable<Employee> {
48
49         /**
50          * Serial number
51          */
52         private static final long serialVersionUID = 48_959_819_859_812_076L;
53
54         /**
55          * Branch office the employee works at
56          */
57         @JoinColumn (name = "employee_branch_id")
58         @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
59         private BranchOffice employeeBranchOffice;
60
61         /**
62          * Department the employee works at
63          */
64         @JoinColumn (name = "employee_department_id")
65         @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL)
66         private Department employeeDepartment;
67
68         /**
69          * Employee's email address
70          */
71         @Column (name = "employee_email_address", length = 30)
72         private String employeeEmailAddress;
73
74         /**
75          * Id number
76          */
77         @Id
78         @Column (name = "employee_id", length = 20, nullable = false, updatable = false)
79         @GeneratedValue (strategy = GenerationType.IDENTITY)
80         private Long employeeId;
81
82         /**
83          * Employee's business mobile number
84          */
85         @JoinColumn (name = "employee_mobile_number_id")
86         @OneToOne (targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL)
87         private DialableCellphoneNumber employeeMobileNumber;
88
89         /**
90          * Employee's number
91          */
92         @Column (name = "employee_number", length = 20)
93         private String employeeNumber;
94
95         /**
96          * Employee's personal data
97          */
98         @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false)
99         @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
100         private transient Contact employeePersonalData;
101
102         /**
103          * Employee's phone extension (or number if different)
104          */
105         @Column (name = "employee_phone_extension", length = 10)
106         private Integer employeePhoneExtension;
107
108         /**
109          * Employee's position (example: CEO)
110          */
111         @JoinColumn (name = "employee_position_id")
112         @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
113         private transient JobPosition employeePosition;
114
115         @Override
116         public int compareTo (final Employee employee) {
117                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
118         }
119
120         @Override
121         public BranchOffice getEmployeeBranchOffice () {
122                 return this.employeeBranchOffice;
123         }
124
125         @Override
126         public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice) {
127                 this.employeeBranchOffice = employeeBranchOffice;
128         }
129
130         @Override
131         public Department getEmployeeDepartment () {
132                 return this.employeeDepartment;
133         }
134
135         @Override
136         public void setEmployeeDepartment (final Department employeeDepartment) {
137                 this.employeeDepartment = employeeDepartment;
138         }
139
140         @Override
141         public String getEmployeeEmailAddress () {
142                 return this.employeeEmailAddress;
143         }
144
145         @Override
146         public void setEmployeeEmailAddress (final String employeeEmailAddress) {
147                 this.employeeEmailAddress = employeeEmailAddress;
148         }
149
150         @Override
151         public Long getEmployeeId () {
152                 return this.employeeId;
153         }
154
155         @Override
156         public void setEmployeeId (final Long employeeId) {
157                 this.employeeId = employeeId;
158         }
159
160         @Override
161         public DialableCellphoneNumber getEmployeeMobileNumber () {
162                 return this.employeeMobileNumber;
163         }
164
165         @Override
166         public void setEmployeeMobileNumber (final DialableCellphoneNumber employeeMobileNumber) {
167                 this.employeeMobileNumber = employeeMobileNumber;
168         }
169
170         @Override
171         public String getEmployeeNumber () {
172                 return this.employeeNumber;
173         }
174
175         @Override
176         public void setEmployeeNumber (final String employeeNumber) {
177                 this.employeeNumber = employeeNumber;
178         }
179
180         @Override
181         public Contact getEmployeePersonalData () {
182                 return this.employeePersonalData;
183         }
184
185         @Override
186         public void setEmployeePersonalData (final Contact employeePersonalData) {
187                 this.employeePersonalData = employeePersonalData;
188         }
189
190         @Override
191         public Integer getEmployeePhoneExtension () {
192                 return this.employeePhoneExtension;
193         }
194
195         @Override
196         public void setEmployeePhoneExtension (final Integer employeePhoneExtension) {
197                 this.employeePhoneExtension = employeePhoneExtension;
198         }
199
200         @Override
201         public JobPosition getEmployeePosition () {
202                 return this.employeePosition;
203         }
204
205         @Override
206         public void setEmployeePosition (final JobPosition employeePosition) {
207                 this.employeePosition = employeePosition;
208         }
209 }