]> git.mxchange.org Git - jjobs-core.git/blob - src/org/mxchange/jjobs/model/user/skills/UserSkill.java
Don't cherry-pick:
[jjobs-core.git] / src / org / mxchange / jjobs / model / user / skills / UserSkill.java
1 /*
2  * Copyright (C) 2016 - 2019 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.user.skills;
18
19 import org.mxchange.jjobs.model.skill.JobSkill;
20 import org.mxchange.jjobs.model.skill.Skillable;
21 import java.util.Date;
22 import javax.persistence.Basic;
23 import javax.persistence.CascadeType;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.GenerationType;
28 import javax.persistence.Id;
29 import javax.persistence.JoinColumn;
30 import javax.persistence.OneToOne;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34 import org.mxchange.jusercore.model.user.LoginUser;
35 import org.mxchange.jusercore.model.user.User;
36
37 /**
38  * A POJO entity for user skills
39  *
40  * @author Roland Häder<roland@mxchange.org>
41  */
42 @Entity (name = "user_skills")
43 @Table (
44                 name = "user_skills"
45 )
46 @SuppressWarnings ("PersistenceUnitPresent")
47 public class UserSkill implements SkillableUser {
48
49         /**
50          * Serial number
51          */
52         private static final long serialVersionUID = 12_837_674_186_902L;
53
54         /**
55          * Link to skills entity
56          */
57         @JoinColumn (name = "user_skill_id", referencedColumnName = "skill_id", nullable = false, updatable = false)
58         @OneToOne (cascade = CascadeType.REFRESH, optional = false, targetEntity = JobSkill.class)
59         private Skillable jobSkill;
60
61         /**
62          * Link to user entity
63          */
64         @JoinColumn (name = "user_skill_user_id", referencedColumnName = "user_id", nullable = false, updatable = false)
65         @OneToOne (cascade = CascadeType.REFRESH, optional = false, targetEntity = LoginUser.class)
66         private User skillUser;
67
68         /**
69          * When this entry has been created
70          */
71         @Basic (optional = false)
72         @Column (name = "user_skill_created", nullable = false, updatable = false)
73         @Temporal (TemporalType.TIMESTAMP)
74         private Date userSkillCreated;
75
76         /**
77          * Id number (primary key)
78          */
79         @Id
80         @GeneratedValue (strategy = GenerationType.IDENTITY)
81         @Column (name = "user_skill_entry_id", nullable = false, updatable = false)
82         private Long userSkillId;
83
84         /**
85          * When this entry has been updated
86          */
87         @Column (name = "user_skill_updated", insertable = false)
88         @Temporal (TemporalType.TIMESTAMP)
89         private Date userSkillUpdated;
90
91         @Override
92         public Skillable getJobSkill () {
93                 return this.jobSkill;
94         }
95
96         @Override
97         public void setJobSkill (final Skillable jobSkill) {
98                 this.jobSkill = jobSkill;
99         }
100
101         @Override
102         public User getSkillUser () {
103                 return this.skillUser;
104         }
105
106         @Override
107         public void setSkillUser (final User skillUser) {
108                 this.skillUser = skillUser;
109         }
110
111         @Override
112         @SuppressWarnings ("ReturnOfDateField")
113         public Date getUserSkillCreated () {
114                 return this.userSkillCreated;
115         }
116
117         @Override
118         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
119         public void setUserSkillCreated (final Date userSkillCreated) {
120                 this.userSkillCreated = userSkillCreated;
121         }
122
123         @Override
124         public Long getUserSkillId () {
125                 return this.userSkillId;
126         }
127
128         @Override
129         public void setUserSkillId (final Long userSkillId) {
130                 this.userSkillId = userSkillId;
131         }
132
133         @Override
134         @SuppressWarnings ("ReturnOfDateField")
135         public Date getUserSkillUpdated () {
136                 return this.userSkillUpdated;
137         }
138
139         @Override
140         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
141         public void setUserSkillUpdated (final Date userSkillUpdated) {
142                 this.userSkillUpdated = userSkillUpdated;
143         }
144
145 }