]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
added updated timestamp
authorRoland Häder <roland@mxchange.org>
Mon, 9 May 2016 11:22:54 +0000 (13:22 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 9 May 2016 11:22:54 +0000 (13:22 +0200)
src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java
src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java

index 2a0bef476b621e7d81f72b32ab2fae21505d6653..71e6e87112f0001b306d3e26756e5abdac2b8bb5 100644 (file)
@@ -76,9 +76,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;
@@ -86,13 +95,22 @@ public class EmployeePosition implements JobPosition {
 
                final JobPosition other = (JobPosition) object;
 
-               return Objects.equals(this.getJobPositionName(), other.getJobPositionName());
+               if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) {
+                       return false;
+               } else if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) {
+                       return false;
+               }
+
+               return true;
        }
 
        @Override
        public int hashCode () {
                int hash = 7;
+
+               hash = 37 * hash + Objects.hashCode(this.getJobPositionId());
                hash = 37 * hash + Objects.hashCode(this.getJobPositionName());
+
                return hash;
        }
 
@@ -128,4 +146,16 @@ 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;
+       }
+
 }
index e1ca67fd6fb6a74a0d8e3d9aaa0d95efdd26800b..bba1f09dd59d46c5657e05eae03603a127fc4026 100644 (file)
@@ -68,6 +68,20 @@ public interface JobPosition extends Serializable {
         */
        void setJobPositionCreated (final Calendar jobPositionCreated);
 
+       /**
+        * Getter for timestamp when this entry has been updated
+        * <p>
+        * @return Timestamp when this entry has been updated
+        */
+       Calendar getJobPositionUpdated ();
+
+       /**
+        * Setter for timestamp when this entry has been updated
+        * <p>
+        * @param jobPositionUpdated Timestamp when this entry has been updated
+        */
+       void setJobPositionUpdated (final Calendar jobPositionUpdated);
+
        @Override
        boolean equals (final Object object);