]> git.mxchange.org Git - jfinancials-swing.git/blobdiff - Addressbook/src/org/mxchange/addressbook/contact/BaseContact.java
Added support for all current columns for reading from database file
[jfinancials-swing.git] / Addressbook / src / org / mxchange / addressbook / contact / BaseContact.java
index 3e9da4cd79664a94c277ce4c967fdef8f63bf6a1..2a1ecb73ffd0bbf9d1f3605b063a71355379bf39 100644 (file)
@@ -107,7 +107,7 @@ public class BaseContact extends BaseFrameworkSystem {
     /**\r
      * ZIP code\r
      */\r
-    private int zipCode;\r
+    private long zipCode;\r
 \r
     /**\r
      * No instances can be created of this class\r
@@ -116,14 +116,6 @@ public class BaseContact extends BaseFrameworkSystem {
        super();\r
     }\r
 \r
-    /**\r
-     * Enables the flag "own data" which signals that this contact is the user's\r
-     * own data.\r
-     */\r
-    public void enableFlagOwnContact () {\r
-       this.ownContact = true;\r
-    }\r
-\r
     /**\r
      * Check if contacts are same or throw an exception\r
      *\r
@@ -259,6 +251,36 @@ public class BaseContact extends BaseFrameworkSystem {
        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
@@ -439,7 +461,7 @@ public class BaseContact extends BaseFrameworkSystem {
      *\r
      * @return the zipCode\r
      */\r
-    public int getZipCode () {\r
+    public long getZipCode () {\r
        return this.zipCode;\r
     }\r
 \r
@@ -448,7 +470,7 @@ public class BaseContact extends BaseFrameworkSystem {
      *\r
      * @param zipCode the zipCode to set\r
      */\r
-    public void setZipCode (final int zipCode) {\r
+    public void setZipCode (final long zipCode) {\r
        this.zipCode = zipCode;\r
     }\r
 \r
@@ -494,12 +516,20 @@ public class BaseContact extends BaseFrameworkSystem {
      * @param city City\r
      * @param countryCode Country code\r
      */\r
-    public void updateAddressData (final String street, final int zipCode, final String city, final String countryCode) {\r
+    public void updateAddressData (final String street, final long zipCode, final String city, final String countryCode) {\r
        // Set all\r
-       this.setStreet(street);\r
-       this.setZipCode(zipCode);\r
-       this.setCity(city);\r
-       this.setCountryCode(countryCode);\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
@@ -512,9 +542,15 @@ public class BaseContact extends BaseFrameworkSystem {
     public void updateNameData (final char gender, final String surname, final String familyName, final String companyName) {\r
        // Set all\r
        this.setGender(gender);\r
-       this.setSurname(surname);\r
-       this.setFamilyName(familyName);\r
-       this.setCompanyName(companyName);\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
@@ -524,44 +560,36 @@ public class BaseContact extends BaseFrameworkSystem {
      * @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 comment) {\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
-       this.setPhoneNumber(phoneNumber);\r
-       this.setCellphoneNumber(cellphoneNumber);\r
-       this.setFaxNumber(faxNumber);\r
-       this.setEmailAddress(emailAddress);\r
-       this.setComment(comment);\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
-     * "Serializes" this object into a CSV string (this time with semicolons)\r
-     * \r
-     * @return "CSV-serialized" version of the stored data\r
+     * Enables the flag "own data" which signals that this contact is the user's\r
+     * own 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
+    protected void enableFlagOwnContact () {\r
+       this.ownContact = true;\r
     }\r
 }\r