/*
- * Copyright (C) 2016 - 2018 Free Software Foundation
+ * Copyright (C) 2016 - 2020 Free Software Foundation
*
* 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
* @param contact2 Contact instance 2
* <p>
* @return Comparison value
- * <p>
- * @throws NullPointerException If first instance is null
*/
public static int compare (final Contact contact1, final Contact contact2) {
// Check euqality, then at least first must be given
// Both are same
return 0;
} else if (null == contact1) {
- // First cannot be null
- throw new NullPointerException("contact1 is null"); //NOI18N
+ // First is null
+ return -1;
} else if (null == contact2) {
// Second is null
- return -1;
+ return 1;
}
// Invoke compareTo() method
* @param sourceContact Source instance
* @param targetContact Target instance
*/
- public static void copyAll (final Contact sourceContact, final Contact targetContact) {
+ public static void copyContactData (final Contact sourceContact, final Contact targetContact) {
// Contact should be valid
if (null == sourceContact) {
// Throw NPE
// - other data
targetContact.setContactBirthday(sourceContact.getContactBirthday());
targetContact.setContactComment(sourceContact.getContactComment());
- targetContact.setContactCreated(sourceContact.getContactCreated());
- targetContact.setContactUpdated(sourceContact.getContactUpdated());
+ targetContact.setContactEntryUpdated(sourceContact.getContactEntryUpdated());
}
/**
}
} else if ((faxCountry instanceof Country) && (faxAreaCode > 0) && (faxNumber > 0)) {
// Set new land-line number
- DialableFaxNumber fax = new FaxNumber(faxCountry, faxAreaCode, faxNumber);
+ final DialableFaxNumber fax = new FaxNumber(faxCountry, faxAreaCode, faxNumber);
// Set it in contact
contact.setContactFaxNumber(fax);
}
} else if ((phoneCountry instanceof Country) && (phoneAreaCode > 0) && (phoneNumber > 0)) {
// Set new land-line number
- DialableLandLineNumber landLine = new LandLineNumber(phoneCountry, phoneAreaCode, phoneNumber);
+ final DialableLandLineNumber landLine = new LandLineNumber(phoneCountry, phoneAreaCode, phoneNumber);
// Set it in contact
contact.setContactLandLineNumber(landLine);
} else {
// Yes, then update as well
contact.getContactMobileNumber().setMobileProvider(mobileProvider);
- contact.getContactMobileNumber().setPhoneNumber(mobileNumber);
+ contact.getContactMobileNumber().setMobileNumber(mobileNumber);
}
} else if ((mobileProvider instanceof MobileProvider) && (mobileNumber > 0)) {
// Create new instance
- DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber);
+ final DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber);
// Set it in contact
contact.setContactMobileNumber(mobile);