]> git.mxchange.org Git - jaddressbook-share-lib.git/commitdiff
These update methods were somewhere lame, so better take data-setters. Object-instanc...
authorRoland Haeder <roland@mxchange.org>
Thu, 6 Aug 2015 12:15:36 +0000 (14:15 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 6 Aug 2015 12:15:36 +0000 (14:15 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
Addressbook/src/org/mxchange/addressbook/contact/user/UserContact.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java

index c64ac7f2b0b06c52667d21390bb94044170f7016..3dbb7020d835d67af3ea0d346d8cfc9c31f9cc0a 100644 (file)
@@ -168,8 +168,8 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                // Get manager and cast it
                ManageableContact manager = (ManageableContact) this.getManager();
 
-               // Own address data
-               String street = manager.enterOwnStreet();
+               // Own street and number
+               String streetNumber = manager.enterOwnStreet();
 
                // Get zip code
                int zipCode = manager.enterOwnZipCode();
@@ -181,7 +181,10 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                String countryCode = manager.enterOwnCountryCode();
 
                // Update address data
-               contact.updateAddressData(street, zipCode, city, countryCode);
+               contact.setStreet(streetNumber);
+               contact.setZipCode(zipCode);
+               contact.setCity(city);
+               contact.setCountryCode(countryCode);
 
                // Trace message
                this.getLogger().trace("EXIT!"); //NOI18N
@@ -220,7 +223,10 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                String companyName = manager.enterOwnCompanyName();
 
                // Update contact instance
-               contact.updateNameData(gender, surname, familyName, companyName);
+               contact.setGender(gender);
+               contact.setSurname(surname);
+               contact.setFamilyName(familyName);
+               contact.setCompanyName(companyName);
 
                // Trace message
                this.getLogger().trace("EXIT!"); //NOI18N
@@ -250,7 +256,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                String phoneNumber = manager.enterOwnPhoneNumber();
 
                // Phone number
-               String cellNumber = manager.enterOwnCellNumber();
+               String cellphonePhoneNumber = manager.enterOwnCellNumber();
 
                // Fax number
                String faxNumber = manager.enterOwnFaxNumber();
@@ -262,7 +268,11 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                String comment = manager.enterOwnComment();
 
                // Update contact instance
-               contact.updateOtherData(phoneNumber, cellNumber, faxNumber, email, null, comment);
+               contact.setPhoneNumber(phoneNumber);
+               contact.setCellphoneNumber(cellphonePhoneNumber);
+               contact.setFaxNumber(faxNumber);
+               contact.setEmailAddress(email);
+               contact.setComment(comment);
 
                // Trace message
                this.getLogger().trace("EXIT!"); //NOI18N
index cd9881744905c361d9d6c2abfa657c80016da35a..d03a6d6f987cb35bbeecaf97abc2e432d65dd6b3 100644 (file)
@@ -17,9 +17,9 @@
 package org.mxchange.addressbook.contact.user;
 
 import java.text.MessageFormat;
+import org.mxchange.addressbook.contact.book.BookContact;
 import org.mxchange.jcore.contact.Contact;
 import org.mxchange.jcore.contact.Gender;
-import org.mxchange.addressbook.contact.book.BookContact;
 import org.mxchange.jcore.database.storage.csv.StoreableCsv;
 
 /**
@@ -47,7 +47,10 @@ public class UserContact extends BookContact implements Contact, StoreableCsv {
                this.getLogger().trace(MessageFormat.format("gender={0},surname={1},familyName={2},companyName={3} - CALLED!", gender, surname, familyName, companyName)); //NOI18N
 
                // Update all data
-               this.updateNameData(gender, surname, familyName, companyName);
+               this.setGender(gender);
+               this.setSurname(surname);
+               this.setFamilyName(familyName);
+               this.setCompanyName(companyName);
 
                // Trace message
                this.getLogger().trace("EXIT!"); //NOI18N
index 6c83b8954bf5fc84f479704af6d5f6d7a21f1740..8280ad02e866bbecf29157d64027ea00b18d009a 100644 (file)
@@ -415,7 +415,7 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateNameData(gender, null, null, null);
+                                       contact.setGender(gender);
                                        break;
 
                                case 2: // Surname
@@ -423,7 +423,7 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
                                        assert (gender instanceof Gender) : "gender instance is not set"; //NOI18N
 
                                        // Update data
-                                       contact.updateNameData(gender, strippedToken, null, null);
+                                       contact.setSurname(strippedToken);
                                        break;
 
                                case 3: // Family name
@@ -431,7 +431,7 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
                                        assert (gender instanceof Gender) : "gender instance is not set"; //NOI18N
 
                                        // Update data
-                                       contact.updateNameData(gender, null, strippedToken, null);
+                                       contact.setFamilyName(strippedToken);
                                        break;
 
                                case 4: // Company name
@@ -439,77 +439,77 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
                                        assert (gender instanceof Gender) : "gender instance is not set"; //NOI18N
 
                                        // Update data
-                                       contact.updateNameData(gender, null, null, strippedToken);
+                                       contact.setCompanyName(strippedToken);
                                        break;
 
                                case 5: // Street number
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateAddressData(strippedToken, 0, null, null);
+                                       contact.setHouseNumber(num);
                                        break;
 
                                case 6: // ZIP code
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateAddressData(null, num, null, null);
+                                       contact.setZipCode(num);
                                        break;
 
                                case 7: // City name
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateAddressData(null, 0, strippedToken, null);
+                                       contact.setCity(strippedToken);
                                        break;
 
                                case 8: // Country code
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateAddressData(null, 0, null, strippedToken);
+                                       contact.setCountryCode(strippedToken);
                                        break;
 
                                case 9: // Phone number
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateOtherData(strippedToken, null, null, null, null, null);
+                                       contact.setPhoneNumber(strippedToken);
                                        break;
 
                                case 10: // Fax number
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateOtherData(null, strippedToken, null, null, null, null);
+                                       contact.setFaxNumber(strippedToken);
                                        break;
 
                                case 11: // Cellphone number
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateOtherData(null, null, strippedToken, null, null, null);
+                                       contact.setCellphoneNumber(strippedToken);
                                        break;
 
                                case 12: // Email address
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateOtherData(null, null, null, strippedToken, null, null);
+                                       contact.setEmailAddress(strippedToken);
                                        break;
 
                                case 13: // Birthday
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateOtherData(null, null, null, null, strippedToken, null);
+                                       contact.setBirthday(strippedToken);
                                        break;
 
-                               case 14: // Birthday
+                               case 14: // Comment
                                        assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                        // Update data
-                                       contact.updateOtherData(null, null, null, null, null, strippedToken);
+                                       contact.setComment(strippedToken);
                                        break;
 
                                default: // New data entry