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 org.mxchange.jcontacts.contact.Contact;
29 import org.mxchange.jcontacts.contact.UserContact;
30 import org.mxchange.jcontactsbusiness.branch.BranchOffice;
31 import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
32 import org.mxchange.jcontactsbusiness.department.CompanyDepartment;
33 import org.mxchange.jcontactsbusiness.department.Department;
34 import org.mxchange.jcontactsbusiness.jobposition.EmployeePosition;
35 import org.mxchange.jcontactsbusiness.jobposition.JobPosition;
36 import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
37 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
40 * A POJO for company employees (including CEO)
42 * @author Roland Haeder
44 @Entity (name = "employees")
45 @Table (name = "employees")
46 public class CompanyEmployee implements Employee, Comparable<Employee> {
51 private static final long serialVersionUID = 48_959_819_859_812_076L;
54 * Branch office the employee works at
56 @JoinColumn (name = "employee_branch_id")
57 @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
58 private BranchOffice employeeBranchOffice;
61 * Department the employee works at
63 @JoinColumn (name = "employee_department_id")
64 @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL)
65 private Department employeeDepartment;
68 * Employee's email address
70 @Column (name = "employee_email_address", length = 30)
71 private String employeeEmailAddress;
77 @Column (name = "employee_id", length = 20, nullable = false, updatable = false)
78 @GeneratedValue (strategy = GenerationType.IDENTITY)
79 private Long employeeId;
82 * Employee's business mobile number
84 @JoinColumn (name = "employee_mobile_number_id")
85 @OneToOne (targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL)
86 private DialableCellphoneNumber employeeMobileNumber;
91 @Column (name = "employee_number", length = 20)
92 private String employeeNumber;
95 * Employee's personal data
97 @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false)
98 @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false)
99 private Contact employeePersonalData;
102 * Employee's phone extension (or number if different)
104 @Column (name = "employee_phone_extension", length = 10)
105 private Integer employeePhoneExtension;
108 * Employee's position (example: CEO)
110 @JoinColumn (name = "employee_position_id")
111 @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.ALL)
112 private JobPosition employeePosition;
115 public int compareTo (final Employee employee) {
116 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
120 public BranchOffice getEmployeeBranchOffice () {
121 return this.employeeBranchOffice;
125 public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice) {
126 this.employeeBranchOffice = employeeBranchOffice;
130 public Department getEmployeeDepartment () {
131 return this.employeeDepartment;
135 public void setEmployeeDepartment (final Department employeeDepartment) {
136 this.employeeDepartment = employeeDepartment;
140 public String getEmployeeEmailAddress () {
141 return this.employeeEmailAddress;
145 public void setEmployeeEmailAddress (final String employeeEmailAddress) {
146 this.employeeEmailAddress = employeeEmailAddress;
150 public Long getEmployeeId () {
151 return this.employeeId;
155 public void setEmployeeId (final Long employeeId) {
156 this.employeeId = employeeId;
160 public DialableCellphoneNumber getEmployeeMobileNumber () {
161 return this.employeeMobileNumber;
165 public void setEmployeeMobileNumber (final DialableCellphoneNumber employeeMobileNumber) {
166 this.employeeMobileNumber = employeeMobileNumber;
170 public String getEmployeeNumber () {
171 return this.employeeNumber;
175 public void setEmployeeNumber (final String employeeNumber) {
176 this.employeeNumber = employeeNumber;
180 public Contact getEmployeePersonalData () {
181 return this.employeePersonalData;
185 public void setEmployeePersonalData (final Contact employeePersonalData) {
186 this.employeePersonalData = employeePersonalData;
190 public Integer getEmployeePhoneExtension () {
191 return this.employeePhoneExtension;
195 public void setEmployeePhoneExtension (final Integer employeePhoneExtension) {
196 this.employeePhoneExtension = employeePhoneExtension;
200 public JobPosition getEmployeePosition () {
201 return this.employeePosition;
205 public void setEmployeePosition (final JobPosition employeePosition) {
206 this.employeePosition = employeePosition;