]> git.mxchange.org Git - jfinancials-swing.git/commitdiff
Moved more stuff to jcore project as they can be generalized
authorRoland Haeder <roland@mxchange.org>
Thu, 6 Aug 2015 11:47:33 +0000 (13:47 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 6 Aug 2015 11:47:33 +0000 (13:47 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

16 files changed:
Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java
Addressbook/src/org/mxchange/addressbook/client/AddressbookClient.java
Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java
Addressbook/src/org/mxchange/addressbook/client/gui/ClientFrame.java
Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Addressbook/src/org/mxchange/addressbook/contact/BaseContact.java [deleted file]
Addressbook/src/org/mxchange/addressbook/contact/Contact.java [deleted file]
Addressbook/src/org/mxchange/addressbook/contact/Gender.java [deleted file]
Addressbook/src/org/mxchange/addressbook/contact/book/BookContact.java
Addressbook/src/org/mxchange/addressbook/contact/user/UserContact.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactFrontend.java
Addressbook/src/org/mxchange/addressbook/exceptions/ContactAlreadyAddedException.java
Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java
Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java

index 9780aedd4e23cafabb8c6c8620c947818c502fea..66834d9bd750aaa62262e33257f53f5b9370d86b 100644 (file)
@@ -128,11 +128,6 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
         */
        public static final String APP_VERSION = "0.0"; //NOI18N
 
-       /**
-        * Self instance
-        */
-       private static Application selfInstance;
-
        /**
         * Console client is enabled by default
         */
@@ -147,9 +142,6 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
         * Protected constructor
         */
        protected AddressbookApplication () {
-               // Set own instance
-               selfInstance = this;
-
                // Always init i18n bundle in this application
                this.initBundle();
        }
@@ -369,14 +361,4 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
                this.getLogger().info("End of program (last line)"); //NOI18N
                System.exit(0);
        }
-
-       /**
-        * Getter for this application
-        *
-        * @return Instance from this application
-        */
-       public static final Application getInstance () {
-               // Return it
-               return selfInstance;
-       }
 }
