]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java
aligned a bit code (nicer)
[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         @Override
80         public boolean equals (final Object object) {
81                 if (null == object) {
82                         return false;
83                 } else if (this.getClass() != object.getClass()) {
84                         return false;
85                 }
86
87                 final JobPosition other = (JobPosition) object;
88
89                 return Objects.equals(this.getJobPositionName(), other.getJobPositionName());
90         }
91
92         @Override
93         public int hashCode () {
94                 int hash = 7;
95                 hash = 37 * hash + Objects.hashCode(this.getJobPositionName());
96                 return hash;
97         }
98
99         @Override
100         @SuppressWarnings ("ReturnOfDateField")
101         public Calendar getJobPositionCreated () {
102                 return this.jobPositionCreated;
103         }
104
105         @Override
106         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
107         public void setJobPositionCreated (final Calendar jobPositionCreated) {
108                 this.jobPositionCreated = jobPositionCreated;
109         }
110
111         @Override
112         public Long getJobPositionId () {
113                 return this.jobPositionId;
114         }
115
116         @Override
117         public void setJobPositionId (final Long jobPositionId) {
118                 this.jobPositionId = jobPositionId;
119         }
120
121         @Override
122         public String getJobPositionName () {
123                 return this.jobPositionName;
124         }
125
126         @Override
127         public void setJobPositionName (final String jobPositionName) {
128                 this.jobPositionName = jobPositionName;
129         }
130
131 }