]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
added job position entity
[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.Basic;
20 import javax.persistence.CascadeType;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
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          * Id number
56          */
57         @Id
58         @Column (name = "employee_id", length = 20, nullable = false, updatable = false)
59         @GeneratedValue (strategy = GenerationType.IDENTITY)
60         private Long employeeId;
61
62         /**
63          * Branch office the employee works at
64          */
65         @JoinColumn (name = "employee_branch_id")
66         @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL, orphanRemoval = true)
67         private BranchOffice employeeBranchOffice;
68
69         /**
70          * Department the employee works at
71          */
72         @JoinColumn (name = "employee_department_id", nullable = false)
73         @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL, optional = false)
74         private Department employeeDepartment;
75
76         /**
77          * Employee's email address
78          */
79         @Column (name = "employee_email_address", length = 30)
80         private String employeeEmailAddress;
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         @Basic (optional = false)
93         @Column (name = "employee_number", length = 20, nullable = false)
94         private String employeeNumber;
95
96         /**
97          * Employee's personal data
98          */
99         @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false)
100         @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false)
101         private Contact employeePersonalData;
102
103         /**
104          * Employee's phone extension (or number if different)
105          */
106         @Column (name = "employee_phone_extension", length = 10)
107         private Integer employeePhoneExtension;
108
109         /**
110          * Employee's position (example: CEO)
111          */
112         @JoinColumn (name = "employee_position_id", nullable = false)
113         @OneToOne (targetEntity = EmployeePosition.class, optional = false, cascade = CascadeType.ALL)
114         private JobPosition employeePosition;
115
116         @Override
117         public int compareTo (final Employee employee) {
118                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
119         }
120
121         @Override
122         public BranchOffice getEmployeeBranchOffice () {
123                 return this.employeeBranchOffice;
124         }
125
126         @Override
127         public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice) {
128                 this.employeeBranchOffice = employeeBranchOffice;
129         }
130
131         @Override
132         public Department getEmployeeDepartment () {
133                 return this.employeeDepartment;
134         }
135
136         @Override
137         public void setEmployeeDepartment (final Department employeeDepartment) {
138                 this.employeeDepartment = employeeDepartment;
139         }
140
141         @Override
142         public String getEmployeeEmailAddress () {
143                 return this.employeeEmailAddress;
144         }
145
146         @Override
147         public void setEmployeeEmailAddress (final String employeeEmailAddress) {
148                 this.employeeEmailAddress = employeeEmailAddress;
149         }
150
151         @Override
152         public Long getEmployeeId () {
153                 return this.employeeId;
154         }
155
156         @Override
157         public void setEmployeeId (final Long employeeId) {
158                 this.employeeId = employeeId;
159         }
160
161         @Override
162         public DialableCellphoneNumber getEmployeeMobileNumber () {
163                 return this.employeeMobileNumber;
164         }
165
166         @Override
167         public void setEmployeeMobileNumber (final DialableCellphoneNumber employeeMobileNumber) {
168                 this.employeeMobileNumber = employeeMobileNumber;
169         }
170
171         @Override
172         public String getEmployeeNumber () {
173                 return this.employeeNumber;
174         }
175
176         @Override
177         public void setEmployeeNumber (final String employeeNumber) {
178                 this.employeeNumber = employeeNumber;
179         }
180
181         @Override
182         public Contact getEmployeePersonalData () {
183                 return this.employeePersonalData;
184         }
185
186         @Override
187         public void setEmployeePersonalData (final Contact employeePersonalData) {
188                 this.employeePersonalData = employeePersonalData;
189         }
190
191         @Override
192         public Integer getEmployeePhoneExtension () {
193                 return this.employeePhoneExtension;
194         }
195
196         @Override
197         public void setEmployeePhoneExtension (final Integer employeePhoneExtension) {
198                 this.employeePhoneExtension = employeePhoneExtension;
199         }
200
201         @Override
202         public JobPosition getEmployeePosition () {
203                 return this.employeePosition;
204         }
205
206         @Override
207         public void setEmployeePosition (final JobPosition employeePosition) {
208                 this.employeePosition = employeePosition;
209         }
210 }