]> git.mxchange.org Git - jjobs-core.git/blob - src/org/mxchange/jjobs/model/skill/JobSkill.java
Updated copyright year
[jjobs-core.git] / src / org / mxchange / jjobs / model / skill / JobSkill.java
1 /*
2  * Copyright (C) 2016 - 2020 Free Software Foundation
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.jjobs.model.skill;
18
19 import org.mxchange.jjobs.model.skill.status.SkillStatus;
20 import java.util.Date;
21 import java.util.Objects;
22 import javax.persistence.Basic;
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.EnumType;
26 import javax.persistence.Enumerated;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.Table;
31 import javax.persistence.Temporal;
32 import javax.persistence.TemporalType;
33 import javax.persistence.Transient;
34
35 /**
36  * A POJO entity for skills
37  * <p>
38  * @author Roland Häder<roland@mxchange.org>
39  */
40 @Entity (name = "skills")
41 @Table (
42                 name = "skills"
43 )
44 @SuppressWarnings ("PersistenceUnitPresent")
45 public class JobSkill implements Skillable {
46
47         /**
48          * Serial number
49          */
50         @Transient
51         private static final long serialVersionUID = 185435718692L;
52
53         /**
54          * When this entry has been created
55          */
56         @Basic (optional = false)
57         @Column (name = "skill_created", nullable = false, updatable = false)
58         @Temporal (TemporalType.TIMESTAMP)
59         private Date skillCreated;
60
61         /**
62          * Id number (primary key)
63          */
64         @Id
65         @GeneratedValue (strategy = GenerationType.IDENTITY)
66         @Column (name = "skill_id", nullable = false, updatable = false)
67         private Long skillId;
68
69         /**
70          * When this entry has been last locked
71          */
72         @Column (name = "skill_last_locked", insertable = false)
73         @Temporal (TemporalType.TIMESTAMP)
74         private Date skillLastLocked;
75
76         /**
77          * Skill name
78          */
79         @Basic (optional = false)
80         @Column (name = "skill_name", nullable = false, unique = true)
81         private String skillName;
82
83         /**
84          * Skill status
85          */
86         @Basic (optional = false)
87         @Enumerated (EnumType.STRING)
88         @Column (name = "skill_status", nullable = false)
89         private SkillStatus skillStatus;
90
91         /**
92          * When this entry has been updated
93          */
94         @Column (name = "skill_updated", insertable = false)
95         @Temporal (TemporalType.TIMESTAMP)
96         private Date skillUpdated;
97
98         @Override
99         public boolean equals (final Object object) {
100                 if (this == object) {
101                         return true;
102                 } else if (null == object) {
103                         return false;
104                 } else if (this.getClass() != object.getClass()) {
105                         return false;
106                 }
107
108                 final Skillable other = (Skillable) object;
109
110                 if (!Objects.equals(this.getSkillName(), other.getSkillName())) {
111                         return false;
112                 } else if (!Objects.equals(this.getSkillId(), other.getSkillId())) {
113                         return false;
114                 }
115
116                 return true;
117         }
118
119         @Override
120         @SuppressWarnings ("ReturnOfDateField")
121         public Date getSkillCreated () {
122                 return this.skillCreated;
123         }
124
125         @Override
126         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
127         public void setSkillCreated (final Date skillCreated) {
128                 this.skillCreated = skillCreated;
129         }
130
131         @Override
132         public Long getSkillId () {
133                 return this.skillId;
134         }
135
136         @Override
137         public void setSkillId (final Long skillId) {
138                 this.skillId = skillId;
139         }
140
141         @Override
142         @SuppressWarnings ("ReturnOfDateField")
143         public Date getSkillLastLocked () {
144                 return this.skillLastLocked;
145         }
146
147         @Override
148         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
149         public void setSkillLastLocked (final Date skillLastLocked) {
150                 this.skillLastLocked = skillLastLocked;
151         }
152
153         @Override
154         public String getSkillName () {
155                 return this.skillName;
156         }
157
158         @Override
159         public void setSkillName (final String skillName) {
160                 this.skillName = skillName;
161         }
162
163         @Override
164         public SkillStatus getSkillStatus () {
165                 return this.skillStatus;
166         }
167
168         @Override
169         public void setSkillStatus (final SkillStatus skillStatus) {
170                 this.skillStatus = skillStatus;
171         }
172
173         @Override
174         @SuppressWarnings ("ReturnOfDateField")
175         public Date getSkillUpdated () {
176                 return this.skillUpdated;
177         }
178
179         @Override
180         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
181         public void setSkillUpdated (final Date skillUpdated) {
182                 this.skillUpdated = skillUpdated;
183         }
184
185         @Override
186         public int hashCode () {
187                 int hash = 7;
188
189                 hash = 97 * hash + Objects.hashCode(this.getSkillId());
190                 hash = 97 * hash + Objects.hashCode(this.getSkillName());
191
192                 return hash;
193         }
194
195 }