2 * Copyright (C) 2016 - 2020 Free Software Foundation
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.
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.
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/>.
17 package org.mxchange.jjobs.model.skill;
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;
36 * A POJO entity for skills
38 * @author Roland Häder<roland@mxchange.org>
40 @Entity (name = "skills")
44 @SuppressWarnings ("PersistenceUnitPresent")
45 public class JobSkill implements Skillable {
51 private static final long serialVersionUID = 185435718692L;
54 * When this entry has been created
56 @Basic (optional = false)
57 @Column (name = "skill_created", nullable = false, updatable = false)
58 @Temporal (TemporalType.TIMESTAMP)
59 private Date skillCreated;
62 * Id number (primary key)
65 @GeneratedValue (strategy = GenerationType.IDENTITY)
66 @Column (name = "skill_id", nullable = false, updatable = false)
70 * When this entry has been last locked
72 @Column (name = "skill_last_locked", insertable = false)
73 @Temporal (TemporalType.TIMESTAMP)
74 private Date skillLastLocked;
79 @Basic (optional = false)
80 @Column (name = "skill_name", nullable = false, unique = true)
81 private String skillName;
86 @Basic (optional = false)
87 @Enumerated (EnumType.STRING)
88 @Column (name = "skill_status", nullable = false)
89 private SkillStatus skillStatus;
92 * When this entry has been updated
94 @Column (name = "skill_updated", insertable = false)
95 @Temporal (TemporalType.TIMESTAMP)
96 private Date skillUpdated;
99 public boolean equals (final Object object) {
100 if (this == object) {
102 } else if (null == object) {
104 } else if (this.getClass() != object.getClass()) {
108 final Skillable other = (Skillable) object;
110 if (!Objects.equals(this.getSkillName(), other.getSkillName())) {
112 } else if (!Objects.equals(this.getSkillId(), other.getSkillId())) {
120 @SuppressWarnings ("ReturnOfDateField")
121 public Date getSkillCreated () {
122 return this.skillCreated;
126 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
127 public void setSkillCreated (final Date skillCreated) {
128 this.skillCreated = skillCreated;
132 public Long getSkillId () {
137 public void setSkillId (final Long skillId) {
138 this.skillId = skillId;
142 @SuppressWarnings ("ReturnOfDateField")
143 public Date getSkillLastLocked () {
144 return this.skillLastLocked;
148 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
149 public void setSkillLastLocked (final Date skillLastLocked) {
150 this.skillLastLocked = skillLastLocked;
154 public String getSkillName () {
155 return this.skillName;
159 public void setSkillName (final String skillName) {
160 this.skillName = skillName;
164 public SkillStatus getSkillStatus () {
165 return this.skillStatus;
169 public void setSkillStatus (final SkillStatus skillStatus) {
170 this.skillStatus = skillStatus;
174 @SuppressWarnings ("ReturnOfDateField")
175 public Date getSkillUpdated () {
176 return this.skillUpdated;
180 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
181 public void setSkillUpdated (final Date skillUpdated) {
182 this.skillUpdated = skillUpdated;
186 public int hashCode () {
189 hash = 97 * hash + Objects.hashCode(this.getSkillId());
190 hash = 97 * hash + Objects.hashCode(this.getSkillName());