]> git.mxchange.org Git - jcontacts-business-core.git/blobdiff - src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java
updated own name and resources
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / jobposition / EmployeePosition.java
index 05673ec29ba688b3140c7b9f4525b4fd3bf6819f..cf3a7e58230db76def428abb4f3b2385d16a4d15 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Roland Haeder
+ * Copyright (C) 2016 Roland Häder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,17 +28,22 @@ import javax.persistence.Index;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
+import javax.persistence.Transient;
 
 /**
  * A POJO for job positions
  * <p>
- * @author Roland Haeder<roland@mxchange.org>
+ * @author Roland Häder<roland@mxchange.org>
  */
 @Entity (name = "company_job_positions")
 @Table (
                name = "company_job_positions",
                indexes = {
-                       @Index (name = "job_position", columnList = "job_position_name", unique = true)
+                       @Index (
+                                       name = "job_position",
+                                       columnList = "job_position_name",
+                                       unique = true
+                       )
                }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
@@ -47,6 +52,7 @@ public class EmployeePosition implements JobPosition {
        /**
         * Serial number
         */
+       @Transient
        private static final long serialVersionUID = 18_427_587_187_609L;
 
        /**
@@ -72,9 +78,18 @@ public class EmployeePosition implements JobPosition {
        @Column (name = "job_position_name", nullable = false, unique = true)
        private String jobPositionName;
 
+       /**
+        * Timestamp when this entry has been created
+        */
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "job_position_updated", insertable = false)
+       private Calendar jobPositionUpdated;
+
        @Override
        public boolean equals (final Object object) {
-               if (null == object) {
+               if (this == object) {
+                       return true;
+               } else if (null == object) {
                        return false;
                } else if (this.getClass() != object.getClass()) {
                        return false;
@@ -82,14 +97,13 @@ public class EmployeePosition implements JobPosition {
 
                final JobPosition other = (JobPosition) object;
 
-               return Objects.equals(this.getJobPositionName(), other.getJobPositionName());
-       }
+               if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) {
+                       return false;
+               } else if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) {
+                       return false;
+               }
 
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 37 * hash + Objects.hashCode(this.getJobPositionName());
-               return hash;
+               return true;
        }
 
        @Override
@@ -124,4 +138,26 @@ public class EmployeePosition implements JobPosition {
                this.jobPositionName = jobPositionName;
        }
 
+       @Override
+       @SuppressWarnings ("ReturnOfDateField")
+       public Calendar getJobPositionUpdated () {
+               return this.jobPositionUpdated;
+       }
+
+       @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       public void setJobPositionUpdated (final Calendar jobPositionUpdated) {
+               this.jobPositionUpdated = jobPositionUpdated;
+       }
+
+       @Override
+       public int hashCode () {
+               int hash = 7;
+
+               hash = 37 * hash + Objects.hashCode(this.getJobPositionId());
+               hash = 37 * hash + Objects.hashCode(this.getJobPositionName());
+
+               return hash;
+       }
+
 }