2 * Copyright (C) 2015 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.jcontactsbusiness.employee;
19 import javax.persistence.CascadeType;
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.OneToOne;
27 import javax.persistence.Table;
28 import javax.persistence.Transient;
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;
41 * A POJO for company employees (including CEO)
43 * @author Roland Haeder
45 @Entity (name = "employees")
46 @Table (name = "employees")
47 public class CompanyEmployee implements Employee, Comparable<Employee> {
52 private static final long serialVersionUID = 48_959_819_859_812_076L;
55 * Branch office the employee works at
57 @JoinColumn (name = "employee_branch_id")
58 @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
59 private BranchOffice employeeBranchOffice;
62 * Department the employee works at
64 @JoinColumn (name = "employee_department_id")
65 @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL)
66 private Department employeeDepartment;
69 * Employee's email address
71 @Column (name = "employee_email_address", length = 30)
72 private String employeeEmailAddress;
78 @Column (name = "employee_id", length = 20, nullable = false, updatable = false)
79 @GeneratedValue (strategy = GenerationType.IDENTITY)
80 private Long employeeId;
83 * Employee's business mobile number
85 @JoinColumn (name = "employee_mobile_number_id")
86 @OneToOne (targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL)
87 private DialableCellphoneNumber employeeMobileNumber;
92 @Column (name = "employee_number", length = 20)
93 private String employeeNumber;
96 * Employee's personal data
98 @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false)
99 @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false)
101 private Contact employeePersonalData;
104 * Employee's phone extension (or number if different)
106 @Column (name = "employee_phone_extension", length = 10)
107 private Integer employeePhoneExtension;
110 * Employee's position (example: CEO)
112 @JoinColumn (name = "employee_position_id")
113 @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.ALL)
115 private JobPosition employeePosition;
118 public int compareTo (final Employee employee) {
119 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
123 public BranchOffice getEmployeeBranchOffice () {
124 return this.employeeBranchOffice;
128 public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice) {
129 this.employeeBranchOffice = employeeBranchOffice;
133 public Department getEmployeeDepartment () {
134 return this.employeeDepartment;
138 public void setEmployeeDepartment (final Department employeeDepartment) {
139 this.employeeDepartment = employeeDepartment;
143 public String getEmployeeEmailAddress () {
144 return this.employeeEmailAddress;
148 public void setEmployeeEmailAddress (final String employeeEmailAddress) {
149 this.employeeEmailAddress = employeeEmailAddress;
153 public Long getEmployeeId () {
154 return this.employeeId;
158 public void setEmployeeId (final Long employeeId) {
159 this.employeeId = employeeId;
163 public DialableCellphoneNumber getEmployeeMobileNumber () {
164 return this.employeeMobileNumber;
168 public void setEmployeeMobileNumber (final DialableCellphoneNumber employeeMobileNumber) {
169 this.employeeMobileNumber = employeeMobileNumber;
173 public String getEmployeeNumber () {
174 return this.employeeNumber;
178 public void setEmployeeNumber (final String employeeNumber) {
179 this.employeeNumber = employeeNumber;
183 public Contact getEmployeePersonalData () {
184 return this.employeePersonalData;
188 public void setEmployeePersonalData (final Contact employeePersonalData) {
189 this.employeePersonalData = employeePersonalData;
193 public Integer getEmployeePhoneExtension () {
194 return this.employeePhoneExtension;
198 public void setEmployeePhoneExtension (final Integer employeePhoneExtension) {
199 this.employeePhoneExtension = employeePhoneExtension;
203 public JobPosition getEmployeePosition () {
204 return this.employeePosition;
208 public void setEmployeePosition (final JobPosition employeePosition) {
209 this.employeePosition = employeePosition;