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