From 5f664e0e5a3f435debd229ff774a652b243398be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 22 Jan 2023 07:34:57 +0100 Subject: [PATCH] Please cherry-pick: - updated references as with observable events, their interface should be prefixed "Observable" to indicate an interface --- .../mobile/JobsAdminMobileWebRequestBean.java | 423 ++++++++++++++++ .../list/JobsMobileListWebViewBean.java | 455 ++++++++++++++++++ .../JobsMobileProviderListWebViewBean.java | 214 ++++++++ ...izzaAdminMobileProviderWebRequestBean.java | 6 +- .../phone/PizzaAdminPhoneWebRequestBean.java | 34 +- .../beans/phone/PizzaPhoneWebRequestBean.java | 27 +- 6 files changed, 1122 insertions(+), 37 deletions(-) create mode 100644 src/java/org/mxchange/jjobs/beans/mobile/JobsAdminMobileWebRequestBean.java create mode 100644 src/java/org/mxchange/jjobs/beans/mobile/list/JobsMobileListWebViewBean.java create mode 100644 src/java/org/mxchange/jjobs/beans/mobileprovider/list/JobsMobileProviderListWebViewBean.java diff --git a/src/java/org/mxchange/jjobs/beans/mobile/JobsAdminMobileWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/mobile/JobsAdminMobileWebRequestBean.java new file mode 100644 index 00000000..bc84afab --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/mobile/JobsAdminMobileWebRequestBean.java @@ -0,0 +1,423 @@ +/* + * 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 . + */ +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 + *

+ * @author Roland Häder + */ +@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 mobileNumberDeletedEvent; + + /** + * Event being fired when an administrator has updated land-line number + */ + @Inject + @Any + private Event mobileNumberUpdatedEvent; + + /** + * Mobile provider + */ + private MobileProvider mobileProvider; + + /** + * Event being fired when a list of all unused mobile numbers is being + * created. + */ + @Inject + @Any + private Event 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. + *

+ * @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 + *

+ * @return List with all unused mobile numbers + */ + public List allNonLinkedMobileNumbers () { + // Get list of all mobile numbers + final List 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 + *

+ * @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 + *

+ * @return Mobile entry created timestamp + */ + @SuppressWarnings ("ReturnOfDateField") + public Date getMobileEntryCreated () { + return this.mobileEntryCreated; + } + + /** + * Setter for phone entry created timestamp + *

+ * @param mobileEntryCreated Mobile entry created timestamp + */ + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setMobileEntryCreated (final Date mobileEntryCreated) { + this.mobileEntryCreated = mobileEntryCreated; + } + + /** + * Getter for phone entry updated timestamp + *

+ * @return Mobile entry updated timestamp + */ + @SuppressWarnings ("ReturnOfDateField") + public Date getMobileEntryUpdated () { + return this.mobileEntryUpdated; + } + + /** + * Setter for phone entry updated timestamp + *

+ * @param mobileEntryUpdated Mobile entry updated timestamp + */ + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setMobileEntryUpdated (final Date mobileEntryUpdated) { + this.mobileEntryUpdated = mobileEntryUpdated; + } + + /** + * Getter for phone id + *

+ * @return Mobile id + */ + public Long getMobileId () { + return this.mobileId; + } + + /** + * Setter for phone id + *

+ * @param mobileId Mobile id + */ + public void setMobileId (final Long mobileId) { + this.mobileId = mobileId; + } + + /** + * Getter for dial number without prefix + *

+ * @return Dial number without prefix + */ + public Long getMobileNumber () { + return this.mobileNumber; + } + + /** + * Setter for dial number without prefix + *

+ * @param mobileNumber Dial number without prefix + */ + public void setMobileNumber (final Long mobileNumber) { + this.mobileNumber = mobileNumber; + } + + /** + * Getter for mobile provider + *

+ * @return Mobile provider + */ + public MobileProvider getMobileProvider () { + return this.mobileProvider; + } + + /** + * Setter for mobile provider + *

+ * @param mobileProvider Mobile provider + */ + public void setMobileProvider (final MobileProvider mobileProvider) { + this.mobileProvider = mobileProvider; + } + + /** + * Getter for chosen mobile number + *

+ * @return mobile number + */ + public DialableMobileNumber getSelectedMobileNumber () { + return this.selectedMobileNumber; + } + + /** + * Setter for chosen mobile number + *

+ * @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. + *

+ * @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; + } + +} diff --git a/src/java/org/mxchange/jjobs/beans/mobile/list/JobsMobileListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/mobile/list/JobsMobileListWebViewBean.java new file mode 100644 index 00000000..73b8974a --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/mobile/list/JobsMobileListWebViewBean.java @@ -0,0 +1,455 @@ +/* + * 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 . + */ +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 + *

+ * @author Roland Häder + */ +@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 allMobileNumbers; + + /** + * A list of filtered mobile numbers + */ + private List 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 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. + *

+ * @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 + *

+ * @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 + *

+ * @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 + *

+ * @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. + *

+ * @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. + *

+ * @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. + *

+ * @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 getAllMobileNumbers () { + return this.allMobileNumbers; + } + + /** + * Getter for filtered mobile numbers + *

+ * @return Filtered mobile numbers + */ + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getFilteredMobileNumbers () { + return this.filteredMobileNumbers; + } + + /** + * Setter for filtered mobile numbers + *

+ * @param filteredMobileNumbers Filtered mobile numbers + */ + @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") + public void setFilteredMobileNumbers (final List 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 currentEntry : this.mobileNumberCache) { + // Add to list + this.getAllMobileNumbers().add(currentEntry.getValue()); + } + + // Sort list + this.getAllMobileNumbers().sort(new Comparator() { + @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. + *

+ * @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 + *

+ * @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()); + } + } + +} diff --git a/src/java/org/mxchange/jjobs/beans/mobileprovider/list/JobsMobileProviderListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/mobileprovider/list/JobsMobileProviderListWebViewBean.java new file mode 100644 index 00000000..027c9869 --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/mobileprovider/list/JobsMobileProviderListWebViewBean.java @@ -0,0 +1,214 @@ +/* + * 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 . + */ +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 + *

