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.department;
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.ManyToOne;
27 import javax.persistence.Table;
28 import org.mxchange.jcontactsbusiness.BusinessContact;
29 import org.mxchange.jcontactsbusiness.CompanyContact;
30 import org.mxchange.jcontactsbusiness.employee.Employee;
33 * A POJO for company departments
35 * @author Roland Haeder
37 @Entity (name = "departments")
38 @Table (name = "departments")
39 public class CompanyDepartment implements Department, Comparable<Department> {
44 private static final long serialVersionUID = 94_835_918_958_717_660L;
47 * Connection to company contact
49 @JoinColumn (name = "department_company_id", nullable = false, updatable = false)
50 @ManyToOne (targetEntity = CompanyContact.class, optional = false)
51 private BusinessContact departmentCompany;
57 @GeneratedValue (strategy = GenerationType.IDENTITY)
58 @Column (name = "department_id", length = 20, nullable = false, unique = true, updatable = false)
59 private Long departmentId;
62 * Department lead employee
64 @Basic (optional = false)
65 @JoinColumn (name = "department_lead_id", nullable = false)
66 private Employee departmentLead;
71 @Basic (optional = false)
72 @Column (name = "department_name", length = 100, nullable = false)
73 private String departmentName;
76 public int compareTo (final Department department) {
77 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
81 public BusinessContact getDepartmentCompany () {
82 return this.departmentCompany;
86 public void setDepartmentCompany (final BusinessContact departmentCompany) {
87 this.departmentCompany = departmentCompany;
91 public Long getDepartmentId () {
92 return this.departmentId;
96 public void setDepartmentId (final Long departmentId) {
97 this.departmentId = departmentId;
101 public Employee getDepartmentLead () {
102 return this.departmentLead;
106 public void setDepartmentLead (final Employee departmentLead) {
107 this.departmentLead = departmentLead;
111 public String getDepartmentName () {
112 return this.departmentName;
116 public void setDepartmentName (final String departmentName) {
117 this.departmentName = departmentName;