From a8d1618e201f665b848d8c70d5e849f56d2c521d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 9 May 2016 13:22:54 +0200 Subject: [PATCH] added updated timestamp --- .../jobposition/EmployeePosition.java | 34 +++++++++++++++++-- .../jobposition/JobPosition.java | 14 ++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java b/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java index 2a0bef4..71e6e87 100644 --- a/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java +++ b/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java @@ -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; + } + } diff --git a/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java b/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java index e1ca67f..bba1f09 100644 --- a/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java +++ b/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java @@ -68,6 +68,20 @@ public interface JobPosition extends Serializable { */ void setJobPositionCreated (final Calendar jobPositionCreated); + /** + * Getter for timestamp when this entry has been updated + *

+ * @return Timestamp when this entry has been updated + */ + Calendar getJobPositionUpdated (); + + /** + * Setter for timestamp when this entry has been updated + *

+ * @param jobPositionUpdated Timestamp when this entry has been updated + */ + void setJobPositionUpdated (final Calendar jobPositionUpdated); + @Override boolean equals (final Object object); -- 2.39.5