index 15732f27640991204f7fea1718314fe550cb955a..dde3c17332c03cc17eb924a1e1dd8a66fbc6712e 100644 (file)
  */
 package org.mxchange.addressbook.client;
 
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
 
 /**
@@ -29,13 +29,6 @@ import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
  */
 public interface AddressbookClient extends Client {
 
-       /**
-        * Displays a "box" for the address
-        *
-        * @param contact Contact to show address from
-        */
-       public void displayAddressBox (final Contact contact);
-
        /**
         * The user changes own name data
         *
@@ -72,20 +65,6 @@ public interface AddressbookClient extends Client {
         */
        public Gender enterGender (final String message);
 
-       /**
-        * Displays a "box" for the name
-        *
-        * @param contact Contact to show name from
-        */
-       public void displayNameBox (final Contact contact);
-
-       /**
-        * Displays a "box" for other data
-        *
-        * @param contact Contact to show other data from
-        */
-       public void displayOtherDataBox (final Contact contact);
-
        /**
         * Let the user choose what to change on the address: [n]ame, [a]ddress,
         * [o]ther
index f376ece22cbf3fce24fd915a9acde7d2998466fc..c64ac7f2b0b06c52667d21390bb94044170f7016 100644 (file)
@@ -22,8 +22,8 @@ import java.util.Scanner;
 import org.mxchange.addressbook.application.AddressbookApplication;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.BaseAddressbookClient;
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.addressbook.contact.user.UserContact;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.addressbook.manager.contact.ManageableContact;
index 8dcddcbeb3937a2c3c140dee09e55d156270d082..7a72c690b6babaa807e0d7abf28fa6126c952d30 100644 (file)
@@ -46,8 +46,8 @@ import javax.swing.border.TitledBorder;
 import javax.swing.table.TableModel;
 import org.mxchange.addressbook.BaseAddressbookSystem;
 import org.mxchange.addressbook.application.AddressbookApplication;
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.addressbook.manager.contact.ManageableContact;
 import org.mxchange.addressbook.model.contact.ContactTableModel;
index e7500e844ab5c4b14a8c5e56a968bdc2e900d0cd..61cfc42e6b6b40168abf575ec03b3745423d0f9d 100644 (file)
@@ -16,7 +16,7 @@
  */
 package org.mxchange.addressbook.client.gui;
 
-import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.jcore.contact.Contact;
 import org.mxchange.jcore.FrameworkInterface;
 import org.mxchange.jcore.client.Client;
 import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
index 27b98de9790abd08bb1f3d7fc2fc586903a2b4ef..90750c9e29a0bfb2ed5bca58c5e6b71c384327d7 100644 (file)
@@ -18,8 +18,8 @@ package org.mxchange.addressbook.client.gui;
 
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.BaseAddressbookClient;
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.jcore.application.Application;
diff --git a/Addressbook/src/org/mxchange/addressbook/contact/BaseContact.java b/Addressbook/src/org/mxchange/addressbook/contact/BaseContact.java
deleted file mode 100644 (file)
index 4e590c2..0000000
+++ /dev/null
@@ -1,685 +0,0 @@
-/*
- * 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.text.MessageFormat;
-import java.util.Objects;
-import org.mxchange.addressbook.BaseAddressbookSystem;
-import org.mxchange.addressbook.client.AddressbookClient;
-import org.mxchange.jcore.client.Client;
-
-/**
- * A general contact
- *
- * @author Roland Haeder
- * @version 0.0
- */
-public class BaseContact extends BaseAddressbookSystem {
-
-       /**
-        * 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 instance
-        */
-       private Gender 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 () {
-       }
-
-       /**
-        * 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 (final 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().equals(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
-        * @deprecated Don't use this anymore
-        */
-       @Deprecated
-       public String getCsvStringFromStoreableObject () {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Get all together
-               String csvString = String.format(
-                               "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"", //NOI18N
-                               this.isOwnContact(),
-                               this.getGender().getDatabaseValue(),
-                               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 Gender getGender () {
-               return this.gender;
-       }
-
-       /**
-        * Gender of the contact
-        *
-        * @param gender the gender to set
-        */
-       private void setGender (final Gender 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 () {
-               // "Translate" it
-               String translated = this.getBundle().getString(this.getGender().getMessageKey());
-
-               // 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 () {
-               // Validate gender instance
-               assert (this.getGender() instanceof Gender) : "gender is not set.";
-
-               int hash = 7;
-               hash = 79 * hash + Objects.hashCode(this.getFamilyName());
-               hash = 79 * hash + this.getGender().hashCode();
-               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) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("client={0} - CALLED!", client)); //NOI18N
-
-               // The client must be set
-               if (client == null) {
-                       // Not set
-                       throw new NullPointerException("client is null");
-               }
-
-               // Cast client
-               AddressbookClient c = (AddressbookClient) client;
-
-               // Display name "box"
-               c.displayNameBox((Contact) this);
-
-               // Display address "box"
-               c.displayAddressBox((Contact) this);
-
-               // Display other data "box"
-               c.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) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("street={0},zipCode={1},city={2},countryCode={3} - CALLED!", street, zipCode, city, countryCode)); //NOI18N
-
-               // 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);
-               }
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * 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 Gender gender, final String surname, final String familyName, final String companyName) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("gender={0},surname={1},familyName={2},companyName={3} - CALLED!", gender, surname, familyName, companyName)); //NOI18N
-
-               // Set all
-               this.setGender(gender);
-
-               if (surname != null) {
-                       this.setSurname(surname);
-               }
-               if (familyName != null) {
-                       this.setFamilyName(familyName);
-               }
-               if (companyName != null) {
-                       this.setCompanyName(companyName);
-               }
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * 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) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("phoneNumber={0},cellphoneNumber={1}faxNumber={2},emailAddress={3},birthday={4},comment={5} - CALLED!", phoneNumber, cellphoneNumber, faxNumber, emailAddress, birthday, comment)); //NOI18N
-
-               // 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);
-               }
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * 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;
-       }
-
-       /**
-        * Some "getter for a value from given column name. This name will be
-        * translated into a method name and then this method is called.
-        *
-        * @param columnName Column name
-        * @return Value from field
-        */
-       @Override
-       public Object getValueFromColumn (final String columnName) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName));
-               
-               // Determine if the given column is boolean
-               if (this.isBooleanField(this, "BaseContact", columnName)) {
-                       // Yes, then call other method
-                       return this.getBooleanField(this, "BaseContact", columnName);
-               }
-               
-               // Convert column name to field name
-               String methodName = this.convertColumnNameToGetterMethod(columnName, false);
-               
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("field={0}", methodName));
-               
-               // Get field
-               Object value = this.getField(this, "BaseContact", methodName);
-               
-               // Trace message
-               this.getLogger().trace("value=" + value + " - EXIT!");
-               
-               // Return it
-               return value;
-       }
-
-       /**
-        * Checks if given boolean field is available and set to same value
-        *
-        * @param columnName Column name to check
-        * @param bool Boolean value
-        * @return Whether all conditions are met
-        */
-       @Override
-       public boolean isValueEqual (final String columnName, final boolean bool) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0},bool={1} - CALLED!", columnName, bool));
-               
-               // Convert column name to field name
-               String methodName = this.convertColumnNameToGetterMethod(columnName, true);
-               
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("field={0}", methodName));
-               
-               // Init class instance
-               boolean value = this.getBooleanField(this, "BaseContact", methodName);
-               
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("value={0}", value));
-               
-               // Compare it
-               boolean isFound = (bool == value);
-               
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("isFound={0} - EXIT!", isFound));
-               
-               // Return result
-               return isFound;
-       }
-}
diff --git a/Addressbook/src/org/mxchange/addressbook/contact/Contact.java b/Addressbook/src/org/mxchange/addressbook/contact/Contact.java
deleted file mode 100644 (file)
index 629e796..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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 org.mxchange.jcore.FrameworkInterface;
-import org.mxchange.jcore.client.Client;
-
-/**
- *
- * @author Roland Haeder
- */
-public interface Contact extends FrameworkInterface {
-
-       /**
-        * Some "getter" for translated gender of the contact
-        *
-        * @return Translated / human-readable gender
-        */
-       public String getTranslatedGender ();
-
-       /**
-        * Checks whether the contact is user's own data
-        *
-        * @return Own data?
-        */
-       public boolean isOwnContact ();
-
-       /**
-        * Gender of the contact
-        *
-        * @return the gender
-        */
-       public Gender getGender ();
-
-       /**
-        * Surname
-        *
-        * @return the surname
-        */
-       public String getSurname ();
-
-       /**
-        * Family name
-        *
-        * @return the familyName
-        */
-       public String getFamilyName ();
-
-       /**
-        * Companyname
-        *
-        * @return the companyName
-        */
-       public String getCompanyName ();
-
-       /**
-        * Street
-        *
-        * @return the street
-        */
-       public String getStreet ();
-
-       /**
-        * House number
-        *
-        * @return the houseNumber
-        */
-       public int getHouseNumber ();
-
-       /**
-        * ZIP code
-        *
-        * @return the zipCode
-        */
-       public long getZipCode ();
-
-       /**
-        * City
-        *
-        * @return the city
-        */
-       public String getCity ();
-
-       /**
-        * Country code
-        *
-        * @return the countryCode
-        */
-       public String getCountryCode ();
-
-       /**
-        * Email address
-        *
-        * @return the emailAddress
-        */
-       public String getEmailAddress ();
-
-       /**
-        * Phone number
-        *
-        * @return the phoneNumber
-        */
-       public String getPhoneNumber ();
-
-       /**
-        * Fax number
-        *
-        * @return the faxNumber
-        */
-       public String getFaxNumber ();
-
-       /**
-        * Cellphone number
-        *
-        * @return the cellphoneNumber
-        */
-       public String getCellphoneNumber ();
-
-       /**
-        * Birth day
-        *
-        * @return the birthday
-        */
-       public String getBirthday ();
-
-       /**
-        * Comments
-        *
-        * @return the comment
-        */
-       public String getComment ();
-
-       /**
-        * Checks if given boolean value is available and set to same value
-        *
-        * @param columnName Column name to check
-        * @param bool Boolean value
-        * @return Whether all conditions are met
-        */
-       public boolean isValueEqual (final String columnName, final boolean bool);
-
-       /**
-        * Shows the contact to the user
-        *
-        * @param client Client instance to call back
-        */
-       public void show (final Client client);
-
-       /**
-        * 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);
-
-       /**
-        * 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 Gender gender, final String surname, final String familyName, final String companyName);
-
-       /**
-        * Updates other data in this Contact instance
-        *
-        * @param phoneNumber Phone number
-        * @param cellNumber Cellphone number
-        * @param faxNumber Fax number
-        * @param email Email address
-        * @param birthday Birthday
-        * @param comment Comments
-        */
-       public void updateOtherData (final String phoneNumber, final String cellNumber, final String faxNumber, final String email, final String birthday, final String comment);
-}
diff --git a/Addressbook/src/org/mxchange/addressbook/contact/Gender.java b/Addressbook/src/org/mxchange/addressbook/contact/Gender.java
deleted file mode 100644 (file)
index cdfab04..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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 org.mxchange.addressbook.application.AddressbookApplication;
-
-/**
- * Gender enum
- *
- * @author Roland Haeder
- */
-public enum Gender {
-
-       /**
-        * Unknown enum
-        */
-       UNKNOWN("U", "BaseContact.gender.unknown.text"),
-       /**
-        * Male enum
-        */
-       MALE("M", "BaseContact.gender.male.text"),
-       /**
-        * Female enum
-        */
-       FEMALE("F", "BaseContact.gender.female.text"),
-       /**
-        * Company enum
-        */
-       COMPANY("C", "BaseContact.gender.company.text");
-
-       /**
-        * Cache for valid chars
-        */
-       private static char[] validChars;
-
-       /**
-        * Getter for Gender enum from given character
-        *
-        * @param gender Gender character
-        * @return Gender enum
-        */
-       public static Gender fromChar (final char gender) {
-               Gender g = null;
-               switch (gender) {
-                       case 'U': // Unknown
-                               g = UNKNOWN;
-                               break;
-
-                       case 'M': // Male
-                               g = MALE;
-                               break;
-
-                       case 'F': // Female
-                               g = FEMALE;
-                               break;
-
-                       case 'C': // Company
-                               g = COMPANY;
-                               break;
-
-                       default: // Unsupported
-                               throw new IllegalArgumentException("gender " + gender + " is invalid.");
-               }
-
-               // Return it
-               //* NOISY-DEBUG: */ System.out.println("gender=" + g.getClass().getName());
-               return g;
-       }
-
-       /**
-        * Valid chars
-        *
-        * @return Valid chars
-        */
-       public static char[] validChars () {
-               // Is cache set?
-               if (validChars != null) {
-                       // Return it
-                       return validChars;
-               }
-
-               // Init array
-               char[] valid = new char[3];
-
-               // Get values
-               int i = 0;
-               for (Object value : values()) {
-                       // First cast
-                       Gender gender = (Gender) value;
-
-                       // Debug message
-                       //* NOISY-DEBUG: */ System.out.println("gender=" + gender);
-                       // Is it UNKNOWN?
-                       if (gender.equals(Gender.UNKNOWN)) {
-                               // Skip this
-                               continue;
-                       }
-
-                       // Debug message
-                       //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("gender={0} - adding at pos {1} ...", gender, i));
-                       // Get database value as this is also the access
-                       valid[i] = gender.getDatabaseValue().charAt(0);
-
-                       // Increment index
-                       i++;
-               }
-
-               // Set it here
-               validChars = valid;
-
-               // Return finialized array
-               return valid;
-       }
-
-       /**
-        * Database value
-        */
-       private final String databaseValue;
-
-       /**
-        * Output value (for messages)
-        */
-       private final String messageKey;
-
-       /**
-        * Constructor
-        *
-        * @param databaseValue Value being stored in database
-        * @param messageKey Message key for resource file
-        */
-       private Gender (final String databaseValue, final String messageKey) {
-               // Set both
-               this.databaseValue = databaseValue;
-               this.messageKey = messageKey;
-       }
-
-       /**
-        * Database value
-        *
-        * @return the databaseValue
-        */
-       protected String getDatabaseValue () {
-               return this.databaseValue;
-       }
-
-       /**
-        * Output value (for messages)
-        *
-        * @return the messageKey
-        */
-       protected String getMessageKey () {
-               return this.messageKey;
-       }
-
-       /**
-        * Overwritten to return human-readable strings
-        *
-        * @return Human-readable strings
-        */
-       @Override
-       public String toString () {
-               // Get key from bundle and return it
-               return AddressbookApplication.getInstance().getMessageStringFromKey(this.getMessageKey());
-       }
-}
index 4ac6ccfd57fe4ff869a05b9b4c026f75c219872a..405d3608eefad54f75fd34de70486ed23ad9cf48 100644 (file)
@@ -16,8 +16,8 @@
  */
 package org.mxchange.addressbook.contact.book;
 
