]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java
user (owner) is now optional and renamed
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / jobposition / EmployeePosition.java
1 /*
2  * Copyright (C) 2016, 2017 Roland Häder
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.jobposition;
18
19 import java.util.Calendar;
20 import java.util.Objects;
21 import javax.persistence.Basic;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.Index;
28 import javax.persistence.Table;
29 import javax.persistence.Temporal;
30 import javax.persistence.TemporalType;
31 import javax.persistence.Transient;
32
33 /**
34  * A POJO for job positions
35  * <p>
36  * @author Roland Häder<roland@mxchange.org>
37  */
38 @Entity (name = "company_job_positions")
39 @Table (
40                 name = "company_job_positions",
41                 indexes = {
42                         @Index (
43                                         name = "job_position",
44                                         columnList = "job_position_name",
45                                         unique = true
46                         )
47                 }
48 )
49 @SuppressWarnings ("PersistenceUnitPresent")
50 public class EmployeePosition implements JobPosition {
51
52         /**
53          * Serial number
54          */
55         @Transient
56         private static final long serialVersionUID = 18_427_587_187_609L;
57
58         /**
59          * Timestamp when this entry has been created
60          */
61         @Basic (optional = false)
62         @Temporal (TemporalType.TIMESTAMP)
63         @Column (name = "job_position_created", nullable = false, updatable = false)
64         private Calendar jobPositionCreated;
65
66         /**
67          * Id number
68          */
69         @Id
70         @GeneratedValue (strategy = GenerationType.IDENTITY)
71         @Column (name = "job_position_id", nullable = false, updatable = false)
72         private Long jobPositionId;
73
74         /**
75          * Name/description of the job position (example: CEO)
76          */
77         @Basic (optional = false)
78         @Column (name = "job_position_name", nullable = false, unique = true)
79         private String jobPositionName;
80
81         /**
82          * Timestamp when this entry has been created
83          */
84         @Temporal (TemporalType.TIMESTAMP)
85         @Column (name = "job_position_updated", insertable = false)
86         private Calendar jobPositionUpdated;
87
88         @Override
89         public boolean equals (final Object object) {
90                 if (this == object) {
91                         return true;
92                 } else if (null == object) {
93                         return false;
94                 } else if (this.getClass() != object.getClass()) {
95                         return false;
96                 }
97
98                 final JobPosition other = (JobPosition) object;
99
100                 if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) {
101                         return false;
102                 } else if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) {
103                         return false;
104                 }
105
106                 return true;
107         }
108
109         @Override
110         @SuppressWarnings ("ReturnOfDateField")
111         public Calendar getJobPositionCreated () {
112                 return this.jobPositionCreated;
113         }
114
115         @Override
116         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
117         public void setJobPositionCreated (final Calendar jobPositionCreated) {
118                 this.jobPositionCreated = jobPositionCreated;
119         }
120
121         @Override
122         public Long getJobPositionId () {
123                 return this.jobPositionId;
124         }
125
126         @Override
127         public void setJobPositionId (final Long jobPositionId) {
128                 this.jobPositionId = jobPositionId;
129         }
130
131         @Override
132         public String getJobPositionName () {
133                 return this.jobPositionName;
134         }
135
136         @Override
137         public void setJobPositionName (final String jobPositionName) {
138                 this.jobPositionName = jobPositionName;
139         }
140
141         @Override
142         @SuppressWarnings ("ReturnOfDateField")
143         public Calendar getJobPositionUpdated () {
144                 return this.jobPositionUpdated;
145         }
146
147         @Override
148         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
149         public void setJobPositionUpdated (final Calendar jobPositionUpdated) {
150                 this.jobPositionUpdated = jobPositionUpdated;
151         }
152
153         @Override
154         public int hashCode () {
155                 int hash = 7;
156
157                 hash = 37 * hash + Objects.hashCode(this.getJobPositionId());
158                 hash = 37 * hash + Objects.hashCode(this.getJobPositionName());
159
160                 return hash;
161         }
162
163 }