+ this.setCellphoneCarrier(null);
+ this.setCellphoneNumber(null);
+ this.setFaxCountry(null);
+ this.setFaxAreaCode(null);
+ this.setFaxNumber(null);
+
+ // - other data
+ this.setBirthday(null);
+ this.setComment(null);
+ }
+
+ /**
+ * Checks whether the given contact is found
+ * <p>
+ * @param contact Contact inastance
+ *
+ * @return Wether contact has been found
+ */
+ private boolean isSameContactFound (final Contact contact) {
+ // Default is not found
+ boolean IsFound = false;
+
+ // Get iterator
+ Iterator<Contact> iterator = this.allContacts().iterator();
+
+ // Loop through all
+ while (iterator.hasNext()) {
+ // Get next contact
+ Contact next = iterator.next();
+
+ // Is the same?
+ if (ContactUtils.isSameContact(contact, next)) {
+ // Yes, then abort loop
+ IsFound = false;
+ break;
+ }
+ }
+
+ // Return status
+ return IsFound;
+ }
+
+ /**
+ * Updates all data in contact instance.
+ * <p>
+ * @param contact Contact instance
+ */
+ private void updateContactData (final Contact contact) {
+ // Contact instance should be valid
+ if (null == contact) {
+ // Throw NPE
+ throw new NullPointerException("contact is null"); //NOI18N
+ } else if (contact.getContactId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
+ } else if (contact.getContactId() < 1) {
+ // Invalid id
+ throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
+ }
+
+ // Update all fields
+ contact.setContactGender(this.getGender());
+ contact.setContactFirstName(this.getFirstName());
+ contact.setContactFamilyName(this.getFamilyName());
+ contact.setContactStreet(this.getStreet());
+ contact.setContactHouseNumber(this.getHouseNumber());
+ contact.setContactZipCode(this.getZipCode());
+ contact.setContactCity(this.getCity());
+ contact.setContactCountry(this.getCountry());
+
+ // Update contact's cellphone number
+ this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber());
+
+ // Update contact's land-line number
+ this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+
+ // Update contact's fax number
+ this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());