--- /dev/null
+/*
+ * Copyright (C) 2016 - 2022 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.mobile;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+import javax.faces.application.FacesMessage;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.mobile.list.JobsMobileListWebViewController;
+import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
+import org.mxchange.jphone.events.mobile.deleted.AdminMobileNumberDeletedEvent;
+import org.mxchange.jphone.events.mobile.deleted.ObservableAdminMobileNumberDeletedEvent;
+import org.mxchange.jphone.events.mobile.remove.AdminMobileNumberRemovedFromListEvent;
+import org.mxchange.jphone.events.mobile.remove.ObservableAdminMobileNumberRemovedFromListEvent;
+import org.mxchange.jphone.events.mobile.updated.AdminMobileNumberUpdatedEvent;
+import org.mxchange.jphone.events.mobile.updated.ObservableAdminMobileNumberUpdatedEvent;
+import org.mxchange.jphone.model.phonenumbers.mobile.AdminMobileSessionBeanRemote;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+
+/**
+ * Administrative bean (controller) for mobile numbers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminMobileController")
+@RequestScoped
+public class JobsAdminMobileWebRequestBean extends BaseJobsBean implements JobsAdminMobileWebRequestController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 184_598_175_371_269_017L;
+
+ /**
+ * Remote EJB for phone number (administrative)
+ */
+ @EJB (lookup = "java:global/jjobs-ejb/adminMobile!org.mxchange.jphone.model.phonenumbers.mobile.AdminMobileSessionBeanRemote")
+ private AdminMobileSessionBeanRemote adminMobileBean;
+
+ /**
+ * When the phone entry has been created (persisted)
+ */
+ private Date mobileEntryCreated;
+
+ /**
+ * When the phone entry has been updated
+ */
+ private Date mobileEntryUpdated;
+
+ /**
+ * Mobile id (aka primary key)
+ */
+ private Long mobileId;
+
+ /**
+ * Generic hone controller
+ */
+ @Inject
+ private JobsMobileListWebViewController mobileListController;
+
+ /**
+ * Mobile number
+ */
+ private Long mobileNumber;
+
+ /**
+ * Event being fired when an administrator has deleted mobile number
+ */
+ @Inject
+ @Any
+ private Event<ObservableAdminMobileNumberDeletedEvent> mobileNumberDeletedEvent;
+
+ /**
+ * Event being fired when an administrator has updated land-line number
+ */
+ @Inject
+ @Any
+ private Event<ObservableAdminMobileNumberUpdatedEvent> mobileNumberUpdatedEvent;
+
+ /**
+ * Mobile provider
+ */
+ private MobileProvider mobileProvider;
+
+ /**
+ * Event being fired when a list of all unused mobile numbers is being
+ * created.
+ */
+ @Inject
+ @Any
+ private Event<ObservableAdminMobileNumberRemovedFromListEvent> removeLinkedMobileNumbersEvent;
+
+ /**
+ * Chosen mobile number
+ */
+ private DialableMobileNumber selectedMobileNumber;
+
+ /**
+ * Default constructor
+ */
+ public JobsAdminMobileWebRequestBean () {
+ // Call super constructor
+ super();
+ }
+
+ /**
+ * Observes events being fired when a bean helper has successfully created a
+ * mobile number instance.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
+ // The event instance must be valid
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getMobileNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.mobileNumber is null"); //NOI18N
+ } else if (event.getMobileNumber().getMobileId() == null) {
+ // Throw NPE yet again
+ throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
+ } else if (event.getMobileNumber().getMobileId() < 1) {
+ // Throw NPE yet again
+ throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
+ }
+
+ // Get fax number from event
+ final DialableMobileNumber number = event.getMobileNumber();
+
+ // Copy all data to this bean
+ this.setMobileId(number.getMobileId());
+ this.setMobileProvider(number.getMobileProvider());
+ this.setMobileNumber(number.getMobileNumber());
+ this.setMobileEntryCreated(number.getMobileEntryCreated());
+ this.setMobileEntryUpdated(number.getMobileEntryUpdated());
+ }
+
+ /**
+ * Returns a list of all unused ("non-linked") mobile numbers
+ * <p>
+ * @return List with all unused mobile numbers
+ */
+ public List<DialableMobileNumber> allNonLinkedMobileNumbers () {
+ // Get list of all mobile numbers
+ final List<DialableMobileNumber> numbers = this.mobileListController.getAllMobileNumbers();
+
+ // Visit all controllers to reduce the list
+ this.removeLinkedMobileNumbersEvent.fire(new AdminMobileNumberRemovedFromListEvent(numbers));
+
+ // Return it
+ return numbers;
+ }
+
+ /**
+ * Deletes given mobile entry data
+ */
+ public void deleteMobileData () {
+ // Get mobile number from helper
+ final DialableMobileNumber number = this.createMobileNumber();
+
+ // Is all data set
+ if (number == null) {
+ // Not set, throw NPE
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
+ } else if (number.getMobileId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.mobileId is null"); //NOI18N
+ } else if (number.getMobileId() < 1) {
+ // Invalid number
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileId={0} is not valid", number.getMobileId())); //NOI18N
+ } else if (number.getMobileProvider() == null) {
+ // Throw NPE
+ throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
+ } else if (number.getMobileProvider().getProviderId() == null) {
+ // ... throw again
+ throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
+ } else if (number.getMobileProvider().getProviderId() < 1) {
+ // Id not valid
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
+ } else if (number.getMobileNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
+ } else if (number.getMobileNumber() < 1) {
+ // Throw NPE again
+ throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", number.getMobileNumber())); //NOI18N
+ }
+
+ // Call EJB
+ this.adminMobileBean.deleteMobileData(number);
+
+ // Fire event
+ this.mobileNumberDeletedEvent.fire(new AdminMobileNumberDeletedEvent(number));
+ }
+
+ /**
+ * Changes mobile entry data
+ * <p>
+ * @return Redirect outcome
+ */
+ public String doUpdateMobileNumber () {
+ // Get mobile number from helper
+ final DialableMobileNumber number = this.createMobileNumber();
+
+ // Is all data set
+ if (number == null) {
+ // Not set, throw NPE
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
+ } else if (number.getMobileId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.mobileId is null"); //NOI18N
+ } else if (number.getMobileId() < 1) {
+ // Invalid number
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileId={0} is not valid", number.getMobileId())); //NOI18N
+ } else if (number.getMobileProvider() == null) {
+ // Throw NPE
+ throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
+ } else if (number.getMobileProvider().getProviderId() == null) {
+ // ... throw again
+ throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
+ } else if (number.getMobileProvider().getProviderId() < 1) {
+ // Id not valid
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
+ } else if (number.getMobileNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
+ } else if (number.getMobileNumber() < 1) {
+ // Throw NPE again
+ throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", number.getMobileNumber())); //NOI18N
+ } else if (this.getMobileProvider() == null) {
+ // Throw NPE again
+ throw new NullPointerException("this.mobileProvider is null"); //NOI18N
+ } else if (this.getMobileProvider().getProviderId() == null) {
+ // Throw NPE again ...
+ throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N
+ } else if (this.getMobileProvider().getProviderId() < 0) {
+ // Invalid id number
+ throw new IllegalArgumentException(MessageFormat.format("this.mobileProvider.providerId={0} is not valid.", this.getMobileProvider().getProviderId())); //NOI18N
+ } else if (this.getMobileNumber() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.phoneNumber is null"); //NOI18N
+ }
+
+ // Is the mobile provider and number the same?
+ if ((Objects.equals(this.getMobileProvider(), number.getMobileProvider())) && (Objects.equals(this.getMobileNumber(), number.getMobileNumber()))) {
+ // Show message
+ this.showFacesMessage("form_edit_mobile:mobileNumber", "ERROR_ADMIN_NO_CHANGE_ENTERED", FacesMessage.SEVERITY_WARN); //NOI18N
+
+ // No difference in both together, no need to edit
+ return ""; //NOI18N
+ }
+
+ // Set all data
+ number.setMobileProvider(this.getMobileProvider());
+ number.setMobileNumber(this.getMobileNumber());
+
+ // Send to bean
+ final DialableMobileNumber updatedNumber = this.adminMobileBean.updateMobileData(number);
+
+ // Fire event
+ this.mobileNumberUpdatedEvent.fire(new AdminMobileNumberUpdatedEvent(updatedNumber));
+
+ // All fine, redirect
+ return "admin_show_mobile"; //NOI18N
+ }
+
+ /**
+ * Getter for phone entry created timestamp
+ * <p>
+ * @return Mobile entry created timestamp
+ */
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getMobileEntryCreated () {
+ return this.mobileEntryCreated;
+ }
+
+ /**
+ * Setter for phone entry created timestamp
+ * <p>
+ * @param mobileEntryCreated Mobile entry created timestamp
+ */
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setMobileEntryCreated (final Date mobileEntryCreated) {
+ this.mobileEntryCreated = mobileEntryCreated;
+ }
+
+ /**
+ * Getter for phone entry updated timestamp
+ * <p>
+ * @return Mobile entry updated timestamp
+ */
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getMobileEntryUpdated () {
+ return this.mobileEntryUpdated;
+ }
+
+ /**
+ * Setter for phone entry updated timestamp
+ * <p>
+ * @param mobileEntryUpdated Mobile entry updated timestamp
+ */
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setMobileEntryUpdated (final Date mobileEntryUpdated) {
+ this.mobileEntryUpdated = mobileEntryUpdated;
+ }
+
+ /**
+ * Getter for phone id
+ * <p>
+ * @return Mobile id
+ */
+ public Long getMobileId () {
+ return this.mobileId;
+ }
+
+ /**
+ * Setter for phone id
+ * <p>
+ * @param mobileId Mobile id
+ */
+ public void setMobileId (final Long mobileId) {
+ this.mobileId = mobileId;
+ }
+
+ /**
+ * Getter for dial number without prefix
+ * <p>
+ * @return Dial number without prefix
+ */
+ public Long getMobileNumber () {
+ return this.mobileNumber;
+ }
+
+ /**
+ * Setter for dial number without prefix
+ * <p>
+ * @param mobileNumber Dial number without prefix
+ */
+ public void setMobileNumber (final Long mobileNumber) {
+ this.mobileNumber = mobileNumber;
+ }
+
+ /**
+ * Getter for mobile provider
+ * <p>
+ * @return Mobile provider
+ */
+ public MobileProvider getMobileProvider () {
+ return this.mobileProvider;
+ }
+
+ /**
+ * Setter for mobile provider
+ * <p>
+ * @param mobileProvider Mobile provider
+ */
+ public void setMobileProvider (final MobileProvider mobileProvider) {
+ this.mobileProvider = mobileProvider;
+ }
+
+ /**
+ * Getter for chosen mobile number
+ * <p>
+ * @return mobile number
+ */
+ public DialableMobileNumber getSelectedMobileNumber () {
+ return this.selectedMobileNumber;
+ }
+
+ /**
+ * Setter for chosen mobile number
+ * <p>
+ * @param selectedMobileNumber mobile number
+ */
+ public void setSelectedMobileNumber (final DialableMobileNumber selectedMobileNumber) {
+ this.selectedMobileNumber = selectedMobileNumber;
+ }
+
+ /**
+ * Returns an instance of a DialableMobileNumber from all fields stored in
+ * this bean.
+ * <p>
+ * @return An instance of a DialableMobileNumber class
+ */
+ private DialableMobileNumber createMobileNumber () {
+ // Initialize it
+ final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+
+ // Add all other data
+ number.setMobileEntryCreated(this.getMobileEntryCreated());
+ number.setMobileEntryUpdated(this.getMobileEntryUpdated());
+ number.setMobileId(this.getMobileId());
+
+ // Return it
+ return number;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2022 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.mobile.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
+import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jphone.events.mobile.deleted.ObservableAdminMobileNumberDeletedEvent;
+import org.mxchange.jphone.events.mobile.updated.ObservableAdminMobileNumberUpdatedEvent;
+import org.mxchange.jphone.exceptions.mobile.MobileEntityNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileSessionBeanRemote;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+
+/**
+ * Administrative listing controller (bean) for mobile numbers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("mobileListController")
+@ViewScoped
+public class JobsMobileListWebViewBean extends BaseJobsBean implements JobsMobileListWebViewController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 491_058_674_675_690_106L;
+
+ /**
+ * A list of all mobile numbers
+ */
+ private final List<DialableMobileNumber> allMobileNumbers;
+
+ /**
+ * A list of filtered mobile numbers
+ */
+ private List<DialableMobileNumber> filteredMobileNumbers;
+
+ /**
+ * General EJB for mobile numbers
+ */
+ @EJB (lookup = "java:global/jjobs-ejb/mobile!org.mxchange.jphone.model.phonenumbers.mobile.MobileSessionBeanRemote")
+ private MobileSessionBeanRemote mobileBean;
+
+ /**
+ * Cache for mobile numbers
+ */
+ @Inject
+ @NamedCache (cacheName = "mobileNumberCache")
+ private transient Cache<Long, DialableMobileNumber> mobileNumberCache;
+
+ /**
+ * Default constructor
+ */
+ public JobsMobileListWebViewBean () {
+ // Call super constructor
+ super();
+
+ // Init list
+ this.allMobileNumbers = new LinkedList<>();
+ }
+
+ /**
+ * Observes events being fired when an administrator has added a new
+ * contact.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
+ // The event must be valid
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getAddedContact() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.addedContact is null"); //NOI18N
+ } else if (event.getAddedContact().getContactId() == null) {
+ // ... and again
+ throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
+ } else if (event.getAddedContact().getContactId() < 1) {
+ // Not valid
+ throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+ }
+
+ // Update contact's mobile, land-line and mobile number
+ this.updateContactMobileNumbers(event.getAddedContact());
+
+ // Clear this bean
+ this.clear();
+ }
+
+ /**
+ * Event observer for newly added users by administrator
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
+ // Event and contained entity instance should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getAddedUser() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.addedUser is null"); //NOI18N
+ } else if (event.getAddedUser().getUserId() == null) {
+ // userId is null
+ throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
+ } else if (event.getAddedUser().getUserId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
+ }
+
+ // Update contact's mobile, land-line and mobile number
+ this.updateContactMobileNumbers(event.getAddedUser().getUserContact());
+
+ // Clear all data
+ this.clear();
+ }
+
+ /**
+ * Observes events being fired when an administrator has deleted a land-line
+ * number
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminDeletedMobileNumberEvent (@Observes final ObservableAdminMobileNumberDeletedEvent event) {
+ // Event and contained entity instance should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getDeletedMobileNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.deletedMobileNumber is null"); //NOI18N
+ } else if (event.getDeletedMobileNumber().getMobileId() == null) {
+ // userId is null
+ throw new NullPointerException("event.deletedMobileNumber.mobileId is null"); //NOI18N
+ } else if (event.getDeletedMobileNumber().getMobileId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("mobileId of contact={0} is not valid: {1}", event.getDeletedMobileNumber(), event.getDeletedMobileNumber().getMobileId())); //NOI18N
+ }
+
+ // Update contact's mobile, land-line and mobile number
+ this.getAllMobileNumbers().remove(event.getDeletedMobileNumber());
+
+ // Clear all data
+ this.clear();
+ }
+
+ /**
+ * Observes events being fired when an administrator has a linked a
+ * land-line number
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminLinkedMobileNumberEvent (@Observes final ObservableAdminLinkedMobileNumberEvent 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"); //NOI18N
+ } else if (event.getContact().getContactId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactId is null"); //NOI18N
+ } else if (event.getContact().getContactId() < 1) {
+ // Throw again ...
+ throw new NullPointerException(MessageFormat.format("event.contact.contactId={0} is invalid", event.getContact().getContactId())); //NOI18N
+ } else if (event.getContact().getContactMobileNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactMobileNumber is null"); //NOI18N
+ } else if (event.getContact().getContactMobileNumber().getMobileId() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.contact.contactMobileNumber.mobileId is null"); //NOI18N
+ } else if (event.getContact().getContactMobileNumber().getMobileId() < 1) {
+ // Throw again ...
+ throw new NullPointerException(MessageFormat.format("event.contact.contactMobileNumber.mobileId={0} is invalid", event.getContact().getContactMobileNumber().getMobileId())); //NOI18N
+ } else if (event.getLinkedMobileNumber() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.linkedMobileNumer is null"); //NOI18N
+ }
+
+ // Is the id number in linked number not set?
+ if (event.getLinkedMobileNumber().getMobileId() == null) {
+ // Then it is a new number, so add it from contact as there the id number has been set
+ this.uniqueAddMobileNumber(event.getContact().getContactMobileNumber());
+ }
+ }
+
+ /**
+ * Observes events being fired when an administrator has updated contact
+ * data.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
+ // Event and contained entity instance should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getUpdatedContact() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.updatedContact is null"); //NOI18N
+ } else if (event.getUpdatedContact().getContactId() == null) {
+ // userId is null
+ throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+ } else if (event.getUpdatedContact().getContactId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+ }
+
+ // Update contact's mobile, land-line and mobile number
+ this.updateContactMobileNumbers(event.getUpdatedContact());
+
+ // Clear all data
+ this.clear();
+ }
+
+ /**
+ * Observes events being fired when an administrator has updated a land-line
+ * number.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminUpdatedMobileNumberEvent (@Observes final ObservableAdminMobileNumberUpdatedEvent event) {
+ // Event and contained entity instance should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getUpdatedMobileNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.updatedMobileNumber is null"); //NOI18N
+ } else if (event.getUpdatedMobileNumber().getMobileId() == null) {
+ // userId is null
+ throw new NullPointerException("event.updatedMobileNumber.mobileId is null"); //NOI18N
+ } else if (event.getUpdatedMobileNumber().getMobileId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("mobileId of contact={0} is not valid: {1}", event.getUpdatedMobileNumber(), event.getUpdatedMobileNumber().getMobileId())); //NOI18N
+ }
+
+ // Uniquely add it
+ this.uniqueAddMobileNumber(event.getUpdatedMobileNumber());
+
+ // Clear it
+ this.clear();
+ }
+
+ /**
+ * Observes events being fired when an user has updated contact data.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+ // Event and contained entity instance should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getUpdatedContact() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.updatedContact is null"); //NOI18N
+ } else if (event.getUpdatedContact().getContactId() == null) {
+ // userId is null
+ throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+ } else if (event.getUpdatedContact().getContactId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+ }
+
+ // Update contact's mobile, land-line and mobile number
+ this.updateContactMobileNumbers(event.getUpdatedContact());
+
+ // Clear all data
+ this.clear();
+ }
+
+ @Override
+ public DialableMobileNumber findMobileNumberById (final Long mobileNumberId) throws MobileEntityNotFoundException {
+ // Validate paramter
+ if (null == mobileNumberId) {
+ // Throw NPE
+ throw new NullPointerException("mobileNumberId is null"); //NOI18N
+ } else if (mobileNumberId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumberId={0} is invalid.", mobileNumberId)); //NOI18N
+ } else if (!this.mobileNumberCache.containsKey(mobileNumberId)) {
+ // Not found
+ throw new MobileEntityNotFoundException(mobileNumberId);
+ }
+
+ // Get it from cache
+ final DialableMobileNumber mobileNumber = this.mobileNumberCache.get(mobileNumberId);
+
+ // Return it
+ return mobileNumber;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ public List<DialableMobileNumber> getAllMobileNumbers () {
+ return this.allMobileNumbers;
+ }
+
+ /**
+ * Getter for filtered mobile numbers
+ * <p>
+ * @return Filtered mobile numbers
+ */
+ @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ public List<DialableMobileNumber> getFilteredMobileNumbers () {
+ return this.filteredMobileNumbers;
+ }
+
+ /**
+ * Setter for filtered mobile numbers
+ * <p>
+ * @param filteredMobileNumbers Filtered mobile numbers
+ */
+ @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+ public void setFilteredMobileNumbers (final List<DialableMobileNumber> filteredMobileNumbers) {
+ this.filteredMobileNumbers = filteredMobileNumbers;
+ }
+
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void initializeList () {
+ // Is cache there?
+ if (!this.mobileNumberCache.iterator().hasNext()) {
+ // Add all
+ for (final DialableMobileNumber currentNumber : this.mobileBean.fetchAllMobileNumbers()) {
+ // Add it to cache
+ this.mobileNumberCache.put(currentNumber.getMobileId(), currentNumber);
+ }
+ }
+
+ // Is cache filled and list is empty
+ if ((this.mobileNumberCache.iterator().hasNext()) && (this.getAllMobileNumbers().isEmpty())) {
+ // Build up list
+ for (final Cache.Entry<Long, DialableMobileNumber> currentEntry : this.mobileNumberCache) {
+ // Add to list
+ this.getAllMobileNumbers().add(currentEntry.getValue());
+ }
+
+ // Sort list
+ this.getAllMobileNumbers().sort(new Comparator<DialableMobileNumber>() {
+ @Override
+ public int compare (final DialableMobileNumber mobileNumber1, final DialableMobileNumber mobileNumber2) {
+ return mobileNumber1.getMobileId() > mobileNumber2.getMobileId() ? 1 : mobileNumber1.getMobileId() < mobileNumber2.getMobileId() ? -1 : 0;
+ }
+ });
+
+ // Set full list
+ this.setFilteredMobileNumbers(this.getAllMobileNumbers());
+ }
+ }
+
+ /**
+ * Clears this bean
+ */
+ private void clear () {
+ // Clear all data
+ }
+
+ /**
+ * Uniquely add given land-line number to this bean's list. First remove the
+ * old instance (by id number), then re-add it again.
+ * <p>
+ * @param mobileNumber Land-line number to add
+ */
+ private void uniqueAddMobileNumber (final DialableMobileNumber mobileNumber) {
+ // Make sure the parameter is valid
+ if (null == mobileNumber) {
+ // Throw NPE
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
+ } else if (mobileNumber.getMobileId() == null) {
+ // Throw again ...
+ throw new NullPointerException("mobileNumber.mobileId is null"); //NOI18N
+ } else if (mobileNumber.getMobileId() < 1) {
+ // Not valid
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileId={0} is not valid.", mobileNumber.getMobileId())); //NOI18N
+ }
+
+ // First remove it
+ if (!this.getAllMobileNumbers().remove(mobileNumber)) {
+ // Did not work, try by id number
+ for (final DialableMobileNumber currentNumber : this.getAllMobileNumbers()) {
+ // Is id number the same?
+ if (Objects.equals(currentNumber.getMobileId(), mobileNumber.getMobileId())) {
+ // Found it
+ this.getAllMobileNumbers().remove(currentNumber);
+ break;
+ }
+ }
+ }
+
+ // ... then add it
+ this.getAllMobileNumbers().add(mobileNumber);
+ }
+
+ /**
+ * Updates given contact's mobile number
+ * <p>
+ * @param contact Contact instance
+ */
+ private void updateContactMobileNumbers (final Contact contact) {
+ // Parameter must be valid
+ if (null == contact) {
+ // Throw NPE
+ throw new NullPointerException("contact is null"); //NOI18N
+ } else if (contact.getContactId() == null) {
+ // Throw again
+ throw new NullPointerException("contact.contactId is null"); //NOI18N
+ } else if (contact.getContactId() < 1) {
+ // Id number is not valid
+ }
+
+ // Is land-line set?
+ if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
+ // Unique-add it
+ this.uniqueAddMobileNumber(contact.getContactMobileNumber());
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2022 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.mobileprovider.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jphone.events.mobileprovider.added.ObservableAdminMobileProviderAddedEvent;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
+
+/**
+ * A views-scoped bean for mobile providers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("mobileProviderListController")
+@ViewScoped
+public class JobsMobileProviderListWebViewBean extends BaseJobsBean implements JobsMobileProviderListWebViewController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 15_869_423_671_950_277L;
+
+ /**
+ * A list of all mobile providers
+ */
+ private final List<MobileProvider> allMobileProviders;
+
+ /**
+ * A list of filtered mobile providers
+ */
+ private List<MobileProvider> filteredMobileProviders;
+
+ /**
+ * Remote EJB for mobile providers (regular)
+ */
+ @EJB (lookup = "java:global/jjobs-ejb/mobileProvider!org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
+ private MobileProviderSingletonBeanRemote mobileProviderBean;
+
+ /**
+ * "Cached" list of mobile providers
+ */
+ @Inject
+ @NamedCache (cacheName = "mobileProviderCache")
+ private transient Cache<Long, MobileProvider> mobileProviderCache;
+
+ /**
+ * Selected mobile provider instance
+ */
+ private MobileProvider selectedMobileProvider;
+
+ /**
+ * Default constructor
+ */
+ public JobsMobileProviderListWebViewBean () {
+ // Call super constructor
+ super();
+
+ // Init list
+ this.allMobileProviders = new LinkedList<>();
+ }
+
+ /**
+ * Observes events being fired after the administrator has added a new
+ * mobile provider
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminAddedMobileProviderEvent (@Observes final ObservableAdminMobileProviderAddedEvent event) {
+ // Is all valid?
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getAddedMobileProvider() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.addedMobileProvider is null"); //NOI18N
+ } else if (event.getAddedMobileProvider().getProviderId() == null) {
+ // And again ...
+ throw new NullPointerException("event.addedMobileProvider.providerId is null"); //NOI18N
+ } else if (event.getAddedMobileProvider().getProviderId() < 1) {
+ // Id is invalid
+ throw new IllegalArgumentException(MessageFormat.format("event.addedMobileProvider.providerId={0} is not valid.", event.getAddedMobileProvider().getProviderId())); //NOI18N
+ }
+
+ // Add it to the list
+ this.mobileProviderCache.put(event.getAddedMobileProvider().getProviderId(), event.getAddedMobileProvider());
+ this.getAllMobileProviders().add(event.getAddedMobileProvider());
+ }
+
+ @Override
+ public MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException {
+ // Validate parameter
+ if (null == mobileProviderId) {
+ // Throw NPE
+ throw new NullPointerException("mobileProviderId is null"); //NOI18N
+ } else if (mobileProviderId < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException("mobileProviderId=" + mobileProviderId + " is invalid."); //NOI18N
+ } else if (!this.mobileProviderCache.containsKey(mobileProviderId)) {
+ // Not found
+ throw new MobileProviderNotFoundException(mobileProviderId);
+ }
+
+ // Get it from cache
+ final MobileProvider mobileProvider = this.mobileProviderCache.get(mobileProviderId);
+
+ // Return it
+ return mobileProvider;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ public List<MobileProvider> getAllMobileProviders () {
+ // Return it
+ return this.allMobileProviders;
+ }
+
+ /**
+ * Getter for filtered mobile provider list
+ * <p>
+ * @return Filtered mobile providers
+ */
+ @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ public List<MobileProvider> getFilteredMobileProviders () {
+ return this.filteredMobileProviders;
+ }
+
+ /**
+ * Getter for filtered mobile provider list
+ * <p>
+ * @param filteredMobileProviders Filtered mobile providers
+ */
+ @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+ public void setFilteredMobileProviders (final List<MobileProvider> filteredMobileProviders) {
+ this.filteredMobileProviders = filteredMobileProviders;
+ }
+
+ /**
+ * Getter for selected mobile provider instance
+ * <p>
+ * @return Selected mobile provider instance
+ */
+ public MobileProvider getSelectedMobileProvider () {
+ return this.selectedMobileProvider;
+ }
+
+ /**
+ * Setter for selected mobile provider instance
+ * <p>
+ * @param selectedMobileProvider Selected mobile provider instance
+ */
+ public void setSelectedMobileProvider (final MobileProvider selectedMobileProvider) {
+ this.selectedMobileProvider = selectedMobileProvider;
+ }
+
+ /**
+ * Post-construction method
+ */
+ @PostConstruct
+ public void initializeList () {
+ // Is cache there?
+ if (!this.mobileProviderCache.iterator().hasNext()) {
+ // Add all
+ for (final MobileProvider mobileProvider : this.mobileProviderBean.fetchAllMobileProviders()) {
+ // Add it to cache
+ this.mobileProviderCache.put(mobileProvider.getProviderId(), mobileProvider);
+ }
+ }
+
+ // Is the list empty, but filled cache?
+ if (this.getAllMobileProviders().isEmpty() && this.mobileProviderCache.iterator().hasNext()) {
+ // Build up list
+ for (final Cache.Entry<Long, MobileProvider> currentEntry : this.mobileProviderCache) {
+ // Add to list
+ this.getAllMobileProviders().add(currentEntry.getValue());
+ }
+
+ // Sort list
+ this.getAllMobileProviders().sort(new Comparator<MobileProvider>() {
+ @Override
+ public int compare (final MobileProvider mobileProvider1, final MobileProvider mobileProvider2) {
+ return mobileProvider1.getProviderId() > mobileProvider2.getProviderId() ? 1 : mobileProvider1.getProviderId() < mobileProvider2.getProviderId() ? -1 : 0;
+ }
+ });
+ }
+ }
+}
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
-import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
+import org.mxchange.jphone.events.mobileprovider.added.ObservableAdminMobileProviderAddedEvent;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedException;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.CellphoneProvider;
import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
*/
@Inject
@Any
- private Event<AdminAddedMobileProviderEvent> providerAddedEvent;
+ private Event<ObservableAdminMobileProviderAddedEvent> providerAddedEvent;
/**
* Country instance ('s dial data)
import javax.inject.Named;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
-import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
import org.mxchange.jphone.events.fax.deleted.AdminFaxNumberDeletedEvent;
+import org.mxchange.jphone.events.fax.deleted.ObservableAdminFaxNumberDeletedEvent;
import org.mxchange.jphone.events.fax.removed.AdminFaxNumberRemovedFromListEvent;
-import org.mxchange.jphone.events.fax.removed.AdminRemoveFaxNumberFromListEvent;
+import org.mxchange.jphone.events.fax.removed.ObservableAdminFaxNumberRemovedFromListEvent;
import org.mxchange.jphone.events.fax.updated.AdminFaxNumberUpdatedEvent;
-import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
+import org.mxchange.jphone.events.fax.updated.ObservableAdminFaxNumberUpdatedEvent;
import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent;
-import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEvent;
import org.mxchange.jphone.events.landline.deleted.AdminLandLineNumberDeletedEvent;
+import org.mxchange.jphone.events.landline.deleted.ObservableAdminLandLineNumberDeletedEvent;
import org.mxchange.jphone.events.landline.removed.AdminLandLineNumberRemovedFromListEvent;
-import org.mxchange.jphone.events.landline.removed.AdminRemoveLandLineNumberFromListEvent;
+import org.mxchange.jphone.events.landline.removed.ObservableAdminLandLineNumberRemovedFromListEvent;
import org.mxchange.jphone.events.landline.updated.AdminLandLineNumberUpdatedEvent;
-import org.mxchange.jphone.events.landline.updated.AdminUpdatedLandLineNumberEvent;
-import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
-import org.mxchange.jphone.events.mobile.deleted.AdminMobileNumberDeletedEvent;
-import org.mxchange.jphone.events.mobile.remove.AdminMobileNumberRemovedFromListEvent;
-import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
-import org.mxchange.jphone.events.mobile.updated.AdminMobileNumberUpdatedEvent;
-import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
+import org.mxchange.jphone.events.landline.updated.ObservableAdminLandLineNumberUpdatedEvent;
+import org.mxchange.jphone.events.mobile.remove.ObservableAdminMobileNumberRemovedFromListEvent;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
*/
@Inject
@Any
- private Event<AdminDeletedFaxNumberEvent> faxNumberDeletedEvent;
+ private Event<ObservableAdminFaxNumberDeletedEvent> faxNumberDeletedEvent;
/**
* Event being fired when an administrator has updated fax number
*/
@Inject
@Any
- private Event<AdminUpdatedFaxNumberEvent> faxNumberUpdatedEvent;
+ private Event<ObservableAdminFaxNumberUpdatedEvent> faxNumberUpdatedEvent;
/**
* land-line number
*/
@Inject
@Any
- private Event<AdminDeletedLandLineNumberEvent> landLineNumberDeletedEvent;
+ private Event<ObservableAdminLandLineNumberDeletedEvent> landLineNumberDeletedEvent;
/**
* Event being fired when an administrator has updated fax number
*/
@Inject
@Any
- private Event<AdminUpdatedLandLineNumberEvent> landLineNumberUpdatedEvent;
+ private Event<ObservableAdminLandLineNumberUpdatedEvent> landLineNumberUpdatedEvent;
/**
* Chosen mobile number
*/
@Inject
@Any
- private Event<AdminRemoveFaxNumberFromListEvent> removeLinkedFaxNumbersEvent;
+ private Event<ObservableAdminFaxNumberRemovedFromListEvent> removeLinkedFaxNumbersEvent;
/**
* Event being fired when a list of all unsed land-line numbers is being
*/
@Inject
@Any
- private Event<AdminRemoveLandLineNumberFromListEvent> removeLinkedLandLineNumbersEvent;
+ private Event<ObservableAdminLandLineNumberRemovedFromListEvent> removeLinkedLandLineNumbersEvent;
/**
* Event being fired when a list of all unsed mobile numbers is being
*/
@Inject
@Any
- private Event<AdminRemoveMobileNumberFromListEvent> removeLinkedMobileNumbersEvent;
+ private Event<ObservableAdminMobileNumberRemovedFromListEvent> removeLinkedMobileNumbersEvent;
/**
* Default constructor
import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
-import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
-import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEvent;
-import org.mxchange.jphone.events.landline.updated.AdminUpdatedLandLineNumberEvent;
-import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
-import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
+import org.mxchange.jphone.events.fax.deleted.ObservableAdminFaxNumberDeletedEvent;
+import org.mxchange.jphone.events.fax.updated.ObservableAdminFaxNumberUpdatedEvent;
+import org.mxchange.jphone.events.landline.deleted.ObservableAdminLandLineNumberDeletedEvent;
+import org.mxchange.jphone.events.landline.updated.ObservableAdminLandLineNumberUpdatedEvent;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
* <p>
* @param event Event being fired
*/
- public void afterAdminDeletedFaxNumberEvent (@Observes final AdminDeletedFaxNumberEvent event) {
- // event should not be null
+ public void afterAdminDeletedFaxNumberEvent (@Observes final ObservableAdminFaxNumberDeletedEvent event) {
+ // Event and contained entity instance should not be null
if (null == event) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N
* <p>
* @param event Event being fired
*/
- public void afterAdminDeletedLandLineNumberEvent (@Observes final AdminDeletedLandLineNumberEvent event) {
- // event should not be null
+ public void afterAdminDeletedLandLineNumberEvent (@Observes final ObservableAdminLandLineNumberDeletedEvent event) {
+ // Event and contained entity instance should not be null
if (null == event) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N
* <p>
* @param event Event being fired
*/
- public void afterAdminUpdatedFaxNumberEvent (@Observes final AdminUpdatedFaxNumberEvent event) {
- // event should not be null
+ public void afterAdminUpdatedFaxNumberEvent (@Observes final ObservableAdminFaxNumberUpdatedEvent event) {
+ // Event and contained entity instance should not be null
if (null == event) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N
* <p>
* @param event Event being fired
*/
- public void afterAdminUpdatedLandLineNumberEvent (@Observes final AdminUpdatedLandLineNumberEvent event) {
- // event should not be null
+ public void afterAdminUpdatedLandLineNumberEvent (@Observes final ObservableAdminLandLineNumberUpdatedEvent event) {
+ // Event and contained entity instance should not be null
if (null == event) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N