+ }
+
+ /**
+ * Compares two contacts with each other
+ *
+ * @param contact Contact comparator
+ * @return Comparison value
+ */
+ @Override
+ public int compareTo (final Contact contact) {
+ // contact should not be null
+ if (null == contact) {
+ throw new NullPointerException("contact is null"); //NOI18N
+ }
+
+ // Is the id the same?
+ if (Objects.equals(this.getId(), contact.getId())) {
+ // Same id, means same contact
+ return 0;
+ } else if (this.getId() > contact.getId()) {
+ // This id is larger than compared to
+ return -1;
+ }
+
+ // The other id is larger
+ return 1;
+ }
+
+ @Override
+ public void copyAll (final Contact contact) {
+ // Copy all:
+ // - base data
+ this.setFirstName(contact.getFirstName());
+ this.setFamilyName(contact.getFamilyName());
+ this.setCompanyName(contact.getCompanyName());
+ this.setStreet(contact.getStreet());
+ this.setZipCode(contact.getZipCode());
+ this.setCity(contact.getCity());
+ this.setCountryCode(contact.getCountryCode());
+
+ // - phone, fax, email
+ this.setPhoneNumber(contact.getPhoneNumber());
+ this.setFaxNumber(contact.getFaxNumber());
+ this.setCellphoneNumber(contact.getCellphoneNumber());
+
+ // - other data
+ this.setBirthday(contact.getBirthday());
+ this.setComment(contact.getComment());
+ this.setCreated(contact.getCreated());
+ this.setUpdated(contact.getUpdated());