2 * Copyright (C) 2016 - 2018 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.jcontactsbusiness.model.jobposition;
19 import java.util.Date;
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.Table;
28 import javax.persistence.Temporal;
29 import javax.persistence.TemporalType;
30 import javax.persistence.Transient;
31 import org.mxchange.jcoreutils.Comparables;
34 * A POJO for job positions
36 * @author Roland Häder<roland@mxchange.org>
38 @Entity (name = "company_job_positions")
40 name = "company_job_positions"
42 @SuppressWarnings ("PersistenceUnitPresent")
43 public class EmployeePosition implements JobPosition {
49 private static final long serialVersionUID = 18_427_587_187_609L;
52 * Timestamp when this entry has been created
54 @Basic (optional = false)
55 @Temporal (TemporalType.TIMESTAMP)
56 @Column (name = "job_position_created", nullable = false, updatable = false)
57 private Date jobPositionCreated;
63 @GeneratedValue (strategy = GenerationType.IDENTITY)
64 @Column (name = "job_position_id", nullable = false, updatable = false)
65 private Long jobPositionId;
68 * Name/description of the job position (example: CEO)
70 @Basic (optional = false)
71 @Column (name = "job_position_name", nullable = false, unique = true)
72 private String jobPositionName;
75 * Timestamp when this entry has been created
77 @Temporal (TemporalType.TIMESTAMP)
78 @Column (name = "job_position_updated", insertable = false)
79 private Date jobPositionUpdated;
82 public int compareTo (final JobPosition jobPosition) {
83 // Check parameter on null-reference and equality to this
84 if (null == jobPosition) {
86 throw new NullPointerException("jobPosition is null"); //NOI18N
87 } else if (jobPosition.equals(this)) {
93 final int[] comparators = {
94 // First position name ...
95 this.getJobPositionName().compareToIgnoreCase(jobPosition.getJobPositionName())
99 final int comparison = Comparables.checkAll(comparators);
106 public boolean equals (final Object object) {
107 if (this == object) {
109 } else if (null == object) {
111 } else if (this.getClass() != object.getClass()) {
115 final JobPosition other = (JobPosition) object;
117 if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) {
119 } else if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) {
127 @SuppressWarnings ("ReturnOfDateField")
128 public Date getJobPositionCreated () {
129 return this.jobPositionCreated;
133 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
134 public void setJobPositionCreated (final Date jobPositionCreated) {
135 this.jobPositionCreated = jobPositionCreated;
139 public Long getJobPositionId () {
140 return this.jobPositionId;
144 public void setJobPositionId (final Long jobPositionId) {
145 this.jobPositionId = jobPositionId;
149 public String getJobPositionName () {
150 return this.jobPositionName;
154 public void setJobPositionName (final String jobPositionName) {
155 this.jobPositionName = jobPositionName;
159 @SuppressWarnings ("ReturnOfDateField")
160 public Date getJobPositionUpdated () {
161 return this.jobPositionUpdated;
165 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
166 public void setJobPositionUpdated (final Date jobPositionUpdated) {
167 this.jobPositionUpdated = jobPositionUpdated;
171 public int hashCode () {
174 hash = 37 * hash + Objects.hashCode(this.getJobPositionId());
175 hash = 37 * hash + Objects.hashCode(this.getJobPositionName());