]> git.mxchange.org Git - addressbook-lib.git/commitdiff
added share creation timestamp
authorRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 08:46:00 +0000 (10:46 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 08:46:00 +0000 (10:46 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/addressbook/model/addressbook/shared/AddressbookShare.java
src/org/mxchange/addressbook/model/addressbook/shared/ShareableAddressbook.java

index 5dc3aab3841e99942a06a62a2ddebd98cfaf2b50..c7bef74c1e373380dfaa5012d439e1a3544135ea 100644 (file)
@@ -17,7 +17,9 @@
 package org.mxchange.addressbook.model.addressbook.shared;
 
 import java.text.MessageFormat;
+import java.util.Calendar;
 import java.util.Objects;
+import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -28,6 +30,8 @@ import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
 import org.mxchange.addressbook.model.addressbook.Addressbook;
 import org.mxchange.addressbook.model.addressbook.UserAddressbook;
 import org.mxchange.jusercore.model.user.LoginUser;
@@ -88,6 +92,14 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
        @OneToOne (targetEntity = LoginUser.class, optional = false)
        private User shareUserSharee;
 
+       /**
+        * When this share has been created
+        */
+       @Basic (optional = false)
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "share_created", nullable = false, updatable = false)
+       private Calendar shareCreated;
+
        /**
         * Default constructor for entity manager
         */
@@ -172,6 +184,16 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
                this.shareAddressbook = shareAddressbook;
        }
 
+       @Override
+       public Calendar getShareCreated () {
+               return this.shareCreated;
+       }
+
+       @Override
+       public void setShareCreated (final Calendar shareCreated) {
+               this.shareCreated = shareCreated;
+       }
+
        @Override
        public Long getShareId () {
                return this.shareId;
index bb56c4d4b47b429dc042467c8479b0394f795760..b2ca5ba8c1e730e71604274b0e983d74e8c857a6 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.model.addressbook.shared;
 
 import java.io.Serializable;
+import java.util.Calendar;
 import org.mxchange.addressbook.model.addressbook.Addressbook;
 import org.mxchange.jusercore.model.user.User;
 
@@ -83,9 +84,23 @@ public interface ShareableAddressbook extends Serializable {
         */
        void setShareUserSharee (final User shareUserSharer);
 
+       /**
+        * Getter for share creation timestamp
+        * <p>
+        * @return Share creation timestamp
+        */
+       Calendar getShareCreated ();
+
+       /**
+        * Setter for share creation timestamp
+        * <p>
+        * @param shareCreated Share creation timestamp
+        */
+       void setShareCreated (final Calendar shareCreated);
+
        @Override
-        boolean equals (final Object object);
+       boolean equals (final Object object);
 
        @Override
-        int hashCode ();
+       int hashCode ();
 }