// Is it valid?
if (null == faxNumber) {
// Throw NPE
- throw new NullPointerException("faxNumber is null");
+ throw new NullPointerException("faxNumber is null"); //NOI18N
} else if (faxNumber.getPhoneId() == null) {
// Throw NPE again
- throw new NullPointerException("faxNumber.phoneId is null");
+ throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
} else if (faxNumber.getPhoneId() < 1) {
// Throw NPE again
- throw new NullPointerException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId()));
+ throw new NullPointerException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
}
// Loop through all contacts
// Is it valid?
if (null == landLineNumber) {
// Throw NPE
- throw new NullPointerException("landLineNumber is null");
+ throw new NullPointerException("landLineNumber is null"); //NOI18N
} else if (landLineNumber.getPhoneId() == null) {
// Throw NPE again
- throw new NullPointerException("landLineNumber.phoneId is null");
+ throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
} else if (landLineNumber.getPhoneId() < 1) {
// Throw NPE again
- throw new NullPointerException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId()));
+ throw new NullPointerException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
}
// Loop through all contacts
* @param mobileNumber Mobile number to remove
*/
private void removeFromContacts (final DialableMobileNumber mobileNumber) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
// Is it valid?
if (null == mobileNumber) {
// Throw NPE
- throw new NullPointerException("mobileNumber is null");
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
} else if (mobileNumber.getPhoneId() == null) {
// Throw NPE again
- throw new NullPointerException("mobileNumber.phoneId is null");
+ throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
} else if (mobileNumber.getPhoneId() < 1) {
// Throw NPE again
- throw new NullPointerException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId()));
+ throw new NullPointerException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
}
// Loop through all contacts
for (final Contact contact : this.contacts) {
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1}", this.getClass().getSimpleName(), contact)); //NOI18N
+
// Is the number set?
if (Objects.equals(contact.getContactMobileNumber(), mobileNumber)) {
- // Found it
+ // Log message
+ System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting ...", this.getClass().getSimpleName())); //NOI18N
+
+ // Unset it
contact.setContactMobileNumber(null);
}
}
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.fax.linked.AdminLinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
import org.mxchange.jjobs.beans.BaseJobsController;
import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
this.clear();
}
+ @Override
+ public void afterAdminLinkedFaxNumberEvent (@Observes final AdminLinkedFaxNumberEvent event) {
+ // Is the event fine?
+ if (event == null) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getContact() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact is null");
+ } else if (event.getContact().getContactId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactId is null");
+ } else if (event.getContact().getContactId() < 1) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactId="+ event.getContact().getContactId() + " is invalid");
+ } else if (event.getContact().getContactFaxNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactFaxNumber is null");
+ } else if (event.getContact().getContactFaxNumber().getPhoneId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null");
+ } else if (event.getContact().getContactFaxNumber().getPhoneId() < 1) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactFaxNumber.phoneId="+event.getContact().getContactFaxNumber().getPhoneId() + " is invalid");
+ } else if (event.getLinkedFaxNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.linkedFaxNumer is null");
+ }
+
+ // Log message
+ System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedFaxNumberEvent: event.linkedFaxNumber.phoneId=" + event.getLinkedFaxNumber().getPhoneId());
+
+ // Is the id number in linked number not set?
+ if (event.getLinkedFaxNumber().getPhoneId() == null) {
+ // Log message
+ System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedFaxNumberEvent: Adding to list: "+event.getContact().getContactFaxNumber());
+
+ // Then it is a new number, so add it from contact as there the id number has been set
+ this.uniqueAddFaxNumber(event.getContact().getContactFaxNumber());
+ }
+ }
+
+ @Override
+ public void afterAdminLinkedLandLineNumberEvent (@Observes final AdminLinkedLandLineNumberEvent event) {
+ // Is the event fine?
+ if (event == null) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getContact() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact is null");
+ } else if (event.getContact().getContactId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactId is null");
+ } else if (event.getContact().getContactId() < 1) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactId="+ event.getContact().getContactId() + " is invalid");
+ } else if (event.getContact().getContactLandLineNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactLandLineNumber is null");
+ } else if (event.getContact().getContactLandLineNumber().getPhoneId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null");
+ } else if (event.getContact().getContactLandLineNumber().getPhoneId() < 1) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactLandLineNumber.phoneId="+event.getContact().getContactLandLineNumber().getPhoneId() + " is invalid");
+ } else if (event.getLinkedLandLineNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.linkedLandLineNumer is null");
+ }
+
+ // Log message
+ System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedLandLineNumberEvent: event.linkedLandLineNumber.phoneId=" + event.getLinkedLandLineNumber().getPhoneId());
+
+ // Is the id number in linked number not set?
+ if (event.getLinkedLandLineNumber().getPhoneId() == null) {
+ // Log message
+ System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedLandLineNumberEvent: Adding to list: "+event.getContact().getContactLandLineNumber());
+
+ // Then it is a new number, so add it from contact as there the id number has been set
+ this.uniqueAddLandLineNumber(event.getContact().getContactLandLineNumber());
+ }
+ }
+
+ @Override
+ public void afterAdminLinkedMobileNumberEvent (@Observes final AdminLinkedMobileNumberEvent event) {
+ // Is the event fine?
+ if (event == null) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getContact() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact is null");
+ } else if (event.getContact().getContactId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactId is null");
+ } else if (event.getContact().getContactId() < 1) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactId="+ event.getContact().getContactId() + " is invalid");
+ } else if (event.getContact().getContactMobileNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactMobileNumber is null");
+ } else if (event.getContact().getContactMobileNumber().getPhoneId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactMobileNumber.phoneId is null");
+ } else if (event.getContact().getContactMobileNumber().getPhoneId() < 1) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactMobileNumber.phoneId="+event.getContact().getContactMobileNumber().getPhoneId() + " is invalid");
+ } else if (event.getLinkedMobileNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.linkedMobileNumer is null");
+ }
+
+ // Log message
+ System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedMobileNumberEvent: event.linkedMobileNumber.phoneId=" + event.getLinkedMobileNumber().getPhoneId());
+
+ // Is the id number in linked number not set?
+ if (event.getLinkedMobileNumber().getPhoneId() == null) {
+ // Log message
+ System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedMobileNumberEvent: Adding to list: "+event.getContact().getContactMobileNumber());
+
+ // Then it is a new number, so add it from contact as there the id number has been set
+ this.uniqueAddMobileNumber(event.getContact().getContactMobileNumber());
+ }
+ }
+
@Override
public void afterAdminUpdatedContactDataEvent (@Observes final AdminUpdatedContactEvent event) {
// event should not be null
import javax.ejb.Local;
import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.fax.linked.AdminLinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEvent;
void afterAdminAddedContactEvent (final AdminAddedContactEvent event);
/**
- * Observes events being fired when an administrator has deleted a fax number
+ * Observes events being fired when an administrator has deleted a fax
+ * number
* <p>
* @param event Event being fired
*/
void afterAdminDeletedFaxNumberEvent (final AdminDeletedFaxNumberEvent event);
/**
- * Observes events being fired when an administrator has deleted a land-line number
+ * Observes events being fired when an administrator has deleted a land-line
+ * number
* <p>
* @param event Event being fired
*/
void afterAdminDeletedLandLineNumberEvent (final AdminDeletedLandLineNumberEvent event);
/**
- * Observes events being fired when an administrator has deleted a mobile number
+ * Observes events being fired when an administrator has deleted a mobile
+ * number
* <p>
* @param event Event being fired
*/
void afterAdminDeletedMobileNumberEvent (final AdminDeletedMobileNumberEvent event);
+ /**
+ * Observes events being fired when an administrator has a linked a fax
+ * number
+ * <p>
+ * @param event Event being fired
+ */
+ void afterAdminLinkedFaxNumberEvent (final AdminLinkedFaxNumberEvent event);
+
+ /**
+ * Observes events being fired when an administrator has a linked a
+ * land-line number
+ * <p>
+ * @param event Event being fired
+ */
+ void afterAdminLinkedLandLineNumberEvent (final AdminLinkedLandLineNumberEvent event);
+
+ /**
+ * Observes events being fired when an administrator has a linked a mobile
+ * number
+ * <p>
+ * @param event Event being fired
+ */
+ void afterAdminLinkedMobileNumberEvent (final AdminLinkedMobileNumberEvent event);
+
/**
* Observes events being fired when an administrator has updated a fax
* number.