]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java
Continued:
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / department / CompanyDepartment.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.department;
18
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;
31
32 /**
33  * A POJO for company departments
34  * <p>
35  * @author Roland Haeder
36  */
37 @Entity (name = "company_departments")
38 @Table (name = "company_departments")
39 public class CompanyDepartment implements Department, Comparable<Department> {
40
41         /**
42          * Serial number
43          */
44         private static final long serialVersionUID = 94_835_918_958_717_660L;
45
46         /**
47          * Connection to company contact
48          */
49         @JoinColumn (name = "department_company_id", nullable = false, updatable = false)
50         @ManyToOne (targetEntity = CompanyContact.class, optional = false)
51         private BusinessContact departmentCompany;
52
53         /**
54          * Id number
55          */
56         @Id
57         @GeneratedValue (strategy = GenerationType.IDENTITY)
58         @Column (name = "department_id", length = 20, nullable = false, unique = true, updatable = false)
59         private Long departmentId;
60
61         /**
62          * Department lead employee
63          */
64         @Basic (optional = false)
65         @JoinColumn (name = "department_lead_id", nullable = false)
66         private Employee departmentLead;
67
68         /**
69          * Department name
70          */
71         @Basic (optional = false)
72         @Column (name = "department_name", length = 100, nullable = false)
73         private String departmentName;
74
75         @Override
76         public int compareTo (final Department department) {
77                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
78         }
79
80         @Override
81         public BusinessContact getDepartmentCompany () {
82                 return this.departmentCompany;
83         }
84
85         @Override
86         public void setDepartmentCompany (final BusinessContact departmentCompany) {
87                 this.departmentCompany = departmentCompany;
88         }
89
90         @Override
91         public Long getDepartmentId () {
92                 return this.departmentId;
93         }
94
95         @Override
96         public void setDepartmentId (final Long departmentId) {
97                 this.departmentId = departmentId;
98         }
99
100         @Override
101         public Employee getDepartmentLead () {
102                 return this.departmentLead;
103         }
104
105         @Override
106         public void setDepartmentLead (final Employee departmentLead) {
107                 this.departmentLead = departmentLead;
108         }
109
110         @Override
111         public String getDepartmentName () {
112                 return this.departmentName;
113         }
114
115         @Override
116         public void setDepartmentName (final String departmentName) {
117                 this.departmentName = departmentName;
118         }
119 }