-import org.mxchange.addressbook.contact.BaseContact;
-import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.jcore.contact.BaseContact;
+import org.mxchange.jcore.contact.Contact;
 import org.mxchange.jcore.database.storage.csv.StoreableCsv;
 
 /**
index be19701fe3a2c1f4d2e7087f17b435b7e567fe43..cd9881744905c361d9d6c2abfa657c80016da35a 100644 (file)
@@ -17,8 +17,8 @@
 package org.mxchange.addressbook.contact.user;
 
 import java.text.MessageFormat;
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
+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;
 
index 3731a144453c47d22906aa3e5deda3a807b9ca32..6c83b8954bf5fc84f479704af6d5f6d7a21f1740 100644 (file)
@@ -21,8 +21,8 @@ import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.StringTokenizer;
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.addressbook.contact.book.BookContact;
 import org.mxchange.addressbook.contact.user.UserContact;
 import org.mxchange.addressbook.database.contact.ContactDatabaseConstants;
index 90aff3b2dcb3b3c45a53c7e332dc57a6ebf301f2..0630391edc74ac2cc768f49555319bdcfc078e12 100644 (file)
@@ -17,7 +17,7 @@
 package org.mxchange.addressbook.database.frontend.contact;
 
 import java.sql.SQLException;
-import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.jcore.contact.Contact;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcore.database.frontend.DatabaseFrontend;
 import org.mxchange.jcore.exceptions.BadTokenException;
index 1bfcf18b62d2bf3bea0d1ad89b6ea15726389987..634f4b4d08bdfc747491a6a91087cab96fb8ec5f 100644 (file)
@@ -17,7 +17,7 @@
 package org.mxchange.addressbook.exceptions;
 
 import java.text.MessageFormat;
-import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.jcore.contact.Contact;
 
 /**
  * Thrown if the given Contact instance is already added
index 4191f0c6d0b39d328cb93726d28d902252bbb8d2..3ab62fc77b44f2e147297a6c2ccf2592f81fc0b6 100644 (file)
@@ -23,8 +23,8 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import org.mxchange.addressbook.client.AddressbookClient;
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.addressbook.database.frontend.contact.ContactDatabaseFrontend;
 import org.mxchange.addressbook.database.frontend.contact.ContactFrontend;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
index cc22934f816c48a687467cedf39feed060adb7bb..277ae35f99ef8efb023e72a7cb0502f2fcc97a26 100644 (file)
@@ -16,8 +16,8 @@
  */
 package org.mxchange.addressbook.manager.contact;
 
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcore.manager.Manageable;