*/
void setAddressbookUser (final User addressbookUser);
+ /**
+ * Getter for last locked timestamp
+ * <p>
+ * @return Last locked timestamp
+ */
+ Calendar getAddressbookLastLocked ();
+
+ /**
+ * Setter for last locked timestamp
+ * <p>
+ * @param addressbookLastLocked Last locked timestamp
+ */
+ void setAddressbookLastLocked (final Calendar addressbookLastLocked);
+
+ /**
+ * Getter for last locked reason
+ * <p>
+ * @return Last locked reason
+ */
+ String getAddressbookLastLockedReason ();
+
+ /**
+ * Getter for last locked reason
+ * <p>
+ * @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 ();
}
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;
@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
* <p>
* @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
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;
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;