From 5692baf6ecb7546a5720d5f7b1f65ed546a350b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 26 Apr 2020 20:11:44 +0200 Subject: [PATCH] Continued: - renamed customerCreated to customerEntryCreated - renamed customerUpdated to customerEntryUpdated - need to check all entity properties in equals()/hashCode() methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/customer/ContactCustomer.java | 67 ++++++++++++------- .../model/customer/Customer.java | 12 ++-- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java b/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java index 6b95a61..4372510 100644 --- a/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java +++ b/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java @@ -84,9 +84,16 @@ public class ContactCustomer implements Customer { * When this customer has been created */ @Basic (optional = false) - @Column (name = "customer_created", nullable = false, updatable = false) + @Column (name = "customer_entry_created", updatable = false, nullable = false) @Temporal (TemporalType.TIMESTAMP) - private Date customerCreated; + private Date customerEntryCreated; + + /** + * When this customer has been updated + */ + @Column (name = "customer_entry_updated") + @Temporal (TemporalType.TIMESTAMP) + private Date customerEntryUpdated; /** * Id number for this entry @@ -117,13 +124,6 @@ public class ContactCustomer implements Customer { @Column (name = "customer_number", nullable = false, updatable = false, unique = true) private String customerNumber; - /** - * When this customer has been updated - */ - @Column (name = "customer_updated") - @Temporal (TemporalType.TIMESTAMP) - private Date customerUpdated; - /** * Default constructor */ @@ -203,12 +203,22 @@ public class ContactCustomer implements Customer { final Customer other = (Customer) object; - if (!Objects.equals(this.getCustomerNumber(), other.getCustomerNumber())) { + if (!Objects.equals(this.getCustomerAccountStatus(), other.getCustomerAccountStatus())) { + return false; + } else if (!Objects.equals(this.getCustomerConfirmKey(), other.getCustomerConfirmKey())) { return false; } else if (!Objects.equals(this.getCustomerContact(), other.getCustomerContact())) { return false; } else if (!Objects.equals(this.getCustomerId(), other.getCustomerId())) { return false; + } else if (!Objects.equals(this.getCustomerLastLocked(), other.getCustomerLastLocked())) { + return false; + } else if (!Objects.equals(this.getCustomerLastLockedReason(), other.getCustomerLastLockedReason())) { + return false; + } else if (!Objects.equals(this.getCustomerNumber(), other.getCustomerNumber())) { + return false; + } else if (!Objects.equals(this.getCustomerPasswordHash(), other.getCustomerPasswordHash())) { + return false; } return true; @@ -246,14 +256,26 @@ public class ContactCustomer implements Customer { @Override @SuppressWarnings ("ReturnOfDateField") - public Date getCustomerCreated () { - return this.customerCreated; + public Date getCustomerEntryCreated () { + return this.customerEntryCreated; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setCustomerCreated (final Date customerCreated) { - this.customerCreated = customerCreated; + public void setCustomerEntryCreated (final Date customerEntryCreated) { + this.customerEntryCreated = customerEntryCreated; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Date getCustomerEntryUpdated () { + return this.customerEntryUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setCustomerEntryUpdated (final Date customerEntryUpdated) { + this.customerEntryUpdated = customerEntryUpdated; } @Override @@ -308,25 +330,18 @@ public class ContactCustomer implements Customer { throw new UnsupportedOperationException("Unfinished"); //NOI18N } - @Override - @SuppressWarnings ("ReturnOfDateField") - public Date getCustomerUpdated () { - return this.customerUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setCustomerUpdated (final Date customerUpdated) { - this.customerUpdated = customerUpdated; - } - @Override public int hashCode () { int hash = 7; + hash = 53 * hash + Objects.hashCode(this.getCustomerAccountStatus()); + hash = 53 * hash + Objects.hashCode(this.getCustomerConfirmKey()); hash = 53 * hash + Objects.hashCode(this.getCustomerContact()); hash = 53 * hash + Objects.hashCode(this.getCustomerId()); + hash = 53 * hash + Objects.hashCode(this.getCustomerLastLocked()); + hash = 53 * hash + Objects.hashCode(this.getCustomerLastLockedReason()); hash = 53 * hash + Objects.hashCode(this.getCustomerNumber()); + hash = 53 * hash + Objects.hashCode(this.getCustomerPasswordHash()); return hash; } diff --git a/src/org/mxchange/jcustomercore/model/customer/Customer.java b/src/org/mxchange/jcustomercore/model/customer/Customer.java index 1a9a0ef..97ac291 100644 --- a/src/org/mxchange/jcustomercore/model/customer/Customer.java +++ b/src/org/mxchange/jcustomercore/model/customer/Customer.java @@ -61,28 +61,28 @@ public interface Customer extends Comparable, Serializable { *

* @return "created" timestamp */ - Date getCustomerCreated (); + Date getCustomerEntryCreated (); /** * Setter for "created" timestamp *

- * @param customerCreated "created" timestamp + * @param customerEntryCreated "created" timestamp */ - void setCustomerCreated (final Date customerCreated); + void setCustomerEntryCreated (final Date customerEntryCreated); /** * Getter for "updated" timestamp *

* @return "updated" timestamp */ - Date getCustomerUpdated (); + Date getCustomerEntryUpdated (); /** * Setter for "updated" timestamp *

- * @param customerUpdated "updated" timestamp + * @param customerEntryUpdated "updated" timestamp */ - void setCustomerUpdated (final Date customerUpdated); + void setCustomerEntryUpdated (final Date customerEntryUpdated); /** * Getter for customer id number -- 2.39.5