*/
private static final long serialVersionUID = 167_889_678_177_691_690L;
+ /**
+ * Address book this share is for
+ */
+ @JoinColumn (name = "share_addressbook_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.MERGE, optional = false)
+ private Addressbook shareAddressbook;
+
+ /**
+ * When this share has been created
+ */
+ @Basic (optional = false)
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "share_created", nullable = false, updatable = false)
+ private Calendar shareCreated;
+
/**
* Id number
*/
@Column (name = "share_id", length = 20, nullable = false, updatable = false)
private Long shareId;
- /**
- * Address book this share is for
- */
- @JoinColumn (name = "share_addressbook_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.MERGE, optional = false)
- private Addressbook shareAddressbook;
-
/**
* User who is owning the share
*/
@OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.MERGE, 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
- */
- protected AddressbookShare () {
- }
-
/**
* Constructor with address book and sharee instance. Both parameters must
* not be null, their id numbers must be set and the adress book's user
this.shareCreated = new GregorianCalendar();
}
+ /**
+ * Default constructor for entity manager
+ */
+ protected AddressbookShare () {
+ }
+
@Override
public int compareTo (final ShareableAddressbook share) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
public boolean equals (final Object object) {
if (object == null) {
return false;
- } else if (getClass() != object.getClass()) {
+ } else if (this.getClass() != object.getClass()) {
return false;
}
return Objects.equals(this.getShareUserSharee(), other.getShareUserSharee());
}
+ @Override
+ public int hashCode () {
+ int hash = 7;
+ hash = 19 * hash + Objects.hashCode(this.getShareAddressbook());
+ hash = 19 * hash + Objects.hashCode(this.getShareUserOwner());
+ hash = 19 * hash + Objects.hashCode(this.getShareUserSharee());
+ return hash;
+ }
+
@Override
public Addressbook getShareAddressbook () {
return this.shareAddressbook;
this.shareUserSharee = shareUserSharee;
}
- @Override
- public int hashCode () {
- int hash = 7;
- hash = 19 * hash + Objects.hashCode(this.getShareAddressbook());
- hash = 19 * hash + Objects.hashCode(this.getShareUserOwner());
- hash = 19 * hash + Objects.hashCode(this.getShareUserSharee());
- return hash;
- }
}