From: Roland Häder Date: Mon, 9 May 2016 11:22:54 +0000 (+0200) Subject: added updated timestamp X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a8d1618e201f665b848d8c70d5e849f56d2c521d;p=jcontacts-business-core.git added updated timestamp --- 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);