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