From: Roland Häder Date: Tue, 14 Apr 2020 05:29:14 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=18606a3e25bda50ca2d1aac862e7ae22aa17e90b;p=jcontacts-core.git Continued: - renamed contactCreated to contactEntryCreated - renamed contactUpdated to contactEntryUpdated Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontacts/model/contact/Contact.java b/src/org/mxchange/jcontacts/model/contact/Contact.java index c79d26a..6d7956e 100644 --- a/src/org/mxchange/jcontacts/model/contact/Contact.java +++ b/src/org/mxchange/jcontacts/model/contact/Contact.java @@ -120,14 +120,28 @@ public interface Contact extends Comparable, Serializable { *

* @return "created" timestamp */ - Date getContactCreated (); + Date getContactEntryCreated (); /** * Setter for "created" timestamp *

- * @param created "created" timestamp + * @param contactEntryCreated "created" timestamp */ - void setContactCreated (final Date created); + void setContactEntryCreated (final Date contactEntryCreated); + + /** + * Getter for "updated" timestamp + *

+ * @return "updated" timestamp + */ + Date getContactEntryUpdated (); + + /** + * Getter for "updated" timestamp + *

+ * @param contactEntryUpdated "updated" timestamp + */ + void setContactEntryUpdated (final Date contactEntryUpdated); /** * Email address @@ -277,20 +291,6 @@ public interface Contact extends Comparable, Serializable { */ void setContactTitle (final String contactTitle); - /** - * Getter for "updated" timestamp - *

- * @return "updated" timestamp - */ - Date getContactUpdated (); - - /** - * Getter for "updated" timestamp - *

- * @param updated "updated" timestamp - */ - void setContactUpdated (final Date updated); - /** * ZIP code *

diff --git a/src/org/mxchange/jcontacts/model/contact/Contacts.java b/src/org/mxchange/jcontacts/model/contact/Contacts.java index 645e492..75fd1af 100644 --- a/src/org/mxchange/jcontacts/model/contact/Contacts.java +++ b/src/org/mxchange/jcontacts/model/contact/Contacts.java @@ -102,7 +102,7 @@ public class Contacts implements Serializable { // - other data targetContact.setContactBirthday(sourceContact.getContactBirthday()); targetContact.setContactComment(sourceContact.getContactComment()); - targetContact.setContactUpdated(sourceContact.getContactUpdated()); + targetContact.setContactEntryUpdated(sourceContact.getContactEntryUpdated()); } /** @@ -179,7 +179,7 @@ public class Contacts implements Serializable { } } else if ((faxCountry instanceof Country) && (faxAreaCode > 0) && (faxNumber > 0)) { // Set new land-line number - DialableFaxNumber fax = new FaxNumber(faxCountry, faxAreaCode, faxNumber); + final DialableFaxNumber fax = new FaxNumber(faxCountry, faxAreaCode, faxNumber); // Set it in contact contact.setContactFaxNumber(fax); @@ -229,7 +229,7 @@ public class Contacts implements Serializable { } } else if ((phoneCountry instanceof Country) && (phoneAreaCode > 0) && (phoneNumber > 0)) { // Set new land-line number - DialableLandLineNumber landLine = new LandLineNumber(phoneCountry, phoneAreaCode, phoneNumber); + final DialableLandLineNumber landLine = new LandLineNumber(phoneCountry, phoneAreaCode, phoneNumber); // Set it in contact contact.setContactLandLineNumber(landLine); @@ -280,7 +280,7 @@ public class Contacts implements Serializable { } } else if ((mobileProvider instanceof MobileProvider) && (mobileNumber > 0)) { // Create new instance - DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber); + final DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber); // Set it in contact contact.setContactMobileNumber(mobile); diff --git a/src/org/mxchange/jcontacts/model/contact/UserContact.java b/src/org/mxchange/jcontacts/model/contact/UserContact.java index ec5f8b6..3149586 100644 --- a/src/org/mxchange/jcontacts/model/contact/UserContact.java +++ b/src/org/mxchange/jcontacts/model/contact/UserContact.java @@ -107,19 +107,26 @@ public class UserContact implements Contact { @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) private Country contactCountry; + /** + * Email address + */ + @Column (name = "contact_email_address", length = 100, unique = true) + private String contactEmailAddress; + /** * When the contact has been created */ @Basic (optional = false) @Temporal (TemporalType.TIMESTAMP) - @Column (name = "contact_created", nullable = false) - private Date contactCreated; + @Column (name = "contact_entry_created", nullable = false) + private Date contactEntryCreated; /** - * Email address + * When the contact has been updated */ - @Column (name = "contact_email_address", length = 100, unique = true) - private String contactEmailAddress; + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "contact_entry_updated") + private Date contactEntryUpdated; /** * Family name @@ -203,13 +210,6 @@ public class UserContact implements Contact { @Column (name = "contact_title") private String contactTitle; - /** - * When the contact has been updated - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "contact_updated") - private Date contactUpdated; - /** * ZIP code */ @@ -227,16 +227,34 @@ public class UserContact implements Contact { /** * Constructor for title and names *

- * @param contactTitle Personal title - * @param contactFirstName First name - * @param contactFamilyName Family name + * @param contactPersonalTitle Personal title + * @param contactFirstName First name + * @param contactFamilyName Family name */ - public UserContact (final PersonalTitle contactTitle, final String contactFirstName, final String contactFamilyName) { - // Call default constructor + public UserContact (final PersonalTitle contactPersonalTitle, final String contactFirstName, final String contactFamilyName) { + // Invoke default constructor this(); + // Are all parameter set? + if (null == contactFamilyName) { + // Throw NPE + throw new NullPointerException("contactFamilyName is null"); //NOI18N + } else if (contactFamilyName.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("contactFamilyName is empty"); //NOI18N + } else if (null == contactFirstName) { + // Throw NPE + throw new NullPointerException("contactFirstName is null"); //NOI18N + } else if (contactFirstName.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("contactFirstName is empty"); //NOI18N + } else if (null == contactPersonalTitle) { + // Throw NPE + throw new NullPointerException("contactPersonalTitle is null"); //NOI18N + } + // Set all - this.contactPersonalTitle = contactTitle; + this.contactPersonalTitle = contactPersonalTitle; this.contactFirstName = contactFirstName; this.contactFamilyName = contactFamilyName; } @@ -370,26 +388,38 @@ public class UserContact implements Contact { this.contactCountry = contactCountry; } + @Override + public String getContactEmailAddress () { + return this.contactEmailAddress; + } + + @Override + public void setContactEmailAddress (final String contactEmailAddress) { + this.contactEmailAddress = contactEmailAddress; + } + @Override @SuppressWarnings ("ReturnOfDateField") - public Date getContactCreated () { - return this.contactCreated; + public Date getContactEntryCreated () { + return this.contactEntryCreated; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setContactCreated (final Date contactCreated) { - this.contactCreated = contactCreated; + public void setContactEntryCreated (final Date contactEntryCreated) { + this.contactEntryCreated = contactEntryCreated; } @Override - public String getContactEmailAddress () { - return this.contactEmailAddress; + @SuppressWarnings ("ReturnOfDateField") + public Date getContactEntryUpdated () { + return this.contactEntryUpdated; } @Override - public void setContactEmailAddress (final String contactEmailAddress) { - this.contactEmailAddress = contactEmailAddress; + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setContactEntryUpdated (final Date contactEntryUpdated) { + this.contactEntryUpdated = contactEntryUpdated; } @Override @@ -508,18 +538,6 @@ public class UserContact implements Contact { this.contactTitle = contactTitle; } - @Override - @SuppressWarnings ("ReturnOfDateField") - public Date getContactUpdated () { - return this.contactUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setContactUpdated (final Date contactUpdated) { - this.contactUpdated = contactUpdated; - } - @Override public Integer getContactZipCode () { return this.contactZipCode;