From 48377091fca7d5165bec96a117a7462cf11f78d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 22 Jan 2023 06:51:00 +0100 Subject: [PATCH] Please cherry-pick: - jcoree.jar has changed, so showFacesException() is now the new name as this method shows a message from a thrown exception --- ...cialsAdminContactMobileWebRequestBean.java | 551 ++++++++++++++++++ .../contact/PizzaContactWebRequestBean.java | 2 +- .../PizzaAdminContactPhoneWebRequestBean.java | 14 +- ...izzaAdminMobileProviderWebRequestBean.java | 4 +- .../PizzaEmailChangeWebRequestBean.java | 2 +- .../PizzaResendLinkWebRequestBean.java | 2 +- 6 files changed, 560 insertions(+), 15 deletions(-) create mode 100644 src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java diff --git a/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java new file mode 100644 index 00000000..67c1a085 --- /dev/null +++ b/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java @@ -0,0 +1,551 @@ +/* + * 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.jfinancials.beans.contact.mobile; + +import java.text.MessageFormat; +import java.util.Date; +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.jcontacts.events.contact.add.ObservableAdminAddedContactEvent; +import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent; +import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent; +import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent; +import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent; +import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent; +import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent; +import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent; +import org.mxchange.jcontacts.exceptions.ContactNotFoundException; +import org.mxchange.jcontacts.model.contact.Contact; +import org.mxchange.jcontacts.model.mobile.AdminContactsMobileSessionBeanRemote; +import org.mxchange.jfinancials.beans.BaseFinancialsBean; +import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent; +import org.mxchange.jphone.exceptions.mobile.MobileNumberAlreadyLinkedException; +import org.mxchange.jphone.exceptions.mobile.MobileNumberNotLinkedException; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; + +/** + * An administrative contact mobile controller (bean) + *

+ * @author Roland Häder + */ +@Named ("adminContactMobileController") +@RequestScoped +public class FinancialsAdminContactMobileWebRequestBean extends BaseFinancialsBean implements FinancialsAdminContactMobileWebRequestController { + + /** + * Serial number + */ + private static final long serialVersionUID = 542_145_347_919L; + + /** + * Administrative EJB for phone number + */ + @EJB (lookup = "java:global/jfinancials-ejb/adminContactMobile!org.mxchange.jcontacts.model.mobile.AdminContactsMobileSessionBeanRemote") + private AdminContactsMobileSessionBeanRemote adminContactMobileBean; + + /** + * Event being fired when a mobile number has been linked + */ + @Inject + @Any + private Event adminLinkedMobileNumberEvent; + + /** + * Contact instance + */ + private Contact contact; + + /** + * When mobile number has been created + */ + private Date mobileEntryCreated; + + /** + * When mobile number has been updated + */ + private Date mobileEntryUpdated; + + /** + * Phone id (primary key) + */ + private Long mobileId; + + /** + * Mobile number + */ + private Long mobileNumber; + + /** + * Event being fired when administrator unlinks mobile from contact + */ + @Inject + @Any + private Event mobileNumberUnlinkedEvent; + + /** + * Mobile provider + */ + private MobileProvider mobileProvider; + + /** + * Default constructor + */ + public FinancialsAdminContactMobileWebRequestBean () { + // Call super constructor + super(); + + // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName()); + // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller)); + } + + /** + * 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 + } + + // 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 + } + + // Clear all data + this.clear(); + } + + /** + * Event observer for updated contact data by administrators + *

+ * @param event Updated contact data event + */ + 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 + } + + // Clear all data + this.clear(); + } + + /** + * Observer for events being fired when a bean helper has successfully + * created a contact instance. + *

+ * @param event Event being fired + */ + public void afterCreatedContactEvent (@Observes final ObservableCreatedContactEvent event) { + // Log message + //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::afterCreatedContactEvent(): contact={0} - CALLED!", contact)); //NOI18N + + // The event instance must be valid + if (null == event) { + // Throw NPE again + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getCreatedContact() == null) { + // Throw NPE again + throw new NullPointerException("event.createdContact is null"); //NOI18N + } else if (event.getCreatedContact().getContactId() == null) { + // Throw NPE again + throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N + } else if (event.getCreatedContact().getContactId() < 1) { + // Not valid + throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N + } + + // Set it here + this.setContact(event.getCreatedContact()); + } + + /** + * 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()); + } + + /** + * Event observer for updated contact data by the user + *

+ * @param event Updated contact data event + */ + 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 + } + + // Clear all data + this.clear(); + } + + /** + * Links mobile number to contact from bean helper as "main mobile number". + *

+ * @return Redirect outcome + */ + public String doLinkMainMobileNumber () { + // Get contact from helper + final Contact targetContact = this.getContact(); + + // Is all data properly set? + if (null == targetContact) { + // Throw NPE + throw new NullPointerException("targetContact is null"); //NOI18N + } else if (targetContact.getContactId() == null) { + // Throw it again + throw new NullPointerException("targetContact.contactId is null"); //NOI18N + } else if (targetContact.getContactId() < 1) { + // Is not valid + throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N + } else if (this.getMobileProvider() == null) { + // Throw NPE + throw new NullPointerException("this.mobileProvider is null"); //NOI18N + } else if (this.getMobileProvider().getProviderId() == null) { + // Throw NPE + throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N + } else if (this.getMobileProvider().getProviderId() < 1) { + // Throw NPE + throw new NullPointerException(MessageFormat.format("this.mobileProvider.providerId={0} is invalid", this.getMobileProvider().getProviderId())); //NOI18N + } else if (this.getMobileNumber() == null) { + // Throw NPE again + throw new NullPointerException("this.mobileNumber is null"); //NOI18N + } else if (this.getMobileNumber() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber={0} is invalid", this.getMobileNumber())); //NOI18N + } + + // Init instance + final Contact updatedContact; + final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber()); + + // Try it again + try { + // Link it, too + updatedContact = this.adminContactMobileBean.linkNewMobileNumberWithContact(targetContact, number); + } catch (final MobileNumberAlreadyLinkedException | ContactNotFoundException ex) { + // Throw again as cause + this.showFacesException("form_add_contact_mobile:mobileNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N + return ""; //NOI18N + } + + // Fire event + this.adminLinkedMobileNumberEvent.fire(new AdminLinkedMobileNumberEvent(updatedContact, number)); + + // Return to contact profile + return "admin_show_contact"; //NOI18N + } + + /** + * Getter for contact instance + *

+ * @return Contact instance + */ + public Contact getContact () { + return this.contact; + } + + /** + * Setter for contact instance + *

+ * @param contact Contact instance + */ + public void setContact (final Contact contact) { + this.contact = contact; + } + + /** + * Setter for phone id + *

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

+ * @param mobileId Phone id + */ + public void setMobileId (final Long mobileId) { + this.mobileId = mobileId; + } + + /** + * Getter for mobile number + *

+ * @return Mobile number + */ + public Long getMobileNumber () { + return this.mobileNumber; + } + + /** + * Setter for mobile number + *

+ * @param mobileNumber Mobile number + */ + 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; + } + + /** + * Unlinks mobile data with current contact + *

+ * @return Redirect outcome + */ + public String unlinkMobileContactData () { + // Create fax number instance + final DialableMobileNumber number = this.createMobileNumber(); + + // Is all data set + if (number == null) { + // Not set, throw NPE + throw new NullPointerException("number is null"); //NOI18N + } else if (number.getMobileId() == null) { + // Throw NPE again + throw new NullPointerException("number.phoneId is null"); //NOI18N + } else if (number.getMobileId() < 1) { + // Invalid number + throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getMobileId())); //NOI18N + } else if (number.getMobileProvider() == null) { + // Throw NPE + throw new NullPointerException("number.mobileProvider is null"); //NOI18N + } else if (number.getMobileProvider().getProviderId() == null) { + // ... throw again + throw new NullPointerException("number.mobileProvider.providerId is null"); //NOI18N + } else if (number.getMobileProvider().getProviderId() < 1) { + // Id not valid + throw new IllegalArgumentException(MessageFormat.format("number.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N + } else if (number.getMobileNumber() == null) { + // Throw NPE again + throw new NullPointerException("number.phoneNumber is null"); //NOI18N + } else if (number.getMobileNumber() < 1) { + // Throw it again ... + throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getMobileNumber())); //NOI18N + } else if (this.getContact() == null) { + // ... and throw again + throw new NullPointerException("this.contact is null"); //NOI18N + } else if (this.getContact().getContactId() == null) { + // ... and again ... + throw new NullPointerException("this.contact.contactId is null"); //NOI18N + } else if (this.getContact().getContactId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N + } + + // Init contact instance + final Contact updatedContact; + + try { + // Unlink it and return contact without mobile instance + updatedContact = this.adminContactMobileBean.unlinkMobileDataFromContact(this.getContact(), number); + } catch (final MobileNumberNotLinkedException | ContactNotFoundException ex) { + // Did not work + this.showFacesException("form_unlink_contact_mobile:mobileNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N + return ""; //NOI18N + } + + // Fire event + this.mobileNumberUnlinkedEvent.fire(new AdminUnlinkedMobileNumberEvent(updatedContact, number)); + + // All fine here + return "admin_show_contact"; //NOI18N + } + + /** + * Clears this bean + */ + private void clear () { + // Clear all data + } + + /** + * 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()); + + // Is id number set? + if (this.getMobileId() instanceof Long) { + // Set it + number.setMobileId(this.getMobileId()); + } + + // Return it + return number; + } + + /** + * Getter for mobile entry created + *

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

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

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

+ * @param mobileEntryUpdated Mobile entry updated + */ + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + private void setMobileEntryUpdated (final Date mobileEntryUpdated) { + this.mobileEntryUpdated = mobileEntryUpdated; + } + +} diff --git a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebRequestBean.java index b35b453e..e1e8fdf7 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebRequestBean.java @@ -541,7 +541,7 @@ public class PizzaContactWebRequestBean extends BasePizzaBean implements PizzaCo throw new FaceletException("Not all required fields are set."); //NOI18N } else if (!this.userLoginController.ifCurrentPasswordMatches()) { // Password not matching - this.showFacesMessage("form_login_change_personal:currentPassword", new UserPasswordMismatchException(this.userLoginController.getLoggedInUser())); //NOI18N + this.showFacesException("form_login_change_personal:currentPassword", new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()), FacesMessage.SEVERITY_ERROR); //NOI18N return ""; //NOI18N } diff --git a/src/java/org/mxchange/pizzaapplication/beans/contact/phone/PizzaAdminContactPhoneWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/contact/phone/PizzaAdminContactPhoneWebRequestBean.java index 79dbe719..39fe6fe0 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/contact/phone/PizzaAdminContactPhoneWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/contact/phone/PizzaAdminContactPhoneWebRequestBean.java @@ -103,12 +103,6 @@ public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaBean implemen @Any private Event adminLinkedMobileNumberEvent; - /** - * Administrative phone controller - */ - @Inject - private PizzaAdminPhoneWebRequestController adminPhoneController; - /** * Contact instance */ @@ -459,7 +453,7 @@ public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaBean implemen updatedContact = this.adminContactPhoneBean.linkNewFaxNumberWithContact(targetContact, number); } catch (final PhoneNumberAlreadyLinkedException ex) { // Throw again as cause - this.showFacesMessage("form_add_contact_fax:faxNumber", ex); //NOI18N + this.showFacesException("form_add_contact_fax:faxNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N return ""; //NOI18N } @@ -523,7 +517,7 @@ public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaBean implemen updatedContact = this.adminContactPhoneBean.linkNewLandLineNumberWithContact(targetContact, number); } catch (final PhoneNumberAlreadyLinkedException ex) { // Throw again as cause - this.showFacesMessage("form_add_contact_landLine:landLineNumber", ex); //NOI18N + this.showFacesException("form_add_contact_landLine:landLineNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N return ""; //NOI18N } @@ -815,7 +809,7 @@ public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaBean implemen updatedContact = this.adminContactPhoneBean.unlinkFaxDataFromContact(this.getContact(), number); } catch (final PhoneNumberNotLinkedException ex) { // Did not work - this.showFacesMessage("form_unlink_contact_fax:faxNumberId", ex); //NOI18N + this.showFacesException("form_unlink_contact_fax:faxNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N return ""; //NOI18N } @@ -870,7 +864,7 @@ public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaBean implemen updatedContact = this.adminContactPhoneBean.unlinkLandLineDataFromContact(this.getContact(), number); } catch (final PhoneNumberNotLinkedException ex) { // Did not work - this.showFacesMessage("form_unlink_contact_landLine:landLineNumberId", ex); //NOI18N + this.showFacesException("form_unlink_contact_landLine:landLineNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N return ""; //NOI18N } diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java index 8734037b..15647ba3 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java @@ -112,8 +112,8 @@ public class PizzaAdminMobileProviderWebRequestBean extends BasePizzaBean implem // Is the provider already created? if (this.isMobileProviderCreated(mobileProvider)) { // Then throw exception - this.showFacesMessage("form_add_mobile_provider:providerDialPrefix", new MobileProviderAlreadyAddedException(mobileProvider)); //NOI18N - return ""; //NOI18N + this.showFacesException("form_add_mobile_provider:providerDialPrefix", new MobileProviderAlreadyAddedException(mobileProvider), FacesMessage.SEVERITY_WARN); //NOI18N + return; } // Init variable diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/email_address/PizzaEmailChangeWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/email_address/PizzaEmailChangeWebRequestBean.java index 0eb78e95..6d166fa2 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/email_address/PizzaEmailChangeWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/email_address/PizzaEmailChangeWebRequestBean.java @@ -119,7 +119,7 @@ public class PizzaEmailChangeWebRequestBean extends BasePizzaBean implements Piz return ""; //NOI18N } else if (!this.userLoginController.ifCurrentPasswordMatches()) { // Password not matching - this.showFacesMessage("form_login_user_change_email_address:currentPassword", new UserPasswordMismatchException(this.userLoginController.getLoggedInUser())); //NOI18N + this.showFacesException("form_login_user_change_email_address:currentPassword", new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()), FacesMessage.SEVERITY_WARN); //NOI18N return ""; //NOI18N } diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/resendlink/PizzaResendLinkWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/resendlink/PizzaResendLinkWebRequestBean.java index 7c9f85f0..b420f3ce 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/resendlink/PizzaResendLinkWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/resendlink/PizzaResendLinkWebRequestBean.java @@ -179,7 +179,7 @@ public class PizzaResendLinkWebRequestBean extends BasePizzaBean implements Pizz return ""; //NOI18N } catch (final UserStatusLockedException | UserStatusConfirmedException ex) { // Output message, this should not happen as the confirmation key is being removed - this.showFacesMessage("form_resend_link:resendEmailAddress", ex); //NOI18N + this.showFacesException("form_resend_link:resendEmailAddress", ex, FacesMessage.SEVERITY_ERROR); //NOI18N return ""; //NOI18N } -- 2.39.5