]> git.mxchange.org Git - jaddressbook-share-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 26 Apr 2020 16:23:55 +0000 (18:23 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 26 Apr 2020 16:23:55 +0000 (18:23 +0200)
- compare all (except timestamps) properties of entities, again including
  primary key
- added "updated" timestamp

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jaddressbookshare/model/addressbook/shared/AddressbookShare.java
src/org/mxchange/jaddressbookshare/model/addressbook/shared/ShareableAddressbook.java

index fa509dd6c4d011bd413409e47c3e8255984c2874..5c9fda4bca9cd6c96984cbccc416eb950148a785 100644 (file)
@@ -80,8 +80,15 @@ public class AddressbookShare implements ShareableAddressbook {
         */
        @Basic (optional = false)
        @Temporal (TemporalType.TIMESTAMP)
-       @Column (name = "share_created", nullable = false, updatable = false)
-       private Date shareCreated;
+       @Column (name = "share_entry_created", updatable = false, nullable = false)
+       private Date shareEntryCreated;
+
+       /**
+        * When this share has been updated
+        */
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "share_entry_updated", insertable = false, nullable = false)
+       private Date shareEntryUpdated;
 
        /**
         * Id number
@@ -171,8 +178,7 @@ public class AddressbookShare implements ShareableAddressbook {
                        // ... next sharer
                        this.getShareUserOwner().compareTo(shareableAddressbook.getShareUserOwner()),
                        // ... next sharee
-                       this.getShareUserSharee().compareTo(shareableAddressbook.getShareUserSharee()),
-               };
+                       this.getShareUserSharee().compareTo(shareableAddressbook.getShareUserSharee()),};
 
                // Check all values
                final int comparison = Comparables.checkAll(comparators);
@@ -193,10 +199,12 @@ public class AddressbookShare implements ShareableAddressbook {
 
                if (!Objects.equals(this.getShareAddressbook(), other.getShareAddressbook())) {
                        return false;
-               } else if (!Objects.equals(this.getShareUserOwner(), other.getShareUserOwner())) {
+               } else if (!Objects.equals(this.getShareId(), other.getShareId())) {
                        return false;
                } else if (!Objects.equals(this.getShareUserOwner(), other.getShareUserOwner())) {
                        return false;
+               } else if (!Objects.equals(this.getShareUserSharee(), other.getShareUserSharee())) {
+                       return false;
                }
 
                return Objects.equals(this.getShareUserSharee(), other.getShareUserSharee());
@@ -214,14 +222,26 @@ public class AddressbookShare implements ShareableAddressbook {
 
        @Override
        @SuppressWarnings ("ReturnOfDateField")
-       public Date getShareCreated () {
-               return this.shareCreated;
+       public Date getShareEntryCreated () {
+               return this.shareEntryCreated;
+       }
+
+       @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       public void setShareEntryCreated (final Date shareEntryCreated) {
+               this.shareEntryCreated = shareEntryCreated;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfDateField")
+       public Date getShareEntryUpdated () {
+               return this.shareEntryUpdated;
        }
 
        @Override
        @SuppressWarnings ("AssignmentToDateFieldFromParameter")
-       public void setShareCreated (final Date shareCreated) {
-               this.shareCreated = shareCreated;
+       public void setShareEntryUpdated (final Date shareEntryUpdated) {
+               this.shareEntryUpdated = shareEntryUpdated;
        }
 
        @Override
@@ -259,6 +279,7 @@ public class AddressbookShare implements ShareableAddressbook {
                int hash = 7;
 
                hash = 19 * hash + Objects.hashCode(this.getShareAddressbook());
+               hash = 19 * hash + Objects.hashCode(this.getShareId());
                hash = 19 * hash + Objects.hashCode(this.getShareUserOwner());
                hash = 19 * hash + Objects.hashCode(this.getShareUserSharee());
 
index 9f85bd0a6a04801dacac3b26dce59b9500948831..3fb51bbd224e39fa15ec8d20d0412892b2c8daa2 100644 (file)
@@ -85,18 +85,32 @@ public interface ShareableAddressbook extends Comparable<ShareableAddressbook>,
        void setShareUserSharee (final User shareUserSharer);
 
        /**
-        * Getter for share creation timestamp
+        * Getter for share created timestamp
         * <p>
-        * @return Share creation timestamp
+        * @return Share created timestamp
         */
-       Date getShareCreated ();
+       Date getShareEntryCreated ();
 
        /**
-        * Setter for share creation timestamp
+        * Setter for share created timestamp
         * <p>
-        * @param shareCreated Share creation timestamp
+        * @param shareCreated Share created timestamp
         */
-       void setShareCreated (final Date shareCreated);
+       void setShareEntryCreated (final Date shareCreated);
+
+       /**
+        * Getter for share updated timestamp
+        * <p>
+        * @return Share updated timestamp
+        */
+       Date getShareEntryUpdated ();
+
+       /**
+        * Setter for share updated timestamp
+        * <p>
+        * @param shareUpdated Share updated timestamp
+        */
+       void setShareEntryUpdated (final Date shareUpdated);
 
        @Override
        boolean equals (final Object object);