-/*\r
- * Copyright (C) 2016, 2017 Roland Häder\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package org.mxchange.jcontacts.contact;\r
-\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.Objects;\r
-import javax.persistence.Basic;\r
-import javax.persistence.CascadeType;\r
-import javax.persistence.Column;\r
-import javax.persistence.Entity;\r
-import javax.persistence.EnumType;\r
-import javax.persistence.Enumerated;\r
-import javax.persistence.GeneratedValue;\r
-import javax.persistence.GenerationType;\r
-import javax.persistence.Id;\r
-import javax.persistence.Index;\r
-import javax.persistence.JoinColumn;\r
-import javax.persistence.Lob;\r
-import javax.persistence.NamedQueries;\r
-import javax.persistence.NamedQuery;\r
-import javax.persistence.OneToOne;\r
-import javax.persistence.Table;\r
-import javax.persistence.Temporal;\r
-import javax.persistence.TemporalType;\r
-import javax.persistence.Transient;\r
-import org.mxchange.jcontacts.contact.title.PersonalTitle;\r
-import org.mxchange.jcountry.data.Country;\r
-import org.mxchange.jcountry.data.CountryData;\r
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;\r
-import org.mxchange.jphone.phonenumbers.fax.FaxNumber;\r
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;\r
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;\r
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;\r
-import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;\r
-\r
-/**\r
- * A general contact class which serves as an entity.\r
- * <p>\r
- * @author Roland Häder<roland@mxchange.org>\r
- * @version 0.0\r
- */\r
-@Entity (name = "contacts")\r
-@Table (\r
- name = "contacts",\r
- indexes = {\r
- @Index (\r
- name = "contact_personal_title",\r
- columnList = "contact_personal_title"\r
- )\r
- }\r
-)\r
-@NamedQueries (\r
- {\r
- @NamedQuery (name = "AllContacts", query = "SELECT c FROM contacts AS c ORDER BY c.contactId ASC"),\r
- @NamedQuery (name = "AllContactEmailAddresses", query = "SELECT c.contactEmailAddress FROM contacts AS c ORDER BY c.contactId ASC"),\r
- @NamedQuery (name = "AllContactsByCellphone", query = "SELECT c FROM contacts AS c WHERE c.contactMobileNumber = :mobileNumber ORDER BY c.contactId ASC"),\r
- @NamedQuery (name = "SearchContactById", query = "SELECT c FROM contacts AS c WHERE c.contactId = :contactId"),\r
- @NamedQuery (name = "SearchContactByEmailAddress", query = "SELECT c FROM contacts AS c WHERE LOWER(c.contactEmailAddress) LIKE LOWER(:emailAddress)")\r
- }\r
-)\r
-@SuppressWarnings ("PersistenceUnitPresent")\r
-public class UserContact implements Contact {\r
-\r
- /**\r
- * Serial number\r
- */\r
- @Transient\r
- private static final long serialVersionUID = 58_744_284_981_863L;\r
-\r
- /**\r
- * Birth day\r
- */\r
- @Column (name = "contact_birthday")\r
- @Temporal (TemporalType.DATE)\r
- private Date contactBirthday;\r
-\r
- /**\r
- * City\r
- */\r
- @Column (name = "contact_city", length = 100)\r
- private String contactCity;\r
-\r
- /**\r
- * Optional comments\r
- */\r
- @Lob\r
- @Column (name = "contact_comment")\r
- private String contactComment;\r
-\r
- /**\r
- * Country code\r
- */\r
- @JoinColumn (name = "contact_country_id", nullable = false, referencedColumnName = "country_id")\r
- @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)\r
- private Country contactCountry;\r
-\r
- /**\r
- * When the contact has been created\r
- */\r
- @Basic (optional = false)\r
- @Temporal (TemporalType.TIMESTAMP)\r
- @Column (name = "contact_created", nullable = false)\r
- private Calendar contactCreated;\r
-\r
- /**\r
- * Email address\r
- */\r
- @Column (name = "contact_email_address", length = 100, unique = true)\r
- private String contactEmailAddress;\r
-\r
- /**\r
- * Family name\r
- */\r
- @Basic (optional = false)\r
- @Column (name = "contact_family_name", length = 100, nullable = false)\r
- private String contactFamilyName;\r
-\r
- /**\r
- * Fax number\r
- */\r
- @JoinColumn (name = "contact_fax_number_id", referencedColumnName = "fax_id", unique = true)\r
- @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)\r
- private DialableFaxNumber contactFaxNumber;\r
-\r
- /**\r
- * First name\r
- */\r
- @Basic (optional = false)\r
- @Column (name = "contact_first_name", length = 100, nullable = false)\r
- private String contactFirstName;\r
-\r
- /**\r
- * House number\r
- */\r
- @Column (name = "contact_house_number")\r
- private Short contactHouseNumber;\r
-\r
- /**\r
- * House number extension\r
- */\r
- @Column (name = "contact_house_number_extension", length = 5)\r
- private String contactHouseNumberExtension;\r
-\r
- /**\r
- * Id number\r
- */\r
- @Id\r
- @GeneratedValue (strategy = GenerationType.IDENTITY)\r
- @Column (name = "contact_id", nullable = false, updatable = false)\r
- private Long contactId;\r
-\r
- /**\r
- * Cellphone number\r
- */\r
- @JoinColumn (name = "contact_mobile_number_id", referencedColumnName = "mobile_id", unique = true)\r
- @OneToOne (targetEntity = MobileNumber.class, cascade = CascadeType.ALL)\r
- private DialableMobileNumber contactMobileNumber;\r
-\r
- /**\r
- * Flag whether this contact is user's own data\r
- */\r
- @Basic (optional = false)\r
- @Column (name = "contact_own_contact", nullable = false)\r
- private Boolean contactOwnContact;\r
-\r
- /**\r
- * Contact's personal title (Mr./Mrs.)\r
- */\r
- @Basic (optional = false)\r
- @Column (name = "contact_personal_title", nullable = false)\r
- @Enumerated (EnumType.STRING)\r
- private PersonalTitle contactPersonalTitle;\r
-\r
- /**\r
- * Phone number\r
- */\r
- @JoinColumn (name = "contact_landline_number_id", referencedColumnName = "landline_id", unique = true)\r
- @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)\r
- private DialableLandLineNumber contactPhoneNumber;\r
-\r
- /**\r
- * Street\r
- */\r
- @Column (name = "contact_street")\r
- private String contactStreet;\r
-\r
- /**\r
- * Title (Doctor, etc)\r
- */\r
- @Column (name = "contact_title")\r
- private String contactTitle;\r
-\r
- /**\r
- * When the contact has been updated\r
- */\r
- @Temporal (TemporalType.TIMESTAMP)\r
- @Column (name = "contact_updated")\r
- private Calendar contactUpdated;\r
-\r
- /**\r
- * ZIP code\r
- */\r
- @Column (name = "contact_zip_code")\r
- private Integer contactZipCode;\r
-\r
- /**\r
- * Default constructor\r
- */\r
- public UserContact () {\r
- // Default is not user's own contact\r
- this.contactOwnContact = Boolean.FALSE;\r
- }\r
-\r
- /**\r
- * Constructor for title and names\r
- * <p>\r
- * @param contactTitle Personal title\r
- * @param contactFirstName First name\r
- * @param contactFamilyName Family name\r
- */\r
- public UserContact (final PersonalTitle contactTitle, final String contactFirstName, final String contactFamilyName) {\r
- // Call default constructor\r
- this();\r
-\r
- // Set all\r
- this.contactPersonalTitle = contactTitle;\r
- this.contactFirstName = contactFirstName;\r
- this.contactFamilyName = contactFamilyName;\r
- }\r
-\r
- @Override\r
- public boolean equals (final Object object) {\r
- if (this == object) {\r
- return true;\r
- } else if (null == object) {\r
- return false;\r
- } else if (this.getClass() != object.getClass()) {\r
- return false;\r
- } else if (!(object instanceof Contact)) {\r
- // Not correct interface\r
- return false;\r
- }\r
-\r
- final Contact other = (Contact) object;\r
-\r
- if (!Objects.equals(this.getContactId(), other.getContactId())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactCity(), other.getContactCity())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactEmailAddress(), other.getContactEmailAddress())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactFamilyName(), other.getContactFamilyName())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactFirstName(), other.getContactFirstName())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactStreet(), other.getContactStreet())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactTitle(), other.getContactTitle())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactBirthday(), other.getContactBirthday())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactCountry(), other.getContactCountry())) {\r
- return false;\r
- } else if (this.getContactPersonalTitle() != other.getContactPersonalTitle()) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactHouseNumber(), other.getContactHouseNumber())) {\r
- return false;\r
- } else if (!Objects.equals(this.getContactHouseNumberExtension(), other.getContactHouseNumberExtension())) {\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- @Override\r
- @SuppressWarnings ("ReturnOfDateField")\r
- public Date getContactBirthday () {\r
- return this.contactBirthday;\r
- }\r
-\r
- @Override\r
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")\r
- public void setContactBirthday (final Date contactBirthday) {\r
- this.contactBirthday = contactBirthday;\r
- }\r
-\r
- @Override\r
- public String getContactCity () {\r
- return this.contactCity;\r
- }\r
-\r
- @Override\r
- public void setContactCity (final String contactCity) {\r
- this.contactCity = contactCity;\r
- }\r
-\r
- @Override\r
- public String getContactComment () {\r
- return this.contactComment;\r
- }\r
-\r
- @Override\r
- public void setContactComment (final String contactComment) {\r
- this.contactComment = contactComment;\r
- }\r
-\r
- @Override\r
- public Country getContactCountry () {\r
- return this.contactCountry;\r
- }\r
-\r
- @Override\r
- public void setContactCountry (final Country contactCountry) {\r
- this.contactCountry = contactCountry;\r
- }\r
-\r
- @Override\r
- @SuppressWarnings ("ReturnOfDateField")\r
- public Calendar getContactCreated () {\r
- return this.contactCreated;\r
- }\r
-\r
- @Override\r
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")\r
- public void setContactCreated (final Calendar contactCreated) {\r
- this.contactCreated = contactCreated;\r
- }\r
-\r
- @Override\r
- public String getContactEmailAddress () {\r
- return this.contactEmailAddress;\r
- }\r
-\r
- @Override\r
- public void setContactEmailAddress (final String contactEmailAddress) {\r
- this.contactEmailAddress = contactEmailAddress;\r
- }\r
-\r
- @Override\r
- public String getContactFamilyName () {\r
- //* NOISY-DEBUG: */ this.getLogger().logTrace("CALLED!");\r
- return this.contactFamilyName;\r
- }\r
-\r
- @Override\r
- public void setContactFamilyName (final String contactFamilyName) {\r
- this.contactFamilyName = contactFamilyName;\r
- }\r
-\r
- @Override\r
- public DialableFaxNumber getContactFaxNumber () {\r
- return this.contactFaxNumber;\r
- }\r
-\r
- @Override\r
- public void setContactFaxNumber (final DialableFaxNumber contactFaxNumber) {\r
- this.contactFaxNumber = contactFaxNumber;\r
- }\r
-\r
- @Override\r
- public String getContactFirstName () {\r
- return this.contactFirstName;\r
- }\r
-\r
- @Override\r
- public void setContactFirstName (final String contactFirstName) {\r
- this.contactFirstName = contactFirstName;\r
- }\r
-\r
- @Override\r
- public Short getContactHouseNumber () {\r
- return this.contactHouseNumber;\r
- }\r
-\r
- @Override\r
- public void setContactHouseNumber (final Short contactHouseNumber) {\r
- this.contactHouseNumber = contactHouseNumber;\r
- }\r
-\r
- @Override\r
- public String getContactHouseNumberExtension () {\r
- return this.contactHouseNumberExtension;\r
- }\r
-\r
- @Override\r
- public void setContactHouseNumberExtension (final String contactHouseNumberExtension) {\r
- this.contactHouseNumberExtension = contactHouseNumberExtension;\r
- }\r
-\r
- @Override\r
- public Long getContactId () {\r
- return this.contactId;\r
- }\r
-\r
- @Override\r
- public void setContactId (final Long contactId) {\r
- this.contactId = contactId;\r
- }\r
-\r
- @Override\r
- public DialableLandLineNumber getContactLandLineNumber () {\r
- return this.contactPhoneNumber;\r
- }\r
-\r
- @Override\r
- public void setContactLandLineNumber (final DialableLandLineNumber contactPhoneNumber) {\r
- this.contactPhoneNumber = contactPhoneNumber;\r
- }\r
-\r
- @Override\r
- public DialableMobileNumber getContactMobileNumber () {\r
- return this.contactMobileNumber;\r
- }\r
-\r
- @Override\r
- public void setContactMobileNumber (final DialableMobileNumber contactMobileNumber) {\r
- this.contactMobileNumber = contactMobileNumber;\r
- }\r
-\r
- @Override\r
- public void setContactOwnContact (final Boolean contactOwnContact) {\r
- this.contactOwnContact = contactOwnContact;\r
- }\r
-\r
- @Override\r
- public PersonalTitle getContactPersonalTitle () {\r
- return this.contactPersonalTitle;\r
- }\r
-\r
- @Override\r
- public void setContactPersonalTitle (final PersonalTitle contactPersonalTitle) {\r
- this.contactPersonalTitle = contactPersonalTitle;\r
- }\r
-\r
- @Override\r
- public String getContactStreet () {\r
- return this.contactStreet;\r
- }\r
-\r
- @Override\r
- public void setContactStreet (final String contactStreet) {\r
- this.contactStreet = contactStreet;\r
- }\r
-\r
- @Override\r
- public String getContactTitle () {\r
- return this.contactTitle;\r
- }\r
-\r
- @Override\r
- public void setContactTitle (final String contactTitle) {\r
- this.contactTitle = contactTitle;\r
- }\r
-\r
- @Override\r
- @SuppressWarnings ("ReturnOfDateField")\r
- public Calendar getContactUpdated () {\r
- return this.contactUpdated;\r
- }\r
-\r
- @Override\r
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")\r
- public void setContactUpdated (final Calendar contactUpdated) {\r
- this.contactUpdated = contactUpdated;\r
- }\r
-\r
- @Override\r
- public Integer getContactZipCode () {\r
- return this.contactZipCode;\r
- }\r
-\r
- @Override\r
- public void setContactZipCode (final Integer contactZipCode) {\r
- this.contactZipCode = contactZipCode;\r
- }\r
-\r
- @Override\r
- public int hashCode () {\r
- int hash = 5;\r
-\r
- hash = 29 * hash + Objects.hashCode(this.getContactBirthday());\r
- hash = 29 * hash + Objects.hashCode(this.getContactCity());\r
- hash = 29 * hash + Objects.hashCode(this.getContactCountry());\r
- hash = 29 * hash + Objects.hashCode(this.getContactEmailAddress());\r
- hash = 29 * hash + Objects.hashCode(this.getContactFamilyName());\r
- hash = 29 * hash + Objects.hashCode(this.getContactFirstName());\r
- hash = 29 * hash + Objects.hashCode(this.getContactPersonalTitle());\r
- hash = 29 * hash + Objects.hashCode(this.getContactHouseNumber());\r
- hash = 29 * hash + Objects.hashCode(this.getContactHouseNumberExtension());\r
- hash = 29 * hash + Objects.hashCode(this.getContactId());\r
- hash = 29 * hash + Objects.hashCode(this.getContactStreet());\r
- hash = 29 * hash + Objects.hashCode(this.getContactTitle());\r
-\r
- return hash;\r
- }\r
-\r
- @Override\r
- public Boolean isOwnContact () {\r
- return this.contactOwnContact;\r
- }\r
-\r
-}\r
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * 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.jcontacts.contact;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Objects;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+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 javax.persistence.Transient;
+import org.mxchange.jcontacts.contact.title.PersonalTitle;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
+
+/**
+ * A general contact class which serves as an entity.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ * @version 0.0
+ */
+@Entity (name = "contacts")
+@Table (
+ name = "contacts",
+ indexes = {
+ @Index (
+ name = "contact_personal_title",
+ columnList = "contact_personal_title"
+ )
+ }
+)
+@NamedQueries (
+ {
+ @NamedQuery (name = "AllContacts", query = "SELECT c FROM contacts AS c ORDER BY c.contactId ASC"),
+ @NamedQuery (name = "AllContactEmailAddresses", query = "SELECT c.contactEmailAddress FROM contacts AS c ORDER BY c.contactId ASC"),
+ @NamedQuery (name = "AllContactsByCellphone", query = "SELECT c FROM contacts AS c WHERE c.contactMobileNumber = :mobileNumber ORDER BY c.contactId ASC"),
+ @NamedQuery (name = "SearchContactById", query = "SELECT c FROM contacts AS c WHERE c.contactId = :contactId"),
+ @NamedQuery (name = "SearchContactByEmailAddress", query = "SELECT c FROM contacts AS c WHERE LOWER(c.contactEmailAddress) LIKE LOWER(:emailAddress)")
+ }
+)
+@SuppressWarnings ("PersistenceUnitPresent")
+public class UserContact implements Contact {
+
+ /**
+ * Serial number
+ */
+ @Transient
+ private static final long serialVersionUID = 58_744_284_981_863L;
+
+ /**
+ * Birth day
+ */
+ @Column (name = "contact_birthday")
+ @Temporal (TemporalType.DATE)
+ private Date contactBirthday;
+
+ /**
+ * City
+ */
+ @Column (name = "contact_city", length = 100)
+ private String contactCity;
+
+ /**
+ * Optional comments
+ */
+ @Lob
+ @Column (name = "contact_comment")
+ private String contactComment;
+
+ /**
+ * Country code
+ */
+ @JoinColumn (name = "contact_country_id", nullable = false, referencedColumnName = "country_id")
+ @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false)
+ private Country contactCountry;
+
+ /**
+ * When the contact has been created
+ */
+ @Basic (optional = false)
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "contact_created", nullable = false)
+ private Calendar contactCreated;
+
+ /**
+ * Email address
+ */
+ @Column (name = "contact_email_address", length = 100, unique = true)
+ private String contactEmailAddress;
+
+ /**
+ * Family name
+ */
+ @Basic (optional = false)
+ @Column (name = "contact_family_name", length = 100, nullable = false)
+ private String contactFamilyName;
+
+ /**
+ * Fax number
+ */
+ @JoinColumn (name = "contact_fax_number_id", referencedColumnName = "fax_id", unique = true)
+ @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
+ private DialableFaxNumber contactFaxNumber;
+
+ /**
+ * First name
+ */
+ @Basic (optional = false)
+ @Column (name = "contact_first_name", length = 100, nullable = false)
+ private String contactFirstName;
+
+ /**
+ * House number
+ */
+ @Column (name = "contact_house_number")
+ private Short contactHouseNumber;
+
+ /**
+ * House number extension
+ */
+ @Column (name = "contact_house_number_extension", length = 5)
+ private String contactHouseNumberExtension;
+
+ /**
+ * Id number
+ */
+ @Id
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ @Column (name = "contact_id", nullable = false, updatable = false)
+ private Long contactId;
+
+ /**
+ * Cellphone number
+ */
+ @JoinColumn (name = "contact_mobile_number_id", referencedColumnName = "mobile_id", unique = true)
+ @OneToOne (targetEntity = MobileNumber.class, cascade = CascadeType.ALL)
+ private DialableMobileNumber contactMobileNumber;
+
+ /**
+ * Flag whether this contact is user's own data
+ */
+ @Basic (optional = false)
+ @Column (name = "contact_own_contact", nullable = false)
+ private Boolean contactOwnContact;
+
+ /**
+ * Contact's personal title (Mr./Mrs.)
+ */
+ @Basic (optional = false)
+ @Column (name = "contact_personal_title", nullable = false)
+ @Enumerated (EnumType.STRING)
+ private PersonalTitle contactPersonalTitle;
+
+ /**
+ * Phone number
+ */
+ @JoinColumn (name = "contact_landline_number_id", referencedColumnName = "landline_id", unique = true)
+ @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
+ private DialableLandLineNumber contactPhoneNumber;
+
+ /**
+ * Street
+ */
+ @Column (name = "contact_street")
+ private String contactStreet;
+
+ /**
+ * Title (Doctor, etc)
+ */
+ @Column (name = "contact_title")
+ private String contactTitle;
+
+ /**
+ * When the contact has been updated
+ */
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "contact_updated")
+ private Calendar contactUpdated;
+
+ /**
+ * ZIP code
+ */
+ @Column (name = "contact_zip_code")
+ private Integer contactZipCode;
+
+ /**
+ * Default constructor
+ */
+ public UserContact () {
+ // Default is not user's own contact
+ this.contactOwnContact = Boolean.FALSE;
+ }
+
+ /**
+ * Constructor for title and names
+ * <p>
+ * @param contactTitle Personal title
+ * @param contactFirstName First name
+ * @param contactFamilyName Family name
+ */
+ public UserContact (final PersonalTitle contactTitle, final String contactFirstName, final String contactFamilyName) {
+ // Call default constructor
+ this();
+
+ // Set all
+ this.contactPersonalTitle = contactTitle;
+ this.contactFirstName = contactFirstName;
+ this.contactFamilyName = contactFamilyName;
+ }
+
+ @Override
+ public boolean equals (final Object object) {
+ if (this == object) {
+ return true;
+ } else if (null == object) {
+ return false;
+ } else if (this.getClass() != object.getClass()) {
+ return false;
+ } else if (!(object instanceof Contact)) {
+ // Not correct interface
+ return false;
+ }
+
+ final Contact other = (Contact) object;
+
+ if (!Objects.equals(this.getContactId(), other.getContactId())) {
+ return false;
+ } else if (!Objects.equals(this.getContactCity(), other.getContactCity())) {
+ return false;
+ } else if (!Objects.equals(this.getContactEmailAddress(), other.getContactEmailAddress())) {
+ return false;
+ } else if (!Objects.equals(this.getContactFamilyName(), other.getContactFamilyName())) {
+ return false;
+ } else if (!Objects.equals(this.getContactFirstName(), other.getContactFirstName())) {
+ return false;
+ } else if (!Objects.equals(this.getContactStreet(), other.getContactStreet())) {
+ return false;
+ } else if (!Objects.equals(this.getContactTitle(), other.getContactTitle())) {
+ return false;
+ } else if (!Objects.equals(this.getContactBirthday(), other.getContactBirthday())) {
+ return false;
+ } else if (!Objects.equals(this.getContactCountry(), other.getContactCountry())) {
+ return false;
+ } else if (this.getContactPersonalTitle() != other.getContactPersonalTitle()) {
+ return false;
+ } else if (!Objects.equals(this.getContactHouseNumber(), other.getContactHouseNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getContactHouseNumberExtension(), other.getContactHouseNumberExtension())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getContactBirthday () {
+ return this.contactBirthday;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setContactBirthday (final Date contactBirthday) {
+ this.contactBirthday = contactBirthday;
+ }
+
+ @Override
+ public String getContactCity () {
+ return this.contactCity;
+ }
+
+ @Override
+ public void setContactCity (final String contactCity) {
+ this.contactCity = contactCity;
+ }
+
+ @Override
+ public String getContactComment () {
+ return this.contactComment;
+ }
+
+ @Override
+ public void setContactComment (final String contactComment) {
+ this.contactComment = contactComment;
+ }
+
+ @Override
+ public Country getContactCountry () {
+ return this.contactCountry;
+ }
+
+ @Override
+ public void setContactCountry (final Country contactCountry) {
+ this.contactCountry = contactCountry;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Calendar getContactCreated () {
+ return this.contactCreated;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setContactCreated (final Calendar contactCreated) {
+ this.contactCreated = contactCreated;
+ }
+
+ @Override
+ public String getContactEmailAddress () {
+ return this.contactEmailAddress;
+ }
+
+ @Override
+ public void setContactEmailAddress (final String contactEmailAddress) {
+ this.contactEmailAddress = contactEmailAddress;
+ }
+
+ @Override
+ public String getContactFamilyName () {
+ //* NOISY-DEBUG: */ this.getLogger().logTrace("CALLED!");
+ return this.contactFamilyName;
+ }
+
+ @Override
+ public void setContactFamilyName (final String contactFamilyName) {
+ this.contactFamilyName = contactFamilyName;
+ }
+
+ @Override
+ public DialableFaxNumber getContactFaxNumber () {
+ return this.contactFaxNumber;
+ }
+
+ @Override
+ public void setContactFaxNumber (final DialableFaxNumber contactFaxNumber) {
+ this.contactFaxNumber = contactFaxNumber;
+ }
+
+ @Override
+ public String getContactFirstName () {
+ return this.contactFirstName;
+ }
+
+ @Override
+ public void setContactFirstName (final String contactFirstName) {
+ this.contactFirstName = contactFirstName;
+ }
+
+ @Override
+ public Short getContactHouseNumber () {
+ return this.contactHouseNumber;
+ }
+
+ @Override
+ public void setContactHouseNumber (final Short contactHouseNumber) {
+ this.contactHouseNumber = contactHouseNumber;
+ }
+
+ @Override
+ public String getContactHouseNumberExtension () {
+ return this.contactHouseNumberExtension;
+ }
+
+ @Override
+ public void setContactHouseNumberExtension (final String contactHouseNumberExtension) {
+ this.contactHouseNumberExtension = contactHouseNumberExtension;
+ }
+
+ @Override
+ public Long getContactId () {
+ return this.contactId;
+ }
+
+ @Override
+ public void setContactId (final Long contactId) {
+ this.contactId = contactId;
+ }
+
+ @Override
+ public DialableLandLineNumber getContactLandLineNumber () {
+ return this.contactPhoneNumber;
+ }
+
+ @Override
+ public void setContactLandLineNumber (final DialableLandLineNumber contactPhoneNumber) {
+ this.contactPhoneNumber = contactPhoneNumber;
+ }
+
+ @Override
+ public DialableMobileNumber getContactMobileNumber () {
+ return this.contactMobileNumber;
+ }
+
+ @Override
+ public void setContactMobileNumber (final DialableMobileNumber contactMobileNumber) {
+ this.contactMobileNumber = contactMobileNumber;
+ }
+
+ @Override
+ public void setContactOwnContact (final Boolean contactOwnContact) {
+ this.contactOwnContact = contactOwnContact;
+ }
+
+ @Override
+ public PersonalTitle getContactPersonalTitle () {
+ return this.contactPersonalTitle;
+ }
+
+ @Override
+ public void setContactPersonalTitle (final PersonalTitle contactPersonalTitle) {
+ this.contactPersonalTitle = contactPersonalTitle;
+ }
+
+ @Override
+ public String getContactStreet () {
+ return this.contactStreet;
+ }
+
+ @Override
+ public void setContactStreet (final String contactStreet) {
+ this.contactStreet = contactStreet;
+ }
+
+ @Override
+ public String getContactTitle () {
+ return this.contactTitle;
+ }
+
+ @Override
+ public void setContactTitle (final String contactTitle) {
+ this.contactTitle = contactTitle;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Calendar getContactUpdated () {
+ return this.contactUpdated;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setContactUpdated (final Calendar contactUpdated) {
+ this.contactUpdated = contactUpdated;
+ }
+
+ @Override
+ public Integer getContactZipCode () {
+ return this.contactZipCode;
+ }
+
+ @Override
+ public void setContactZipCode (final Integer contactZipCode) {
+ this.contactZipCode = contactZipCode;
+ }
+
+ @Override
+ public int hashCode () {
+ int hash = 5;
+
+ hash = 29 * hash + Objects.hashCode(this.getContactBirthday());
+ hash = 29 * hash + Objects.hashCode(this.getContactCity());
+ hash = 29 * hash + Objects.hashCode(this.getContactCountry());
+ hash = 29 * hash + Objects.hashCode(this.getContactEmailAddress());
+ hash = 29 * hash + Objects.hashCode(this.getContactFamilyName());
+ hash = 29 * hash + Objects.hashCode(this.getContactFirstName());
+ hash = 29 * hash + Objects.hashCode(this.getContactPersonalTitle());
+ hash = 29 * hash + Objects.hashCode(this.getContactHouseNumber());
+ hash = 29 * hash + Objects.hashCode(this.getContactHouseNumberExtension());
+ hash = 29 * hash + Objects.hashCode(this.getContactId());
+ hash = 29 * hash + Objects.hashCode(this.getContactStreet());
+ hash = 29 * hash + Objects.hashCode(this.getContactTitle());
+
+ return hash;
+ }
+
+ @Override
+ public Boolean isOwnContact () {
+ return this.contactOwnContact;
+ }
+
+}