* @param addressbookUser Addressbook's user (owner)
*/
public void setAddressbookUser (final User addressbookUser);
+
+ @Override
+ public boolean equals (final Object object);
+
+ @Override
+ public int hashCode ();
}
package org.mxchange.addressbook.model.addressbook;
import java.util.Calendar;
+import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
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 Calendar getAddressbookCreated () {
return this.addressbookCreated;
public void setAddressbookUser (final User addressbookUser) {
this.addressbookUser = addressbookUser;
}
+
+ @Override
+ public int hashCode () {
+ int hash = 7;
+ hash = 59 * hash + Objects.hashCode(this.getAddressbookName());
+ hash = 59 * hash + Objects.hashCode(this.getAddressbookUser());
+ return hash;
+ }
}
*/
public void setAddressbookId (final Addressbook addressbookId);
+ @Override
+ public boolean equals (final Object object);
+
+ @Override
+ public int hashCode ();
}
package org.mxchange.addressbook.model.addressbook.entry;
import java.util.Calendar;
+import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
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 AddressbookEntry other = (AddressbookEntry) object;
+
+ if (!Objects.equals(this.getAddressbookEntryBusinessContact(), other.getAddressbookEntryBusinessContact())) {
+ return false;
+ } else if (!Objects.equals(this.getAddressbookEntryPrivateContact(), other.getAddressbookEntryPrivateContact())) {
+ return false;
+ } else if (!Objects.equals(this.getAddressbookEntryUserOwner(), other.getAddressbookEntryUserOwner())) {
+ return false;
+ } else if (!Objects.equals(this.getAddressbookEntryUserSharer(), other.getAddressbookEntryUserSharer())) {
+ return false;
+ } else if (!Objects.equals(this.getAddressbookId(), other.getAddressbookId())) {
+ return false;
+ }
+
+ return true;
+ }
+
@Override
public BusinessContact getAddressbookEntryBusinessContact () {
return this.addressbookEntryBusinessContact;
this.addressbookId = addressbookId;
}
+ @Override
+ public int hashCode () {
+ int hash = 3;
+ hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryBusinessContact());
+ hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryPrivateContact());
+ hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryUserOwner());
+ hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryUserSharer());
+ hash = 19 * hash + Objects.hashCode(this.getAddressbookId());
+ return hash;
+ }
+
}
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.model.addressbook.shared;
+
+import java.util.Objects;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import org.mxchange.addressbook.model.addressbook.Addressbook;
+import org.mxchange.addressbook.model.addressbook.UserAddressbook;
+import org.mxchange.jusercore.model.user.LoginUser;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJO for sharing address books with other users
+ * <p>
+ * @author Roland Haeder
+ */
+@Entity (name = "addressbook_shares")
+@Table (name = "addressbook_shares")
+public class AddressbookShare implements ShareableAddressbook, Comparable<ShareableAddressbook> {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 167_889_678_177_691_690L;
+
+ /**
+ * Id number
+ */
+ @Id
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ @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.ALL, optional = false)
+ private Addressbook shareAddressbook;
+
+ /**
+ * User who is giving the share (for his/her address book)
+ */
+ @JoinColumn (name = "share_owner_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.ALL, optional = false)
+ private User shareUserOwner;
+
+ /**
+ * User the address book is shared with
+ */
+ @JoinColumn (name = "share_sharee_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.ALL, optional = false)
+ private User shareUserSharee;
+
+ @Override
+ public int compareTo (final ShareableAddressbook share) {
+ 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 ShareableAddressbook other = (ShareableAddressbook) object;
+
+ if (!Objects.equals(this.getShareAddressbook(), other.getShareAddressbook())) {
+ return false;
+ } else if (!Objects.equals(this.getShareUserOwner(), other.getShareUserOwner())) {
+ return false;
+ } else if (!Objects.equals(this.getShareUserOwner(), other.getShareUserOwner())) {
+ return false;
+ }
+
+ return Objects.equals(this.getShareUserSharee(), other.getShareUserSharee());
+ }
+
+ @Override
+ public Addressbook getShareAddressbook () {
+ return this.shareAddressbook;
+ }
+
+ @Override
+ public void setShareAddressbook (final Addressbook shareAddressbook) {
+ this.shareAddressbook = shareAddressbook;
+ }
+
+ @Override
+ public Long getShareId () {
+ return this.shareId;
+ }
+
+ @Override
+ public void setShareId (final Long shareId) {
+ this.shareId = shareId;
+ }
+
+ @Override
+ public User getShareUserOwner () {
+ return this.shareUserOwner;
+ }
+
+ @Override
+ public void setShareUserOwner (final User shareUserOwner) {
+ this.shareUserOwner = shareUserOwner;
+ }
+
+ @Override
+ public User getShareUserSharee () {
+ return this.shareUserSharee;
+ }
+
+ @Override
+ public void setShareUserSharee (final User shareUserSharee) {
+ 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;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.model.addressbook.shared;
+
+import java.io.Serializable;
+import org.mxchange.addressbook.model.addressbook.Addressbook;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJI for shared address books
+ * <p>
+ * @author Roland Haeder
+ */
+public interface ShareableAddressbook extends Serializable {
+
+ /**
+ * Getter for shared address book instance
+ * <p>
+ * @return Shared address book instance
+ */
+ public Addressbook getShareAddressbook ();
+
+ /**
+ * Setter for shared address book instance
+ * <p>
+ * @param shareAddressbook Shared address book instance
+ */
+ public void setShareAddressbook (final Addressbook shareAddressbook);
+
+ /**
+ * Getter for id number
+ * <p>
+ * @return Id number
+ */
+ public Long getShareId ();
+
+ /**
+ * Setter for id number
+ * <p>
+ * @param shareId Id number
+ */
+ public void setShareId (final Long shareId);
+
+ /**
+ * Getter for address book owner instance
+ * <p>
+ * @return Address book owner instance
+ */
+ public User getShareUserOwner ();
+
+ /**
+ * Setter for address book owner instance
+ * <p>
+ * @param shareUserOwner Address book owner instance
+ */
+ public void setShareUserOwner (final User shareUserOwner);
+
+ /**
+ * Getter for address book sharee instance
+ * <p>
+ * @return Address book sharee instance
+ */
+ public User getShareUserSharee ();
+
+ /**
+ * Setter for address book sharee instance
+ * <p>
+ * @param shareUserSharer Address book sharee instance
+ */
+ public void setShareUserSharee (final User shareUserSharer);
+
+ @Override
+ public boolean equals (final Object object);
+
+ @Override
+ public int hashCode ();
+}