* the equal() method is implemented and checks all fields.
* <p>
* @param contact Contact one
- * @param other Contact two
+ * @param other Contact two
* <p>
* @return Whether both are the same
*/
(Objects.equals(contact.getContactZipCode(), other.getContactZipCode())));
}
- /**
- * Updates mobile data in contact instance. This method also removes the
- * mobile instance if no provider is selected. A bean (mostly EJB) should
- * then make sure that the mobile entry is being unlinked from contact
- * instance or being removed, if no longer used.
- * <p>
- * @param contact Contact instance to update
- * @param mobileProvider New mobile provider (or old)
- * @param mobileNumber New mobile number (or old)
- * <p>
- * @return Whether the mobile has been unlinked in contact object
- */
- public static boolean updateCellPhoneNumber (final Contact contact, final MobileProvider mobileProvider, final Long mobileNumber) {
- // At least contact must be valid
- if (null == contact) {
- // Throw NPE
- throw new NullPointerException("contact is null"); //NOI18N
- } else if ((mobileProvider instanceof MobileProvider) && (null == mobileNumber)) {
- // Mobile provider given, but no number
- throw new NullPointerException("mobileNumber is null"); //NOI18N
- }
-
- // Default is not unlinked
- boolean isUnlinked = false;
-
- // Is there a mobile number?
- if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
- // Is provider null?
- if ((null == mobileProvider) || (null == mobileNumber) || (mobileNumber == 0)) {
- // Remove instance
- contact.setContactMobileNumber(null);
-
- // Mark as unlinked
- isUnlinked = true;
- } else {
- // Yes, then update as well
- contact.getContactMobileNumber().setMobileProvider(mobileProvider);
- contact.getContactMobileNumber().setPhoneNumber(mobileNumber);
- }
- } else if ((mobileProvider instanceof MobileProvider) && (mobileNumber > 0)) {
- // Create new instance
- DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber);
-
- // Set it in contact
- contact.setContactMobileNumber(mobile);
- }
-
- // Return status
- return isUnlinked;
- }
-
/**
* Updates land-line data in contact instance. This method also removes the
* land-line instance if no country is selected. A bean (mostly EJB) should
* then make sure that the land-line entry is being unlinked from contact
* instance or being removed, if no longer used.
* <p>
- * @param contact Contact instance being updated
- * @param faxCountry Updated fax number or null
+ * @param contact Contact instance being updated
+ * @param faxCountry Updated fax number or null
* @param faxAreaCode Updated fax area code or null
- * @param faxNumber Updated fax number
+ * @param faxNumber Updated fax number
* <p>
* @return Whether the fax number has been unlinked in contact object
*/
* then make sure that the land-line entry is being unlinked from contact
* instance or being removed, if no longer used.
* <p>
- * @param contact Contact instance being updated
- * @param phoneCountry New phone country or old or null
+ * @param contact Contact instance being updated
+ * @param phoneCountry New phone country or old or null
* @param phoneAreaCode New phone's area code (or old)
- * @param phoneNumber New phone number (or old)
+ * @param phoneNumber New phone number (or old)
* <p>
* @return Whether the land-line number has been unlinked in contact object
*/
return isUnlinked;
}
+ /**
+ * Updates mobile data in contact instance. This method also removes the
+ * mobile instance if no provider is selected. A bean (mostly EJB) should
+ * then make sure that the mobile entry is being unlinked from contact
+ * instance or being removed, if no longer used.
+ * <p>
+ * @param contact Contact instance to update
+ * @param mobileProvider New mobile provider (or old)
+ * @param mobileNumber New mobile number (or old)
+ * <p>
+ * @return Whether the mobile has been unlinked in contact object
+ */
+ public static boolean updateMobileNumber (final Contact contact, final MobileProvider mobileProvider, final Long mobileNumber) {
+ // At least contact must be valid
+ if (null == contact) {
+ // Throw NPE
+ throw new NullPointerException("contact is null"); //NOI18N
+ } else if ((mobileProvider instanceof MobileProvider) && (null == mobileNumber)) {
+ // Mobile provider given, but no number
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
+ }
+
+ // Default is not unlinked
+ boolean isUnlinked = false;
+
+ // Is there a mobile number?
+ if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
+ // Is provider null?
+ if ((null == mobileProvider) || (null == mobileNumber) || (mobileNumber == 0)) {
+ // Remove instance
+ contact.setContactMobileNumber(null);
+
+ // Mark as unlinked
+ isUnlinked = true;
+ } else {
+ // Yes, then update as well
+ contact.getContactMobileNumber().setMobileProvider(mobileProvider);
+ contact.getContactMobileNumber().setPhoneNumber(mobileNumber);
+ }
+ } else if ((mobileProvider instanceof MobileProvider) && (mobileNumber > 0)) {
+ // Create new instance
+ DialableMobileNumber mobile = new MobileNumber(mobileProvider, mobileNumber);
+
+ // Set it in contact
+ contact.setContactMobileNumber(mobile);
+ }
+
+ // Return status
+ return isUnlinked;
+ }
+
/**
* Private constructor for utilities
*/