From: Roland Haeder Date: Thu, 22 Oct 2015 09:07:53 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1945319b008dbddab1fc1962b7403083efdef905;p=jaddressbook-share-lib.git Continued: - added timestamp when the address book has been locked and reason - added creation timestamp + user parameters to constructor - default status is UNLOCKED now - updated jar(s) Signed-off-by:Roland Häder --- diff --git a/lib/jcontacts-business-core.jar b/lib/jcontacts-business-core.jar index 0fe8af5..20fa374 100644 Binary files a/lib/jcontacts-business-core.jar and b/lib/jcontacts-business-core.jar differ diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar index 6b3619e..39ba8b2 100644 Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ diff --git a/lib/jcountry-core.jar b/lib/jcountry-core.jar index 234d3fb..28024ee 100644 Binary files a/lib/jcountry-core.jar and b/lib/jcountry-core.jar differ diff --git a/lib/jphone-core.jar b/lib/jphone-core.jar index a5d222b..e5c2573 100644 Binary files a/lib/jphone-core.jar and b/lib/jphone-core.jar differ diff --git a/lib/juser-core.jar b/lib/juser-core.jar index 250549b..1bd555d 100644 Binary files a/lib/juser-core.jar and b/lib/juser-core.jar differ diff --git a/src/org/mxchange/addressbook/model/addressbook/Addressbook.java b/src/org/mxchange/addressbook/model/addressbook/Addressbook.java index 536cdb8..f3e6693 100644 --- a/src/org/mxchange/addressbook/model/addressbook/Addressbook.java +++ b/src/org/mxchange/addressbook/model/addressbook/Addressbook.java @@ -98,9 +98,37 @@ public interface Addressbook extends Serializable { */ void setAddressbookUser (final User addressbookUser); + /** + * Getter for last locked timestamp + *

+ * @return Last locked timestamp + */ + Calendar getAddressbookLastLocked (); + + /** + * Setter for last locked timestamp + *

+ * @param addressbookLastLocked Last locked timestamp + */ + void setAddressbookLastLocked (final Calendar addressbookLastLocked); + + /** + * Getter for last locked reason + *

+ * @return Last locked reason + */ + String getAddressbookLastLockedReason (); + + /** + * Getter for last locked reason + *

+ * @param addressbookLastLockedReason Last locked reason + */ + void setAddressbookLastLockedReason (final String addressbookLastLockedReason); + @Override - boolean equals (final Object object); + boolean equals (final Object object); @Override - int hashCode (); + int hashCode (); } diff --git a/src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java b/src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java index 82dc36d..fe9a5c3 100644 --- a/src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java +++ b/src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java @@ -28,6 +28,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; +import javax.persistence.Lob; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToOne; @@ -97,47 +98,43 @@ public class UserAddressbook implements Addressbook, Comparable { @OneToOne (targetEntity = LoginUser.class, optional = false, cascade = CascadeType.MERGE) private User addressbookUser; + /** + * Last locked timestamp + */ + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "addressbook_last_locked") + private Calendar addressbookLastLocked; + + /** + * Last locked timestamp + */ + @Lob + @Column (name = "addressbook_last_locked_reason") + private String addressbookLastLockedReason; + /** * Public constructor with address book name *

* @param addressbookName Address book name + * @param addressbookUser User instance + * @param addressbookCreated When this entry has been created */ - public UserAddressbook (final String addressbookName) { + public UserAddressbook (final String addressbookName, final User addressbookUser, final Calendar addressbookCreated) { // Call default constructor this(); - // Set name + // Set name, user instance and creation timestamp this.addressbookName = addressbookName; + this.addressbookUser = addressbookUser; + this.addressbookCreated = addressbookCreated; } /** * Default protected constructor */ protected UserAddressbook () { - } - - @Override - public int compareTo (final Addressbook addressbook) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean equals (final Object object) { - if (object == null) { - return false; - } else if (getClass() != object.getClass()) { - return false; - } - - final Addressbook other = (Addressbook) object; - - if (!Objects.equals(this.getAddressbookName(), other.getAddressbookName())) { - return false; - } else if (!Objects.equals(this.getAddressbookUser(), other.getAddressbookUser())) { - return false; - } - - return true; + // Set status to UNLOCKED + this.addressbookStatus = AddressbokStatus.UNLOCKED; } @Override @@ -160,6 +157,26 @@ public class UserAddressbook implements Addressbook, Comparable { this.addressbookId = addressbookId; } + @Override + public Calendar getAddressbookLastLocked () { + return this.addressbookLastLocked; + } + + @Override + public void setAddressbookLastLocked (final Calendar addressbookLastLocked) { + this.addressbookLastLocked = addressbookLastLocked; + } + + @Override + public String getAddressbookLastLockedReason () { + return this.addressbookLastLockedReason; + } + + @Override + public void setAddressbookLastLockedReason (final String addressbookLastLockedReason) { + this.addressbookLastLockedReason = addressbookLastLockedReason; + } + @Override public String getAddressbookName () { return this.addressbookName; @@ -190,6 +207,30 @@ public class UserAddressbook implements Addressbook, Comparable { this.addressbookUser = addressbookUser; } + @Override + public int compareTo (final Addressbook addressbook) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public boolean equals (final Object object) { + if (object == null) { + return false; + } else if (getClass() != object.getClass()) { + return false; + } + + final Addressbook other = (Addressbook) object; + + if (!Objects.equals(this.getAddressbookName(), other.getAddressbookName())) { + return false; + } else if (!Objects.equals(this.getAddressbookUser(), other.getAddressbookUser())) { + return false; + } + + return true; + } + @Override public int hashCode () { int hash = 7;