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