+ * @author Roland Häder + */ +@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 allMobileProviders; + + /** + * A list of filtered mobile providers + */ + private List 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 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 + *

+ * @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 getAllMobileProviders () { + // Return it + return this.allMobileProviders; + } + + /** + * Getter for filtered mobile provider list + *

+ * @return Filtered mobile providers + */ + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getFilteredMobileProviders () { + return this.filteredMobileProviders; + } + + /** + * Getter for filtered mobile provider list + *

+ * @param filteredMobileProviders Filtered mobile providers + */ + @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") + public void setFilteredMobileProviders (final List filteredMobileProviders) { + this.filteredMobileProviders = filteredMobileProviders; + } + + /** + * Getter for selected mobile provider instance + *

+ * @return Selected mobile provider instance + */ + public MobileProvider getSelectedMobileProvider () { + return this.selectedMobileProvider; + } + + /** + * Setter for selected mobile provider instance + *

+ * @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 currentEntry : this.mobileProviderCache) { + // Add to list + this.getAllMobileProviders().add(currentEntry.getValue()); + } + + // Sort list + this.getAllMobileProviders().sort(new Comparator() { + @Override + public int compare (final MobileProvider mobileProvider1, final MobileProvider mobileProvider2) { + return mobileProvider1.getProviderId() > mobileProvider2.getProviderId() ? 1 : mobileProvider1.getProviderId() < mobileProvider2.getProviderId() ? -1 : 0; + } + }); + } + } +} diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java index 15647ba3..6f9ae546 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java @@ -27,9 +27,9 @@ import javax.faces.view.facelets.FaceletException; 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; @@ -66,7 +66,7 @@ public class PizzaAdminMobileProviderWebRequestBean extends BasePizzaBean implem */ @Inject @Any - private Event providerAddedEvent; + private Event providerAddedEvent; /** * Country instance ('s dial data) diff --git a/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminPhoneWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminPhoneWebRequestBean.java index e3ea5013..58590eec 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminPhoneWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminPhoneWebRequestBean.java @@ -29,26 +29,20 @@ import javax.inject.Inject; 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; @@ -94,14 +88,14 @@ public class PizzaAdminPhoneWebRequestBean extends BasePizzaBean implements Pizz */ @Inject @Any - private Event faxNumberDeletedEvent; + private Event faxNumberDeletedEvent; /** * Event being fired when an administrator has updated fax number */ @Inject @Any - private Event faxNumberUpdatedEvent; + private Event faxNumberUpdatedEvent; /** * land-line number @@ -113,14 +107,14 @@ public class PizzaAdminPhoneWebRequestBean extends BasePizzaBean implements Pizz */ @Inject @Any - private Event landLineNumberDeletedEvent; + private Event landLineNumberDeletedEvent; /** * Event being fired when an administrator has updated fax number */ @Inject @Any - private Event landLineNumberUpdatedEvent; + private Event landLineNumberUpdatedEvent; /** * Chosen mobile number @@ -187,7 +181,7 @@ public class PizzaAdminPhoneWebRequestBean extends BasePizzaBean implements Pizz */ @Inject @Any - private Event removeLinkedFaxNumbersEvent; + private Event removeLinkedFaxNumbersEvent; /** * Event being fired when a list of all unsed land-line numbers is being @@ -195,7 +189,7 @@ public class PizzaAdminPhoneWebRequestBean extends BasePizzaBean implements Pizz */ @Inject @Any - private Event removeLinkedLandLineNumbersEvent; + private Event removeLinkedLandLineNumbersEvent; /** * Event being fired when a list of all unsed mobile numbers is being @@ -203,7 +197,7 @@ public class PizzaAdminPhoneWebRequestBean extends BasePizzaBean implements Pizz */ @Inject @Any - private Event removeLinkedMobileNumbersEvent; + private Event removeLinkedMobileNumbersEvent; /** * Default constructor diff --git a/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaPhoneWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaPhoneWebRequestBean.java index 3481cd9b..639b3f34 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaPhoneWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaPhoneWebRequestBean.java @@ -35,12 +35,11 @@ import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEv 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; @@ -160,8 +159,8 @@ public class PizzaPhoneWebRequestBean extends BasePizzaBean implements PizzaPhon *

* @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 @@ -189,8 +188,8 @@ public class PizzaPhoneWebRequestBean extends BasePizzaBean implements PizzaPhon *

* @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 @@ -399,8 +398,8 @@ public class PizzaPhoneWebRequestBean extends BasePizzaBean implements PizzaPhon *

* @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 @@ -428,8 +427,8 @@ public class PizzaPhoneWebRequestBean extends BasePizzaBean implements PizzaPhon *

* @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 -- 2.39.5