* <p>
* @return the birthday
*/
- public Date getBirthday ();
+ public Date getContactBirthday ();
/**
* Birth day
* <p>
* @param birthday the birthday to set
*/
- public void setBirthday (final Date birthday);
+ public void setContactBirthday (final Date birthday);
/**
* Getter for cellphone number
* <p>
* @return Cellphone number
*/
- public DialableCellphoneNumber getCellphoneNumber ();
+ public DialableCellphoneNumber getContactCellphoneNumber ();
/**
* Setter for cellphone number
* <p>
* @param cellphoneNumber Cellphone number
*/
- public void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
+ public void setContactCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
/**
* City
* <p>
* @return the city
*/
- public String getCity ();
+ public String getContactCity ();
/**
* City
* <p>
* @param city the city to set
*/
- public void setCity (final String city);
+ public void setContactCity (final String city);
/**
* Comments
* <p>
* @return the comment
*/
- public String getComment ();
+ public String getContactComment ();
/**
* Comments
* <p>
* @param comment the comment to set
*/
- public void setComment (final String comment);
+ public void setContactComment (final String comment);
/**
* Id number
* <p>
* @return the countryCode
*/
- public Country getCountry ();
+ public Country getContactCountry ();
/**
* Country code
* <p>
* @param contactCountry the countryCode to set
*/
- public void setCountry (final Country contactCountry);
+ public void setContactCountry (final Country contactCountry);
/**
* Getter for "created" timestamp
* <p>
* @return "created" timestamp
*/
- public Calendar getCreated ();
+ public Calendar getContactCreated ();
/**
* Setter for "created" timestamp
* <p>
* @param created "created" timestamp
*/
- public void setCreated (final Calendar created);
+ public void setContactCreated (final Calendar created);
/**
* Email address
* <p>
* @return the emailAddress
*/
- public String getEmailAddress ();
+ public String getContactEmailAddress ();
/**
* Email address
* <p>
* @param emailAddress the emailAddress to set
*/
- public void setEmailAddress (final String emailAddress);
+ public void setContactEmailAddress (final String emailAddress);
/**
* Family name
* <p>
* @return the familyName
*/
- public String getFamilyName ();
+ public String getContactFamilyName ();
/**
* Family name
* <p>
* @param familyName the familyName to set
*/
- public void setFamilyName (final String familyName);
+ public void setContactFamilyName (final String familyName);
/**
* Fax number
* <p>
* @return the faxNumber
*/
- public DialableFaxNumber getFaxNumber ();
+ public DialableFaxNumber getContactFaxNumber ();
/**
* Fax number
* <p>
* @param faxNumber the faxNumber to set
*/
- public void setFaxNumber (final DialableFaxNumber faxNumber);
+ public void setContactFaxNumber (final DialableFaxNumber faxNumber);
/**
* First name
* <p>
* @return the first name
*/
- public String getFirstName ();
+ public String getContactFirstName ();
/**
* First name
* <p>
* @param firstName the first name to set
*/
- public void setFirstName (final String firstName);
+ public void setContactFirstName (final String firstName);
/**
* Gender of the contact
* <p>
* @return the gender
*/
- public Gender getGender ();
+ public Gender getContactGender ();
/**
* Gender of the contact
* <p>
* @param gender the gender to set
*/
- public void setGender (final Gender gender);
+ public void setContactGender (final Gender gender);
/**
* House number
* <p>
* @return the houseNumber
*/
- public Short getHouseNumber ();
+ public Short getContactHouseNumber ();
/**
* House number
* <p>
* @param houseNumber the houseNumber to set
*/
- public void setHouseNumber (final Short houseNumber);
+ public void setContactHouseNumber (final Short houseNumber);
/**
* Setter for own contact
* <p>
* @param ownContact Own contact
*/
- public void setOwnContact (final Boolean ownContact);
+ public void setContactOwnContact (final Boolean ownContact);
/**
* Getter for phone number
* <p>
* @return Phone number
*/
- public DialableLandLineNumber getPhoneNumber ();
+ public DialableLandLineNumber getContactPhoneNumber ();
/**
* Setter for phone number
* <p>
* @param phoneNumber Phone number
*/
- public void setPhoneNumber (final DialableLandLineNumber phoneNumber);
+ public void setContactPhoneNumber (final DialableLandLineNumber phoneNumber);
/**
* Street
* <p>
* @return the street
*/
- public String getStreet ();
+ public String getContactStreet ();
/**
* Street
* <p>
* @param street the street to set
*/
- public void setStreet (final String street);
+ public void setContactStreet (final String street);
/**
* Getter for "updated" timestamp
* <p>
* @return "updated" timestamp
*/
- public Calendar getUpdated ();
+ public Calendar getContactUpdated ();
/**
* Getter for "updated" timestamp
* <p>
* @param updated "updated" timestamp
*/
- public void setUpdated (final Calendar updated);
+ public void setContactUpdated (final Calendar updated);
/**
* ZIP code
* <p>
* @return the zipCode
*/
- public Integer getZipCode ();
+ public Integer getContactZipCode ();
/**
* ZIP code
* <p>
* @param zipCode the zipCode to set
*/
- public void setZipCode (final Integer zipCode);
+ public void setContactZipCode (final Integer zipCode);
/**
* Checks whether the contact is user's own data
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import javax.persistence.Transient;
import org.mxchange.jcontacts.contact.gender.Gender;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jcountry.data.CountryData;
name = "contacts",
indexes = {
@Index (
- name = "gender",
- columnList = "gender"
+ name = "contact_gender",
+ columnList = "contact_gender"
)
}
)
/**
* Birth day
*/
- @Column (name = "birthday")
+ @Column (name = "contact_birthday")
@Temporal (TemporalType.DATE)
- private Date birthday;
+ private Date contactBirthday;
/**
* Cellphone number
*/
- @JoinColumn (name = "cellphone_number_id")
+ @JoinColumn (name = "contact_cellphone_number_id")
@OneToOne (targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL)
- private DialableCellphoneNumber cellphoneNumber;
+ private DialableCellphoneNumber contactCellphoneNumber;
/**
* City
*/
- @Column (name = "city", nullable = false, length = 100)
- private String city;
+ @Column (name = "contact_city", nullable = false, length = 100)
+ private String contactCity;
/**
* Optional comments
*/
@Lob
- @Column (name = "comment")
- private String comment;
+ @Column (name = "contact_comment")
+ private String contactComment;
/**
* Id number
* Country code
*/
@JoinColumn (name = "contact_country_id", nullable = false)
- @OneToOne(targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
- @Transient
- private Country country;
+ @OneToOne(targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
+ private Country contactCountry;
/**
* When the contact has been created
*/
@Basic (optional = false)
@Temporal (TemporalType.TIMESTAMP)
- @Column (name = "created", nullable = false)
- private Calendar created;
+ @Column (name = "contact_created", nullable = false)
+ private Calendar contactCreated;
/**
* Email address
*/
- @Column (name = "email_address", length = 100, nullable = false)
- private String emailAddress;
+ @Column (name = "contact_email_address", length = 100, nullable = false)
+ private String contactEmailAddress;
/**
* Family name
*/
@Basic (optional = false)
- @Column (name = "family_name", length = 100, nullable = false)
- private String familyName;
+ @Column (name = "contact_family_name", length = 100, nullable = false)
+ private String contactFamilyName;
/**
* Fax number
*/
- @JoinColumn (name = "fax_number_id")
+ @JoinColumn (name = "contact_fax_number_id")
@OneToOne(targetEntity = FaxNumber.class,cascade = CascadeType.ALL)
- private DialableFaxNumber faxNumber;
+ private DialableFaxNumber contactFaxNumber;
/**
* First name
*/
@Basic (optional = false)
- @Column (name = "first_name", length = 100, nullable = false)
- private String firstName;
+ @Column (name = "contact_first_name", length = 100, nullable = false)
+ private String contactFirstName;
/**
* Gender instance
*/
@Basic (optional = false)
- @Column (name = "gender", nullable = false)
+ @Column (name = "contact_gender", nullable = false)
@Enumerated (EnumType.STRING)
- private Gender gender;
+ private Gender contactGender;
/**
* House number
*/
- @Column (name = "house_number", length = 5, nullable = false)
- private Short houseNumber;
+ @Column (name = "contact_house_number", length = 5, nullable = false)
+ private Short contactHouseNumber;
/**
* Flag whether this contact is user's own data
*/
- @Column (name = "own_contact", nullable = false)
- private Boolean ownContact;
+ @Column (name = "contact_own_contact", nullable = false)
+ private Boolean contactOwnContact;
/**
* Phone number
*/
- @JoinColumn (name = "phone_number_id")
+ @JoinColumn (name = "contact_phone_number_id")
@OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
- private DialableLandLineNumber phoneNumber;
+ private DialableLandLineNumber contactPhoneNumber;
/**
* Street
*/
- @Column (name = "street", nullable = false)
- private String street;
+ @Column (name = "contact_street", nullable = false)
+ private String contactStreet;
/**
* When the contact has been updated
*/
@Temporal (TemporalType.TIMESTAMP)
- @Column (name = "updated")
- private Calendar updated;
+ @Column (name = "contact_updated")
+ private Calendar contactUpdated;
/**
* ZIP code
*/
- @Column (name = "zip_code", nullable = false, length = 6)
- private Integer zipCode;
+ @Column (name = "contact_zip_code", nullable = false, length = 6)
+ private Integer contactZipCode;
/**
- * Constructor for gender and names
+ * Constructor for contactGender and names
* <p>
- * @param gender Gender instance
- * @param firstName First name
- * @param familyName Family name
+ * @param contactGender Gender instance
+ * @param contactFirstName First name
+ * @param contactFamilyName Family name
*/
- public UserContact (final Gender gender, final String firstName, final String familyName) {
+ public UserContact (final Gender contactGender, final String contactFirstName, final String contactFamilyName) {
// Set all
- this.gender = gender;
- this.firstName = firstName;
- this.familyName = familyName;
+ this.contactGender = contactGender;
+ this.contactFirstName = contactFirstName;
+ this.contactFamilyName = contactFamilyName;
}
/**
public void copyAll (final Contact contact) {
// Copy all:
// - base data
- this.setFirstName(contact.getFirstName());
- this.setFamilyName(contact.getFamilyName());
- this.setStreet(contact.getStreet());
- this.setZipCode(contact.getZipCode());
- this.setCity(contact.getCity());
- this.setCountry(contact.getCountry());
+ this.setContactFirstName(contact.getContactFirstName());
+ this.setContactFamilyName(contact.getContactFamilyName());
+ this.setContactStreet(contact.getContactStreet());
+ this.setContactZipCode(contact.getContactZipCode());
+ this.setContactCity(contact.getContactCity());
+ this.setContactCountry(contact.getContactCountry());
// - phone, fax, email
- this.setPhoneNumber(contact.getPhoneNumber());
- this.setFaxNumber(contact.getFaxNumber());
- this.setCellphoneNumber(contact.getCellphoneNumber());
+ this.setContactPhoneNumber(contact.getContactPhoneNumber());
+ this.setContactFaxNumber(contact.getContactFaxNumber());
+ this.setContactCellphoneNumber(contact.getContactCellphoneNumber());
// - other data
- this.setBirthday(contact.getBirthday());
- this.setComment(contact.getComment());
- this.setCreated(contact.getCreated());
- this.setUpdated(contact.getUpdated());
+ this.setContactBirthday(contact.getContactBirthday());
+ this.setContactComment(contact.getContactComment());
+ this.setContactCreated(contact.getContactCreated());
+ this.setContactUpdated(contact.getContactUpdated());
}
/**
Contact contact = (Contact) object;
// Now test some data TODO Definedly needs improvement
- return ((this.getGender().equals(contact.getGender())) &&
- (this.getFirstName().toLowerCase().equals(contact.getFirstName().toLowerCase())) &&
- (this.getFamilyName().toLowerCase().equals(contact.getFamilyName().toLowerCase())));
+ return ((this.getContactGender().equals(contact.getContactGender())) &&
+ (this.getContactFirstName().toLowerCase().equals(contact.getContactFirstName().toLowerCase())) &&
+ (this.getContactFamilyName().toLowerCase().equals(contact.getContactFamilyName().toLowerCase())));
}
@Override
- public Date getBirthday () {
- return this.birthday;
+ public Date getContactBirthday () {
+ return this.contactBirthday;
}
@Override
- public void setBirthday (final Date birthday) {
- this.birthday = birthday;
+ public void setContactBirthday (final Date contactBirthday) {
+ this.contactBirthday = contactBirthday;
}
@Override
- public DialableCellphoneNumber getCellphoneNumber () {
- return this.cellphoneNumber;
+ public DialableCellphoneNumber getContactCellphoneNumber () {
+ return this.contactCellphoneNumber;
}
@Override
- public void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) {
- this.cellphoneNumber = cellphoneNumber;
+ public void setContactCellphoneNumber (final DialableCellphoneNumber contactCellphoneNumber) {
+ this.contactCellphoneNumber = contactCellphoneNumber;
}
@Override
- public String getCity () {
- return this.city;
+ public String getContactCity () {
+ return this.contactCity;
}
@Override
- public void setCity (final String city) {
- this.city = city;
+ public void setContactCity (final String contactCity) {
+ this.contactCity = contactCity;
}
@Override
- public String getComment () {
- return this.comment;
+ public String getContactComment () {
+ return this.contactComment;
}
@Override
- public void setComment (final String comment) {
- this.comment = comment;
+ public void setContactComment (final String contactComment) {
+ this.contactComment = contactComment;
}
@Override
}
@Override
- public Country getCountry () {
- return this.country;
+ public Country getContactCountry () {
+ return this.contactCountry;
}
@Override
- public void setCountry (final Country country) {
- this.country = country;
+ public void setContactCountry (final Country contactCountry) {
+ this.contactCountry = contactCountry;
}
@Override
- public Calendar getCreated () {
- return this.created;
+ public Calendar getContactCreated () {
+ return this.contactCreated;
}
@Override
- public void setCreated (final Calendar created) {
- this.created = created;
+ public void setContactCreated (final Calendar contactCreated) {
+ this.contactCreated = contactCreated;
}
@Override
- public String getEmailAddress () {
- return this.emailAddress;
+ public String getContactEmailAddress () {
+ return this.contactEmailAddress;
}
@Override
- public void setEmailAddress (final String emailAddress) {
- this.emailAddress = emailAddress;
+ public void setContactEmailAddress (final String contactEmailAddress) {
+ this.contactEmailAddress = contactEmailAddress;
}
@Override
- public String getFamilyName () {
+ public String getContactFamilyName () {
//* NOISY-DEBUG: */ this.getLogger().logTrace("CALLED!");
- return this.familyName;
+ return this.contactFamilyName;
}
@Override
- public void setFamilyName (final String familyName) {
- this.familyName = familyName;
+ public void setContactFamilyName (final String contactFamilyName) {
+ this.contactFamilyName = contactFamilyName;
}
@Override
- public DialableFaxNumber getFaxNumber () {
- return this.faxNumber;
+ public DialableFaxNumber getContactFaxNumber () {
+ return this.contactFaxNumber;
}
@Override
- public void setFaxNumber (final DialableFaxNumber faxNumber) {
- this.faxNumber = faxNumber;
+ public void setContactFaxNumber (final DialableFaxNumber contactFaxNumber) {
+ this.contactFaxNumber = contactFaxNumber;
}
@Override
- public String getFirstName () {
- return this.firstName;
+ public String getContactFirstName () {
+ return this.contactFirstName;
}
@Override
- public void setFirstName (final String firstName) {
- this.firstName = firstName;
+ public void setContactFirstName (final String contactFirstName) {
+ this.contactFirstName = contactFirstName;
}
@Override
- public Gender getGender () {
- return this.gender;
+ public Gender getContactGender () {
+ return this.contactGender;
}
@Override
- public void setGender (final Gender gender) {
- this.gender = gender;
+ public void setContactGender (final Gender contactGender) {
+ this.contactGender = contactGender;
}
@Override
- public Short getHouseNumber () {
- return this.houseNumber;
+ public Short getContactHouseNumber () {
+ return this.contactHouseNumber;
}
@Override
- public void setHouseNumber (final Short houseNumber) {
- this.houseNumber = houseNumber;
+ public void setContactHouseNumber (final Short contactHouseNumber) {
+ this.contactHouseNumber = contactHouseNumber;
}
@Override
- public void setOwnContact (final Boolean ownContact) {
- this.ownContact = ownContact;
+ public void setContactOwnContact (final Boolean contactOwnContact) {
+ this.contactOwnContact = contactOwnContact;
}
@Override
- public DialableLandLineNumber getPhoneNumber () {
- return this.phoneNumber;
+ public DialableLandLineNumber getContactPhoneNumber () {
+ return this.contactPhoneNumber;
}
@Override
- public void setPhoneNumber (final DialableLandLineNumber phoneNumber) {
- this.phoneNumber = phoneNumber;
+ public void setContactPhoneNumber (final DialableLandLineNumber contactPhoneNumber) {
+ this.contactPhoneNumber = contactPhoneNumber;
}
@Override
- public String getStreet () {
- return this.street;
+ public String getContactStreet () {
+ return this.contactStreet;
}
@Override
- public void setStreet (final String street) {
- this.street = street;
+ public void setContactStreet (final String contactStreet) {
+ this.contactStreet = contactStreet;
}
@Override
- public Calendar getUpdated () {
- return this.updated;
+ public Calendar getContactUpdated () {
+ return this.contactUpdated;
}
@Override
- public void setUpdated (final Calendar updated) {
- this.updated = updated;
+ public void setContactUpdated (final Calendar contactUpdated) {
+ this.contactUpdated = contactUpdated;
}
@Override
- public Integer getZipCode () {
- return this.zipCode;
+ public Integer getContactZipCode () {
+ return this.contactZipCode;
}
@Override
- public void setZipCode (final Integer zipCode) {
- this.zipCode = zipCode;
+ public void setContactZipCode (final Integer contactZipCode) {
+ this.contactZipCode = contactZipCode;
}
@Override
public int hashCode () {
- // Validate gender instance
- assert (this.getGender() instanceof Gender) : "gender is not set."; //NOI18N
+ // Validate contactGender instance
+ assert (this.getContactGender() instanceof Gender) : "gender is not set."; //NOI18N
int hash = 7;
- hash = 79 * hash + Objects.hashCode(this.getFamilyName());
- hash = 79 * hash + this.getGender().hashCode();
- hash = 79 * hash + Objects.hashCode(this.getFirstName());
+ hash = 79 * hash + Objects.hashCode(this.getContactFamilyName());
+ hash = 79 * hash + this.getContactGender().hashCode();
+ hash = 79 * hash + Objects.hashCode(this.getContactFirstName());
return hash;
}
/**
- * Initialization with fake gender UNKNOWN
+ * Initialization with fake contactGender UNKNOWN
*/
@PostConstruct
public void init () {
- // Fake gender
- this.gender = Gender.UNKNOWN;
+ // Fake contactGender
+ this.contactGender = Gender.UNKNOWN;
}
@Override
public Boolean isOwnContact () {
- return this.ownContact;
+ return this.contactOwnContact;
}
}