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.Basic;
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;
36 * A POJO for company employees (including CEO)
38 * @author Roland Haeder
40 @Entity (name = "employees")
41 @Table (name = "employees")
42 public class CompanyEmployee implements Employee, Comparable<Employee> {
47 private static final long serialVersionUID = 48_959_819_859_812_076L;
53 @Column (name = "employee_id", length = 20, nullable = false, unique = true, updatable = false)
54 @GeneratedValue (strategy = GenerationType.IDENTITY)
55 private Long employeeId;
58 * Branch office the employee works at
60 @JoinColumn (name = "employee_branch_id")
61 @OneToOne (targetEntity = CompanyBranchOffice.class, orphanRemoval = true)
62 private BranchOffice employeeBranchOffice;
65 * Department the employee works at
67 @JoinColumn (name = "employee_department_id", nullable = false)
68 @OneToOne (targetEntity = CompanyDepartment.class, optional = false)
69 private Department employeeDepartment;
72 * Employee's email address
74 @Column (name = "employee_email_address", length = 30)
75 private String employeeEmailAddress;
78 * Employee's business mobile number
80 @Column (name = "employee_mobile_number", length = 20)
81 private String employeeMobileNumber;
86 @Basic (optional = false)
87 @Column (name = "employee_number", length = 20, nullable = false)
88 private String employeeNumber;
91 * Employee's personal data
93 @JoinColumn (name = "employee_personal_id", nullable = false, unique = true, updatable = false)
94 @OneToOne (optional = false, targetEntity = UserContact.class)
95 private Contact employeePersonalData;
98 * Employee's phone extension (or number if different)
100 @Column (name = "employee_phone_extension", length = 20)
101 private String employeePhoneExtension;
104 * Employee's position (example: CEO)
106 @Basic (optional = false)
107 @Column (name = "employee_status", length = 50, nullable = false)
108 private String employeePosition;
111 public int compareTo (final Employee employee) {
112 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
116 public BranchOffice getEmployeeBranchOffice () {
117 return this.employeeBranchOffice;
121 public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice) {
122 this.employeeBranchOffice = employeeBranchOffice;
126 public Department getEmployeeDepartment () {
127 return this.employeeDepartment;
131 public void setEmployeeDepartment (final Department employeeDepartment) {
132 this.employeeDepartment = employeeDepartment;
136 public String getEmployeeEmailAddress () {
137 return this.employeeEmailAddress;
141 public void setEmployeeEmailAddress (final String employeeEmailAddress) {
142 this.employeeEmailAddress = employeeEmailAddress;
146 public Long getEmployeeId () {
147 return this.employeeId;
151 public void setEmployeeId (final Long employeeId) {
152 this.employeeId = employeeId;
156 public String getEmployeeMobileNumber () {
157 return this.employeeMobileNumber;
161 public void setEmployeeMobileNumber (final String employeeMobileNumber) {
162 this.employeeMobileNumber = employeeMobileNumber;
166 public String getEmployeeNumber () {
167 return this.employeeNumber;
171 public void setEmployeeNumber (final String employeeNumber) {
172 this.employeeNumber = employeeNumber;
176 public Contact getEmployeePersonalData () {
177 return this.employeePersonalData;
181 public void setEmployeePersonalData (final Contact employeePersonalData) {
182 this.employeePersonalData = employeePersonalData;
186 public String getEmployeePhoneExtension () {
187 return this.employeePhoneExtension;
191 public void setEmployeePhoneExtension (final String employeePhoneExtension) {
192 this.employeePhoneExtension = employeePhoneExtension;
196 public String getEmployeePosition () {
197 return this.employeePosition;
201 public void setEmployeePosition (final String employeePosition) {
202 this.employeePosition = employeePosition;