-/*\r
- * Copyright (C) 2015 Roland Haeder\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.addressbook.contact;\r
-\r
-import java.util.Objects;\r
-import org.mxchange.addressbook.BaseFrameworkSystem;\r
-import org.mxchange.addressbook.client.Client;\r
-\r
-/**\r
- * A general contact\r
- *\r
- * @author Roland Haeder\r
- * @version 0.0\r
- * @since 0.0\r
- */\r
-public class BaseContact extends BaseFrameworkSystem {\r
- /**\r
- * Birth day\r
- */\r
- private String birthday;\r
-\r
- /**\r
- * Cellphone number\r
- */\r
- private String cellphoneNumber;\r
-\r
- /**\r
- * City\r
- */\r
- private String city;\r
-\r
- /**\r
- * Optional comments\r
- */\r
- private String comment;\r
-\r
- /**\r
- * Companyname\r
- */\r
- private String companyName;\r
-\r
- /**\r
- * Country code\r
- */\r
- private String countryCode;\r
-\r
- /**\r
- * Email address\r
- */\r
- private String emailAddress;\r
-\r
- /**\r
- * Family name\r
- */\r
- private String familyName;\r
-\r
- /**\r
- * Fax number\r
- */\r
- private String faxNumber;\r
-\r
- /**\r
- * Gender code of the contact: - M = Mr. (male) - F = Mrs. (female) - C =\r
- * Company\r
- */\r
- private char gender;\r
-\r
- /**\r
- * House number\r
- */\r
- private int houseNumber;\r
-\r
- /**\r
- * Marker whether this contact is user's own data\r
- */\r
- private boolean ownContact;\r
-\r
- /**\r
- * Phone number\r
- */\r
- private String phoneNumber;\r
-\r
- /**\r
- * Street\r
- */\r
- private String street;\r
-\r
- /**\r
- * Surname\r
- */\r
- private String surname;\r
-\r
- /**\r
- * ZIP code\r
- */\r
- private long zipCode;\r
-\r
- /**\r
- * No instances can be created of this class\r
- */\r
- protected BaseContact () {\r
- super();\r
- }\r
-\r
- /**\r
- * Check if contacts are same or throw an exception\r
- *\r
- * @param object Other possible contact class\r
- * @return Whether both contacts are same\r
- * @todo Needs a lot improvements\r
- */\r
- @Override\r
- public boolean equals (Object object) {\r
- // Is it same type?\r
- if (!(object instanceof BaseContact)) {\r
- // Not equal types\r
- return false;\r
- } else if (!(object instanceof Contact)) {\r
- // Not correct interface\r
- return false;\r
- }\r
-\r
- // Try to cast\r
- Contact contact = (Contact) object;\r
- \r
- // Now test some data @todo Definedly needs improvement\r
- return ((this.getGender() == contact.getGender())\r
- && (this.getSurname().toLowerCase().equals(contact.getSurname().toLowerCase()))\r
- && (this.getFamilyName().toLowerCase().equals(contact.getFamilyName().toLowerCase())));\r
- }\r
-\r
- /**\r
- * Birth day\r
- *\r
- * @return the birthday\r
- */\r
- public String getBirthday () {\r
- return this.birthday;\r
- }\r
-\r
- /**\r
- * Cellphone number\r
- *\r
- * @return the cellphoneNumber\r
- */\r
- public String getCellphoneNumber () {\r
- return this.cellphoneNumber;\r
- }\r
-\r
- /**\r
- * City\r
- *\r
- * @return the city\r
- */\r
- public String getCity () {\r
- return this.city;\r
- }\r
-\r
- /**\r
- * City\r
- *\r
- * @param city the city to set\r
- */\r
- private void setCity (final String city) {\r
- this.city = city;\r
- }\r
-\r
- /**\r
- * Comments\r
- *\r
- * @return the comment\r
- */\r
- public String getComment () {\r
- return this.comment;\r
- }\r
-\r
- /**\r
- * Comments\r
- *\r
- * @param comment the comment to set\r
- */\r
- private void setComment (final String comment) {\r
- this.comment = comment;\r
- }\r
-\r
- /**\r
- * Companyname\r
- *\r
- * @return the companyName\r
- */\r
- public String getCompanyName () {\r
- return this.companyName;\r
- }\r
-\r
- /**\r
- * Companyname\r
- *\r
- * @param companyName the companyName to set\r
- */\r
- private void setCompanyName (final String companyName) {\r
- this.companyName = companyName;\r
- }\r
-\r
- /**\r
- * Country code\r
- *\r
- * @return the countryCode\r
- */\r
- public String getCountryCode () {\r
- return this.countryCode;\r
- }\r
-\r
- /**\r
- * Country code\r
- *\r
- * @param countryCode the countryCode to set\r
- */\r
- private void setCountryCode (final String countryCode) {\r
- this.countryCode = countryCode;\r
- }\r
-\r
- /**\r
- * "Serializes" this object into a CSV string (this time with semicolons)\r
- *\r
- * @return "CSV-serialized" version of the stored data\r
- */\r
- public String getCsvStringFromStoreableObject () {\r
- // Get all together\r
- String csvString = String.format(\r
- "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\n",\r
- this.isOwnContact(),\r
- this.getGender(),\r
- this.getSurname(),\r
- this.getFamilyName(),\r
- this.getCompanyName(),\r
- this.getStreet(),\r
- this.getZipCode(),\r
- this.getCity(),\r
- this.getCountryCode(),\r
- this.getPhoneNumber(),\r
- this.getFaxNumber(),\r
- this.getCellphoneNumber(),\r
- this.getEmailAddress(),\r
- this.getBirthday(),\r
- this.getComment()\r
- );\r
- \r
- // Then return it\r
- return csvString;\r
- }\r
-\r
- /**\r
- * Email address\r
- *\r
- * @return the emailAddress\r
- */\r
- public String getEmailAddress () {\r
- return this.emailAddress;\r
- }\r
-\r
- /**\r
- * Email address\r
- *\r
- * @param emailAddress the emailAddress to set\r
- */\r
- private void setEmailAddress (final String emailAddress) {\r
- this.emailAddress = emailAddress;\r
- }\r
-\r
- /**\r
- * Family name\r
- *\r
- * @return the familyName\r
- */\r
- public String getFamilyName () {\r
- return this.familyName;\r
- }\r
-\r
- /**\r
- * Family name\r
- *\r
- * @param familyName the familyName to set\r
- */\r
- private void setFamilyName (final String familyName) {\r
- this.familyName = familyName;\r
- }\r
-\r
- /**\r
- * Fax number\r
- *\r
- * @return the faxNumber\r
- */\r
- public String getFaxNumber () {\r
- return this.faxNumber;\r
- }\r
-\r
- /**\r
- * Fax number\r
- *\r
- * @param faxNumber the faxNumber to set\r
- */\r
- private void setFaxNumber (final String faxNumber) {\r
- this.faxNumber = faxNumber;\r
- }\r
-\r
- /**\r
- * Gender of the contact\r
- *\r
- * @return the gender\r
- */\r
- public char getGender () {\r
- return this.gender;\r
- }\r
-\r
- /**\r
- * Gender of the contact\r
- *\r
- * @param gender the gender to set\r
- */\r
- private void setGender (final char gender) {\r
- this.gender = gender;\r
- }\r
-\r
- /**\r
- * House number\r
- *\r
- * @return the houseNumber\r
- */\r
- public int getHouseNumber () {\r
- return this.houseNumber;\r
- }\r
-\r
- /**\r
- * Phone number\r
- *\r
- * @return the phoneNumber\r
- */\r
- public String getPhoneNumber () {\r
- return this.phoneNumber;\r
- }\r
-\r
- /**\r
- * Street\r
- *\r
- * @return the street\r
- */\r
- public String getStreet () {\r
- return this.street;\r
- }\r
-\r
- /**\r
- * Street\r
- *\r
- * @param street the street to set\r
- */\r
- protected final void setStreet (final String street) {\r
- this.street = street;\r
- }\r
-\r
- /**\r
- * Surname\r
- *\r
- * @return the surname\r
- */\r
- public final String getSurname () {\r
- return this.surname;\r
- }\r
-\r
- /**\r
- * Some "getter" for a translated/human-readable gender\r
- * @return gender Human-readable gender\r
- */\r
- public String getTranslatedGender () {\r
- // Default init\r
- String translated = null;\r
-\r
- // "Translate" it\r
- switch (this.getGender()) {\r
- case 'M': // Mr.\r
- translated = "Herr";\r
- break;\r
-\r
- case 'F': // Mrs.\r
- translated = "Frau";\r
- break;\r
-\r
- case 'C': // "Company"\r
- translated = "Firma";\r
- break;\r
-\r
- default: // Unsupported\r
- this.getLogger().error("Gender " + this.getGender() + " not supported.");\r
- break;\r
- }\r
-\r
- // Return it\r
- return translated;\r
- }\r
-\r
- /**\r
- * ZIP code\r
- *\r
- * @return the zipCode\r
- */\r
- public final long getZipCode () {\r
- return this.zipCode;\r
- }\r
-\r
- /**\r
- * ZIP code\r
- *\r
- * @param zipCode the zipCode to set\r
- */\r
- protected final void setZipCode (final long zipCode) {\r
- this.zipCode = zipCode;\r
- }\r
- \r
- @Override\r
- public int hashCode () {\r
- int hash = 7;\r
- hash = 79 * hash + Objects.hashCode(this.getFamilyName());\r
- hash = 79 * hash + this.getGender();\r
- hash = 79 * hash + Objects.hashCode(this.getSurname());\r
- return hash;\r
- }\r
-\r
- /**\r
- * Checks whether the contact is user's own data\r
- *\r
- * @return Own data?\r
- */\r
- public final boolean isOwnContact () {\r
- return this.ownContact;\r
- }\r
-\r
- /**\r
- * Shows this contact to the user\r
- *\r
- * @param client Client instance to use\r
- */\r
- public void show (final Client client) {\r
- // Display name "box"\r
- client.displayNameBox((Contact) this);\r
- \r
- // Display address "box"\r
- client.displayAddressBox((Contact) this);\r
- \r
- // Display other data "box"\r
- client.displayOtherDataBox((Contact) this);\r
- }\r
-\r
- /**\r
- * Updates address data in this Contact instance\r
- *\r
- * @param street Street\r
- * @param zipCode ZIP code\r
- * @param city City\r
- * @param countryCode Country code\r
- */\r
- public void updateAddressData (final String street, final long zipCode, final String city, final String countryCode) {\r
- // Set all\r
- if (street != null) {\r
- this.setStreet(street);\r
- }\r
- if (zipCode > 0) {\r
- this.setZipCode(zipCode);\r
- }\r
- if (city != null) {\r
- this.setCity(city);\r
- }\r
- if (countryCode != null) {\r
- this.setCountryCode(countryCode);\r
- }\r
- }\r
-\r
- /**\r
- * Updates name data in this Contact instance\r
- * @param gender Gender (M, F, C)\r
- * @param surname Surname\r
- * @param familyName Family name\r
- * @param companyName Company name\r
- */\r
- public void updateNameData (final char gender, final String surname, final String familyName, final String companyName) {\r
- // Set all\r
- this.setGender(gender);\r
- if (surname != null) {\r
- this.setSurname(surname);\r
- }\r
- if (familyName != null) {\r
- this.setFamilyName(familyName);\r
- }\r
- if (companyName != null) {\r
- this.setCompanyName(companyName);\r
- }\r
- }\r
-\r
- /**\r
- * Updates other data in this Contact instance\r
- * \r
- * @param phoneNumber Phone number\r
- * @param cellphoneNumber Cellphone number\r
- * @param faxNumber Fax number\r
- * @param emailAddress Email address\r
- * @param birthday Birth day\r
- * @param comment Comments\r
- */\r
- public void updateOtherData (final String phoneNumber, final String cellphoneNumber, final String faxNumber, final String emailAddress, final String birthday, final String comment) {\r
- // Set all\r
- if (phoneNumber != null) {\r
- this.setPhoneNumber(phoneNumber);\r
- }\r
- if (cellphoneNumber != null) {\r
- this.setCellphoneNumber(cellphoneNumber);\r
- }\r
- if (faxNumber != null) {\r
- this.setFaxNumber(faxNumber);\r
- }\r
- if (emailAddress != null) {\r
- this.setEmailAddress(emailAddress);\r
- }\r
- if (birthday != null) {\r
- this.setBirthday(birthday);\r
- }\r
- if (comment != null) {\r
- this.setComment(comment);\r
- }\r
- }\r
-\r
- /**\r
- * Enables the flag "own data" which signals that this contact is the user's\r
- * own data.\r
- */\r
- protected final void enableFlagOwnContact () {\r
- this.ownContact = true;\r
- }\r
-\r
- /**\r
- * Surname\r
- *\r
- * @param surname the surname to set\r
- */\r
- protected final void setSurname (final String surname) {\r
- this.surname = surname;\r
- }\r
-\r
- /**\r
- * Phone number\r
- *\r
- * @param phoneNumber the phoneNumber to set\r
- */\r
- protected final void setPhoneNumber (final String phoneNumber) {\r
- this.phoneNumber = phoneNumber;\r
- }\r
-\r
- /**\r
- * House number\r
- *\r
- * @param houseNumber the houseNumber to set\r
- */\r
- protected final void setHouseNumber (final int houseNumber) {\r
- this.houseNumber = houseNumber;\r
- }\r
-\r
- /**\r
- * Cellphone number\r
- *\r
- * @param cellphoneNumber the cellphoneNumber to set\r
- */\r
- protected final void setCellphoneNumber (final String cellphoneNumber) {\r
- this.cellphoneNumber = cellphoneNumber;\r
- }\r
-\r
- /**\r
- * Birth day\r
- *\r
- * @param birthday the birthday to set\r
- */\r
- protected final void setBirthday (final String birthday) {\r
- this.birthday = birthday;\r
- }\r
-}\r
+/*
+ * 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.contact;
+
+import java.util.Objects;
+import org.mxchange.addressbook.BaseFrameworkSystem;
+import org.mxchange.addressbook.client.Client;
+
+/**
+ * A general contact
+ *
+ * @author Roland Haeder
+ * @version 0.0
+ * @since 0.0
+ */
+public class BaseContact extends BaseFrameworkSystem {
+
+ /**
+ * Birth day
+ */
+ private String birthday;
+
+ /**
+ * Cellphone number
+ */
+ private String cellphoneNumber;
+
+ /**
+ * City
+ */
+ private String city;
+
+ /**
+ * Optional comments
+ */
+ private String comment;
+
+ /**
+ * Companyname
+ */
+ private String companyName;
+
+ /**
+ * Country code
+ */
+ private String countryCode;
+
+ /**
+ * Email address
+ */
+ private String emailAddress;
+
+ /**
+ * Family name
+ */
+ private String familyName;
+
+ /**
+ * Fax number
+ */
+ private String faxNumber;
+
+ /**
+ * Gender code of the contact: - M = Mr. (male) - F = Mrs. (female) - C =
+ * Company
+ */
+ private char gender;
+
+ /**
+ * House number
+ */
+ private int houseNumber;
+
+ /**
+ * Marker whether this contact is user's own data
+ */
+ private boolean ownContact;
+
+ /**
+ * Phone number
+ */
+ private String phoneNumber;
+
+ /**
+ * Street
+ */
+ private String street;
+
+ /**
+ * Surname
+ */
+ private String surname;
+
+ /**
+ * ZIP code
+ */
+ private long zipCode;
+
+ /**
+ * No instances can be created of this class
+ */
+ protected BaseContact () {
+ super();
+ }
+
+ /**
+ * Check if contacts are same or throw an exception
+ *
+ * @param object Other possible contact class
+ * @return Whether both contacts are same
+ * @todo Needs a lot improvements
+ */
+ @Override
+ public boolean equals (Object object) {
+ // Is it same type?
+ if (!(object instanceof BaseContact)) {
+ // Not equal types
+ return false;
+ } else if (!(object instanceof Contact)) {
+ // Not correct interface
+ return false;
+ }
+
+ // Try to cast
+ Contact contact = (Contact) object;
+
+ // Now test some data @todo Definedly needs improvement
+ return ((this.getGender() == contact.getGender())
+ && (this.getSurname().toLowerCase().equals(contact.getSurname().toLowerCase()))
+ && (this.getFamilyName().toLowerCase().equals(contact.getFamilyName().toLowerCase())));
+ }
+
+ /**
+ * Birth day
+ *
+ * @return the birthday
+ */
+ public String getBirthday () {
+ return this.birthday;
+ }
+
+ /**
+ * Cellphone number
+ *
+ * @return the cellphoneNumber
+ */
+ public String getCellphoneNumber () {
+ return this.cellphoneNumber;
+ }
+
+ /**
+ * City
+ *
+ * @return the city
+ */
+ public String getCity () {
+ return this.city;
+ }
+
+ /**
+ * City
+ *
+ * @param city the city to set
+ */
+ private void setCity (final String city) {
+ this.city = city;
+ }
+
+ /**
+ * Comments
+ *
+ * @return the comment
+ */
+ public String getComment () {
+ return this.comment;
+ }
+
+ /**
+ * Comments
+ *
+ * @param comment the comment to set
+ */
+ private void setComment (final String comment) {
+ this.comment = comment;
+ }
+
+ /**
+ * Companyname
+ *
+ * @return the companyName
+ */
+ public String getCompanyName () {
+ return this.companyName;
+ }
+
+ /**
+ * Companyname
+ *
+ * @param companyName the companyName to set
+ */
+ private void setCompanyName (final String companyName) {
+ this.companyName = companyName;
+ }
+
+ /**
+ * Country code
+ *
+ * @return the countryCode
+ */
+ public String getCountryCode () {
+ return this.countryCode;
+ }
+
+ /**
+ * Country code
+ *
+ * @param countryCode the countryCode to set
+ */
+ private void setCountryCode (final String countryCode) {
+ this.countryCode = countryCode;
+ }
+
+ /**
+ * "Serializes" this object into a CSV string (this time with semicolons)
+ *
+ * @return "CSV-serialized" version of the stored data
+ */
+ public String getCsvStringFromStoreableObject () {
+ // Get all together
+ String csvString = String.format(
+ "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\n",
+ this.isOwnContact(),
+ this.getGender(),
+ this.getSurname(),
+ this.getFamilyName(),
+ this.getCompanyName(),
+ this.getStreet(),
+ this.getZipCode(),
+ this.getCity(),
+ this.getCountryCode(),
+ this.getPhoneNumber(),
+ this.getFaxNumber(),
+ this.getCellphoneNumber(),
+ this.getEmailAddress(),
+ this.getBirthday(),
+ this.getComment()
+ );
+
+ // Then return it
+ return csvString;
+ }
+
+ /**
+ * Email address
+ *
+ * @return the emailAddress
+ */
+ public String getEmailAddress () {
+ return this.emailAddress;
+ }
+
+ /**
+ * Email address
+ *
+ * @param emailAddress the emailAddress to set
+ */
+ private void setEmailAddress (final String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ /**
+ * Family name
+ *
+ * @return the familyName
+ */
+ public String getFamilyName () {
+ return this.familyName;
+ }
+
+ /**
+ * Family name
+ *
+ * @param familyName the familyName to set
+ */
+ private void setFamilyName (final String familyName) {
+ this.familyName = familyName;
+ }
+
+ /**
+ * Fax number
+ *
+ * @return the faxNumber
+ */
+ public String getFaxNumber () {
+ return this.faxNumber;
+ }
+
+ /**
+ * Fax number
+ *
+ * @param faxNumber the faxNumber to set
+ */
+ private void setFaxNumber (final String faxNumber) {
+ this.faxNumber = faxNumber;
+ }
+
+ /**
+ * Gender of the contact
+ *
+ * @return the gender
+ */
+ public char getGender () {
+ return this.gender;
+ }
+
+ /**
+ * Gender of the contact
+ *
+ * @param gender the gender to set
+ */
+ private void setGender (final char gender) {
+ this.gender = gender;
+ }
+
+ /**
+ * House number
+ *
+ * @return the houseNumber
+ */
+ public int getHouseNumber () {
+ return this.houseNumber;
+ }
+
+ /**
+ * Phone number
+ *
+ * @return the phoneNumber
+ */
+ public String getPhoneNumber () {
+ return this.phoneNumber;
+ }
+
+ /**
+ * Street
+ *
+ * @return the street
+ */
+ public String getStreet () {
+ return this.street;
+ }
+
+ /**
+ * Street
+ *
+ * @param street the street to set
+ */
+ protected final void setStreet (final String street) {
+ this.street = street;
+ }
+
+ /**
+ * Surname
+ *
+ * @return the surname
+ */
+ public final String getSurname () {
+ return this.surname;
+ }
+
+ /**
+ * Some "getter" for a translated/human-readable gender
+ *
+ * @return gender Human-readable gender
+ */
+ public String getTranslatedGender () {
+ // Default init
+ String translated = null;
+
+ // "Translate" it
+ switch (this.getGender()) {
+ case 'M': // Mr.
+ translated = "Herr";
+ break;
+
+ case 'F': // Mrs.
+ translated = "Frau";
+ break;
+
+ case 'C': // "Company"
+ translated = "Firma";
+ break;
+
+ default: // Unsupported
+ this.getLogger().error("Gender " + this.getGender() + " not supported.");
+ break;
+ }
+
+ // Return it
+ return translated;
+ }
+
+ /**
+ * ZIP code
+ *
+ * @return the zipCode
+ */
+ public final long getZipCode () {
+ return this.zipCode;
+ }
+
+ /**
+ * ZIP code
+ *
+ * @param zipCode the zipCode to set
+ */
+ protected final void setZipCode (final long zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ @Override
+ public int hashCode () {
+ int hash = 7;
+ hash = 79 * hash + Objects.hashCode(this.getFamilyName());
+ hash = 79 * hash + this.getGender();
+ hash = 79 * hash + Objects.hashCode(this.getSurname());
+ return hash;
+ }
+
+ /**
+ * Checks whether the contact is user's own data
+ *
+ * @return Own data?
+ */
+ public final boolean isOwnContact () {
+ return this.ownContact;
+ }
+
+ /**
+ * Shows this contact to the user
+ *
+ * @param client Client instance to use
+ */
+ public void show (final Client client) {
+ // Display name "box"
+ client.displayNameBox((Contact) this);
+
+ // Display address "box"
+ client.displayAddressBox((Contact) this);
+
+ // Display other data "box"
+ client.displayOtherDataBox((Contact) this);
+ }
+
+ /**
+ * Updates address data in this Contact instance
+ *
+ * @param street Street
+ * @param zipCode ZIP code
+ * @param city City
+ * @param countryCode Country code
+ */
+ public void updateAddressData (final String street, final long zipCode, final String city, final String countryCode) {
+ // Set all
+ if (street != null) {
+ this.setStreet(street);
+ }
+ if (zipCode > 0) {
+ this.setZipCode(zipCode);
+ }
+ if (city != null) {
+ this.setCity(city);
+ }
+ if (countryCode != null) {
+ this.setCountryCode(countryCode);
+ }
+ }
+
+ /**
+ * Updates name data in this Contact instance
+ *
+ * @param gender Gender (M, F, C)
+ * @param surname Surname
+ * @param familyName Family name
+ * @param companyName Company name
+ */
+ public void updateNameData (final char gender, final String surname, final String familyName, final String companyName) {
+ // Set all
+ this.setGender(gender);
+ if (surname != null) {
+ this.setSurname(surname);
+ }
+ if (familyName != null) {
+ this.setFamilyName(familyName);
+ }
+ if (companyName != null) {
+ this.setCompanyName(companyName);
+ }
+ }
+
+ /**
+ * Updates other data in this Contact instance
+ *
+ * @param phoneNumber Phone number
+ * @param cellphoneNumber Cellphone number
+ * @param faxNumber Fax number
+ * @param emailAddress Email address
+ * @param birthday Birth day
+ * @param comment Comments
+ */
+ public void updateOtherData (final String phoneNumber, final String cellphoneNumber, final String faxNumber, final String emailAddress, final String birthday, final String comment) {
+ // Set all
+ if (phoneNumber != null) {
+ this.setPhoneNumber(phoneNumber);
+ }
+ if (cellphoneNumber != null) {
+ this.setCellphoneNumber(cellphoneNumber);
+ }
+ if (faxNumber != null) {
+ this.setFaxNumber(faxNumber);
+ }
+ if (emailAddress != null) {
+ this.setEmailAddress(emailAddress);
+ }
+ if (birthday != null) {
+ this.setBirthday(birthday);
+ }
+ if (comment != null) {
+ this.setComment(comment);
+ }
+ }
+
+ /**
+ * Enables the flag "own data" which signals that this contact is the user's
+ * own data.
+ */
+ protected final void enableFlagOwnContact () {
+ this.ownContact = true;
+ }
+
+ /**
+ * Surname
+ *
+ * @param surname the surname to set
+ */
+ protected final void setSurname (final String surname) {
+ this.surname = surname;
+ }
+
+ /**
+ * Phone number
+ *
+ * @param phoneNumber the phoneNumber to set
+ */
+ protected final void setPhoneNumber (final String phoneNumber) {
+ this.phoneNumber = phoneNumber;
+ }
+
+ /**
+ * House number
+ *
+ * @param houseNumber the houseNumber to set
+ */
+ protected final void setHouseNumber (final int houseNumber) {
+ this.houseNumber = houseNumber;
+ }
+
+ /**
+ * Cellphone number
+ *
+ * @param cellphoneNumber the cellphoneNumber to set
+ */
+ protected final void setCellphoneNumber (final String cellphoneNumber) {
+ this.cellphoneNumber = cellphoneNumber;
+ }
+
+ /**
+ * Birth day
+ *
+ * @param birthday the birthday to set
+ */
+ protected final void setBirthday (final String birthday) {
+ this.birthday = birthday;
+ }
+}