From 73c5cb923f159b5202562d15b1f92a3564738be5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 26 Aug 2017 22:42:41 +0200 Subject: [PATCH] Please cherry-pick: - rewrote message-box tag to have 2 CSS classes, one for the whole (alert) box, one for the message itself - renamed a lot CSS classes/ids to more common naming covention: foo-bar and not foo_bar - renamed i18n string to ADMIN_FEATURE_UNFINISHED_WARNING as this can be generic - other small CSS rewrites MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../FinancialsCompanyNameValidator.java | 114 ++++++++++ .../localization/bundle_de_DE.properties | 27 +-- .../localization/bundle_en_US.properties | 18 +- .../PizzaAdminBusinessDataWebRequestBean.java | 8 +- .../PizzaBusinessDataWebSessionBean.java | 34 +++ .../PizzaBusinessContactConverter.java | 20 +- .../PizzaCompanyEmployeeConverter.java | 13 +- .../PizzaCompanyHeadquartersConverter.java | 11 +- .../contact/PizzaContactConverter.java | 11 +- .../country/PizzaCountryConverter.java | 11 +- .../fax/PizzaFaxNumberConverter.java | 12 +- .../PizzaLandLineNumberConverter.java | 12 +- .../mobile/PizzaMobileNumberConverter.java | 14 +- .../PizzaMobileProviderConverter.java | 11 +- .../converter/user/PizzaUserConverter.java | 11 +- .../birthday/PizzaBirthdayValidator.java | 17 +- .../PizzaEmailAddressValidator.java | 5 +- .../validator/names/PizzaNameValidator.java | 3 +- .../item_amount/PizzaItemAmountValidator.java | 2 +- .../password/PizzaUserPasswordValidator.java | 5 +- .../abroad/PizzaAbroadDialValidator.java | 9 +- .../number/PizzaPhoneNumberValidator.java | 3 +- .../PizzaPrivacyTermsCheckboxValidator.java | 3 +- .../validator/url/PizzaUrlValidator.java | 5 +- .../validator/user/PizzaUserIdValidator.java | 3 +- .../columns/admin_contact_data_columns.tpl | 68 +++--- .../admin_contact_data_columns_mini.tpl | 20 +- .../resources/tags/messages/message_box.tpl | 16 +- .../tags/messages/message_box_mini.tpl | 33 --- .../table_rows/mobile_selection_table_row.tpl | 14 +- .../user_personal_title_table_row.tpl | 12 +- .../user_profile_mode_table_row.tpl | 12 +- web/WEB-INF/templates/admin/admin_footer.tpl | 2 +- web/WEB-INF/templates/admin/admin_menu.tpl | 16 +- .../admin_form_business_basic_data.tpl | 118 +++++----- .../admin/contact/admin_contact_data_mini.tpl | 14 +- .../admin/contact/admin_contact_links.tpl | 8 +- .../admin/contact/admin_form_contact_data.tpl | 120 +++++----- .../admin/contact/admin_show_contact_data.tpl | 2 +- .../admin/country/admin_form_country_data.tpl | 48 ++-- .../admin/fax/admin_fax_add_show.tpl | 2 +- .../templates/admin/fax/admin_fax_data.tpl | 26 +-- .../templates/admin/fax/admin_fax_links.tpl | 16 +- .../admin/fax/admin_form_add_contact_fax.tpl | 30 +-- .../admin/fax/admin_form_fax_data.tpl | 18 +- .../admin_form_add_contact_landline.tpl | 30 +-- .../landline/admin_form_landline_data.tpl | 18 +- .../landline/admin_landline_add_show.tpl | 2 +- .../admin/landline/admin_landline_data.tpl | 26 +-- .../admin/landline/admin_landline_links.tpl | 16 +- .../mobile/admin_form_add_contact_mobile.tpl | 20 +- .../mobile/admin_form_contact_mobile.tpl | 2 +- .../admin/mobile/admin_form_mobile_data.tpl | 26 +-- .../admin/mobile/admin_mobile_add_show.tpl | 2 +- .../admin/mobile/admin_mobile_data.tpl | 30 +-- .../admin/mobile/admin_mobile_links.tpl | 16 +- .../admin_form_mobile_provider.tpl | 26 +-- .../admin/user/admin_form_user_data.tpl | 26 +-- .../admin/user/admin_show_user_data.tpl | 34 +-- .../admin/user/admin_show_user_data_mini.tpl | 18 +- .../templates/admin/user/admin_user_links.tpl | 8 +- web/WEB-INF/templates/base.tpl | 34 ++- .../templates/contact/form_contact_data.tpl | 108 ++++----- .../guest_email_address_repeat_fields.tpl | 16 +- web/WEB-INF/templates/guest/guest_footer.tpl | 12 +- web/WEB-INF/templates/guest/guest_menu.tpl | 4 +- .../templates/guest/guest_privacy_terms.tpl | 16 +- .../templates/guest/user/guest_login_form.tpl | 24 +- .../register/guest_form_register_page1.tpl | 32 +-- .../register/guest_form_register_page2.tpl | 8 +- .../register/guest_form_register_single.tpl | 32 +-- .../input_fields/fax_input_fields.tpl | 8 +- .../input_fields/landline_input_fields.tpl | 8 +- .../templates/login/user/user_base.tpl | 5 +- ...ser_change_email_address_repeat_fields.tpl | 20 +- .../user/user_enter_current_password.tpl | 8 +- .../templates/login/user/user_footer.tpl | 10 +- .../templates/login/user/user_menu.tpl | 8 +- .../templates/user/user_not_logged_in.tpl | 4 +- .../templates/user/user_profile_link.tpl | 2 +- web/WEB-INF/templates/user/userid_error.tpl | 4 +- web/WEB-INF/widgets.jsf.taglib.xml | 23 +- web/admin/admin_logout.xhtml | 4 +- .../admin_business_contacts_list.xhtml | 12 +- web/admin/contact/admin_contact_delete.xhtml | 10 +- web/admin/contact/admin_contact_edit.xhtml | 10 +- web/admin/contact/admin_contact_export.xhtml | 10 +- web/admin/contact/admin_contact_list.xhtml | 12 +- web/admin/contact/admin_contact_show.xhtml | 2 +- .../unlink/admin_contact_fax_unlink.xhtml | 12 +- .../admin_contact_landline_unlink.xhtml | 12 +- .../unlink/admin_contact_mobile_unlink.xhtml | 12 +- web/admin/country/admin_country_list.xhtml | 10 +- web/admin/fax/admin_fax_delete.xhtml | 8 +- web/admin/fax/admin_fax_edit.xhtml | 10 +- web/admin/fax/admin_fax_list.xhtml | 4 +- web/admin/fax/admin_fax_show.xhtml | 36 +-- .../landline/admin_landline_delete.xhtml | 8 +- web/admin/landline/admin_landline_edit.xhtml | 10 +- web/admin/landline/admin_landline_list.xhtml | 4 +- web/admin/landline/admin_landline_show.xhtml | 36 +-- .../mobile/admin_contact_mobile_list.xhtml | 2 +- web/admin/mobile/admin_mobile_delete.xhtml | 8 +- web/admin/mobile/admin_mobile_edit.xhtml | 10 +- web/admin/mobile/admin_mobile_list.xhtml | 4 +- web/admin/mobile/admin_mobile_show.xhtml | 36 +-- .../admin_mobile_provider_list.xhtml | 10 +- web/admin/user/admin_user_activity_log.xhtml | 4 +- web/admin/user/admin_user_delete.xhtml | 18 +- web/admin/user/admin_user_edit.xhtml | 10 +- web/admin/user/admin_user_export.xhtml | 10 +- web/admin/user/admin_user_list.xhtml | 20 +- web/admin/user/admin_user_lock.xhtml | 38 ++-- .../admin_user_resend_confirmation_link.xhtml | 14 +- web/admin/user/admin_user_show.xhtml | 2 +- web/admin/user/admin_user_unlock.xhtml | 38 ++-- web/guest/user/user_confirm_account.xhtml | 8 +- web/guest/user/user_list.xhtml | 8 +- web/guest/user/user_login.xhtml | 2 +- web/guest/user/user_lost_password.xhtml | 22 +- web/guest/user/user_profile.xhtml | 6 +- web/guest/user/user_register.xhtml | 4 +- web/guest/user/user_register_page2.xhtml | 2 +- web/guest/user/user_resend_link.xhtml | 18 +- web/resources/css/default.css | 7 +- web/resources/css/layout.css | 207 +++++++++--------- web/user/login_contact_data_saved.xhtml | 2 +- web/user/login_edit_user_data.xhtml | 2 +- web/user/login_logout.xhtml | 4 +- .../login_user_change_email_address.xhtml | 14 +- web/user/login_user_change_password.xhtml | 24 +- .../login_user_change_personal_data.xhtml | 10 +- web/user/login_user_contact_data_saved.xhtml | 2 +- 133 files changed, 1242 insertions(+), 1209 deletions(-) create mode 100644 src/java/org/mxchange/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java delete mode 100644 web/WEB-INF/resources/tags/messages/message_box_mini.tpl diff --git a/src/java/org/mxchange/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java b/src/java/org/mxchange/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java new file mode 100644 index 00000000..b67bc4d9 --- /dev/null +++ b/src/java/org/mxchange/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2017 Roland Häder + * + * 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.validator.business.basicdata; + +import java.text.MessageFormat; +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.ConverterException; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.ValidatorException; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote; +import org.mxchange.jcoreee.validator.string.BaseStringValidator; + +/** + * A validator for company names + *

+ * @author Roland Häder + */ +@FacesValidator ("CompanyNameValidator") +public class FinancialsCompanyNameValidator extends BaseStringValidator { + + /** + * Business contact EJB + */ + private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN; + + /** + * Serial number + */ + private static final long serialVersionUID = 57_283_657_476_561L; + + @Override + public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { + // All accepted, required fields + String[] requiredFields = {"companyName"}; //NOI18N + + // Pre-validation (example: not null, not a string, empty string ...) + super.preValidate(context, component, value, requiredFields, false); + + // Convert name to string (now securely checked in BaseStringValidator) + String companyName = (String) value; + + // Default is to check on existing names + Boolean checkExisting = Boolean.TRUE; + + // Is attribute "allowEmptyValue" set? + if (component.getAttributes().containsKey("checkExisting")) { //NOI18N + // Get attribute + Object attribute = component.getAttributes().get("checkExisting"); //NOI18N + + // Make sure, it is Boolean as no String is accepted anymore + if (!(attribute instanceof String)) { + // Not valid attribute, please use "true" or "false" (default) + throw new IllegalArgumentException("checkExisting must be of type String. Please use \"true\" or \"false\" for f:attribute value."); //NOI18N + } + + // Securely cast it + checkExisting = Boolean.parseBoolean((String) attribute); + } + + // Is the bean not yet set? + // @TODO Requires this synchronization or is it (sync) confusing the container? + if (null == FinancialsCompanyNameValidator.BASIC_DATA_BEAN) { + // Try to get it + try { + // Get initial context + Context initialContext = new InitialContext(); + + // ... and user controller + FinancialsCompanyNameValidator.BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N + } + } + + // Check if name is already used + Boolean nameExists = FinancialsCompanyNameValidator.BASIC_DATA_BEAN.isCompanyNameUsed(companyName); + + // Is the user id valid? + if ((!nameExists) && (checkExisting)) { + // Format message + String message = MessageFormat.format("No basic data found with comany name {0}.", companyName); + + // Name does not exist + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N + } else if ((nameExists) && (!checkExisting)) { + // Format message + String message = MessageFormat.format("Found basic data with comany name {0}.", companyName); + + // Name already exists + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N + } + } + +} diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 6e5514da..81dcf3f2 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -793,30 +793,25 @@ GUEST_REGISTRATION_PASSWORD_REPEAT_NOT_ENTERED=Bitte wiederholen Sie das eingege PAGE_TITLE_ADMIN_AREA=Administration #@TODO Please fix German umlauts! ADMIN_MENU_BUSINESS_BASIC_DATA_TITLE=Geschaeftliche Kontakte +LINK_ADMIN_LIST_BUSINESS_BASIC_DATA=Stammdaten auflisten +LINK_ADMIN_LIST_BUSINESS_BASIC_DATA_TITLE=Listet Stammdaten auf +LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA=Stammdaten exportieren +LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA_TITLE=Exportiert Stammdaten +PAGE_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=Stammdaten auflisten #@TODO Please fix German umlauts! -LINK_ADMIN_LIST_BUSINESS_BASIC_DATA=Geschaeftskontakte auflisten +CONTENT_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=Auflisten von Stammdaten #@TODO Please fix German umlauts! -LINK_ADMIN_LIST_BUSINESS_BASIC_DATA_TITLE=Listet geschaeftliche Kontakte auf +ADMIN_BUSINESS_BASIC_DATA_LIST_EMPTY=Es befinden sich keine Stammdaten in der Datenbank. #@TODO Please fix German umlauts! -LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA=Geschaeftliche Kontakte exportieren -#@TODO Please fix German umlauts! -LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA_TITLE=Exportiert geschaeftliche Kontakte -#@TODO Please fix German umlauts! -PAGE_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=Geschaeftliche Kontakte auflisten -#@TODO Please fix German umlauts! -CONTENT_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=Auflisten von geschaeftlichen Kontakt -#@TODO Please fix German umlauts! -ADMIN_BUSINESS_BASIC_DATA_LIST_EMPTY=Es befinden sich keine geschaeftlichen Kontakte in der Datenbank. -#@TODO Please fix German umlauts! -TABLE_SUMMARY_ADMIN_LIST_BUSINESS_BASIC_DATA=Tabelle listet geschaeftliche Kontakte auf. +TABLE_SUMMARY_ADMIN_LIST_BUSINESS_BASIC_DATA=Tabelle listet Stammdaten auf. ADMIN_BUSINESS_BASIC_DATA_ID=Id-Nummer: #@TODO Please fix German umlauts! -ADMIN_LINK_SHOW_BUSINESS_CONTACT_DATA_TITLE=Details des geschaeftlichen Kontaktes anzeigen. +ADMIN_LINK_SHOW_BUSINESS_CONTACT_DATA_TITLE=Details des Stammdatens anzeigen. ADMIN_BUSINESS_BASIC_DATA_OWNER_ID=Zugew. Benutzer: ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_OWNER_USER_TITLE=Benutzerprofil des zugewiesenen Benutzers anzeigen. ADMIN_LINK_ASSIGN=Zuweisen #@TODO Please fix German umlauts! -ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER_TITLE=Geschaeftlichen Kontakt einen Benutzeraccount zuweisen. +ADMIN_LINK_ASSIGN_BUSINESS_BASIC_DATA_OWNER_USER_TITLE=Stammdaten einen Benutzeraccount zuweisen. ADMIN_BUSINESS_BASIC_DATA_COMPANY_NAME=Firmenname: ADMIN_BUSINESS_BASIC_DATA_CONTACT_PERSON=Ansprechpartner: ADMIN_LINK_SHOW_BUSINESS_BASIC_DATA_CONTACT_PERSON_TITLE=Zeigt einen Mitarbeiter an, der als Ansprechpartner eingetragen ist. @@ -850,7 +845,7 @@ BUTTON_CHANGE_LOCALE_TITLE=Aendern Sie hier in der aktuellen Sitzung die angezei ERROR_PARAMETER_LABEL_MESSAGE_NOT_SET=Fehler: Parameter "labelMessage" nicht gesetzt. #@TODO Please fix German umlauts! ADMIN_SELECT_BUSINESS_DATA_COMPANY_FOUNDER=Firmengruender auswaehlen: -ADMIN_BUSINESS_DATA_UPLOAD_LOGO_UNFINISHED=Das Hochladen des Firmenlogos ist noch nicht fertig gestellt. +ADMIN_FEATURE_UNFINISHED_WARNING=Diese Funktion ist noch nicht fertiggestellt. ADMIN_BUSINESS_DATA_COMPANY_TAX_NUMBER=Steuernummer: ADMIN_BUSINESS_DATA_COMPANY_WEBSITE_URL=Webseiten-URL: ADMIN_SELECT_BUSINESS_DATA_COMPANY_USER_OWNER=Unternehmen einem Benutzer zuweisen: diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index b3ab49c3..27a590aa 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -785,14 +785,14 @@ GUEST_REGISTRATION_PASSWORD_NOT_ENTERED=Please enter a password. This must match GUEST_REGISTRATION_PASSWORD_REPEAT_NOT_ENTERED=Please repeat the entered password. This done to confirm the password. PAGE_TITLE_ADMIN_AREA=Administration ADMIN_MENU_BUSINESS_BASIC_DATA_TITLE=Business contacts -LINK_ADMIN_LIST_BUSINESS_BASIC_DATA=List business contacts -LINK_ADMIN_LIST_BUSINESS_BASIC_DATA_TITLE=Lists business contacts -LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA=Export business contacts -LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA_TITLE=Exports business contacts -PAGE_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=List business contacts -CONTENT_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=Lists business contacts -ADMIN_BUSINESS_BASIC_DATA_LIST_EMPTY=There are currently no business contacts in database. -TABLE_SUMMARY_ADMIN_LIST_BUSINESS_BASIC_DATA=This table lists business contacts. +LINK_ADMIN_LIST_BUSINESS_BASIC_DATA=List basic company data +LINK_ADMIN_LIST_BUSINESS_BASIC_DATA_TITLE=Lists basic company data +LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA=Export basic company data +LINK_ADMIN_EXPORT_BUSINESS_BASIC_DATA_TITLE=Exports basic company data +PAGE_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=List basic company data +CONTENT_TITLE_ADMIN_LIST_BUSINESS_BASIC_DATA=Lists basic company data +ADMIN_BUSINESS_BASIC_DATA_LIST_EMPTY=There are currently no basic company data in database. +TABLE_SUMMARY_ADMIN_LIST_BUSINESS_BASIC_DATA=This table lists basic company data. ADMIN_BUSINESS_BASIC_DATA_ID=Id Number: ADMIN_LINK_SHOW_BUSINESS_CONTACT_DATA_TITLE=Show details of this business contact. ADMIN_BUSINESS_BASIC_DATA_OWNER_ID=Assigned user: @@ -825,7 +825,7 @@ BUTTON_CHANGE_LOCALE=Change BUTTON_CHANGE_LOCALE_TITLE=Change here in your current session the used language for text output. ERROR_PARAMETER_LABEL_MESSAGE_NOT_SET=Error: Parameter "labelMessage" not set. ADMIN_SELECT_BUSINESS_DATA_COMPANY_FOUNDER=Choose company founder: -ADMIN_BUSINESS_DATA_UPLOAD_LOGO_UNFINISHED=The upload of the company logo is currently unfinished. +ADMIN_FEATURE_UNFINISHED_WARNING=This feature is not yet finished. ADMIN_BUSINESS_DATA_COMPANY_TAX_NUMBER=Tax number: ADMIN_BUSINESS_DATA_COMPANY_WEBSITE_URL=Website URL: ADMIN_SELECT_BUSINESS_DATA_COMPANY_USER_OWNER=Select user to assign with company: diff --git a/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaAdminBusinessDataWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaAdminBusinessDataWebRequestBean.java index d5b1c671..80ef320d 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaAdminBusinessDataWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaAdminBusinessDataWebRequestBean.java @@ -31,8 +31,8 @@ import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemo import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jcontactsbusiness.events.basicdata.added.BusinessBasicDataAddedEvent; -import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableBusinessBasicDataAddedEvent; +import org.mxchange.jcontactsbusiness.events.basicdata.added.AdminAddedBusinessBasicDataEvent; +import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent; import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataAlreadyAddedException; import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData; import org.mxchange.jcountry.data.Country; @@ -67,7 +67,7 @@ public class PizzaAdminBusinessDataWebRequestBean extends BasePizzaController im */ @Inject @Any - private Event businessDataAddedEvent; + private Event businessDataAddedEvent; /** * Comments for this company @@ -234,7 +234,7 @@ public class PizzaAdminBusinessDataWebRequestBean extends BasePizzaController im BusinessBasicData updatedBasicData = this.adminBusinessDataBean.addCompanyBasicData(basicData); // Fire event - this.businessDataAddedEvent.fire(new BusinessBasicDataAddedEvent(updatedBasicData)); + this.businessDataAddedEvent.fire(new AdminAddedBusinessBasicDataEvent(updatedBasicData)); } catch (final BusinessDataAlreadyAddedException e) { // Does already exist throw new FacesException(e); diff --git a/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaBusinessDataWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaBusinessDataWebSessionBean.java index c7dc6332..c59eb9b4 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaBusinessDataWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/business/basicdata/PizzaBusinessDataWebSessionBean.java @@ -16,9 +16,11 @@ */ package org.mxchange.pizzaapplication.beans.business.basicdata; +import java.text.MessageFormat; import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; +import javax.enterprise.event.Observes; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; @@ -28,6 +30,7 @@ import javax.naming.NamingException; import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote; import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote; +import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent; import org.mxchange.jcountry.data.Country; import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.user.login.PizzaUserLoginWebSessionController; @@ -120,6 +123,37 @@ public class PizzaBusinessDataWebSessionBean extends BasePizzaController impleme super(); } + /** + * Observers events being fired when an administrator has added company + * basic data. + *

+ * @param event Event being fired + */ + public void afterAdminAddedBasicCompanyDataEvent (@Observes final ObservableAdminAddedBusinessBasicDataEvent event) { + // Is the parameter valid? + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); + } else if (event.getBasicData() == null) { + // Throw NPE again + throw new NullPointerException("event.basicData is null"); + } else if (event.getBasicData().getCompanyDataId() == null) { + // Throw NPE again + throw new NullPointerException("event.basicData.companyDataId is null"); + } else if (event.getBasicData().getCompanyDataId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("event.basicData.companyDataId={0} is invalid", event.getBasicData().getCompanyDataId())); + } else if (event.getBasicData().getCompanyName() == null) { + // Throw NPE again + throw new NullPointerException("event.basicData.companyName is null"); + } else if (event.getBasicData().getCompanyName().isEmpty()) { + // Throw IAE again + throw new IllegalArgumentException("event.basicData.companyName is empty"); + } + + // Add it to list + this.businessContacts.add(event.getBasicData()); + } /** * Returns a list of all business contacts diff --git a/src/java/org/mxchange/pizzaapplication/converter/business/basicdata/PizzaBusinessContactConverter.java b/src/java/org/mxchange/pizzaapplication/converter/business/basicdata/PizzaBusinessContactConverter.java index fafd402a..e7da05b0 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/business/basicdata/PizzaBusinessContactConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/business/basicdata/PizzaBusinessContactConverter.java @@ -25,7 +25,6 @@ import javax.faces.convert.FacesConverter; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; -import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote; import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataNotFoundException; @@ -36,12 +35,12 @@ import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataNotFoundE * @author Roland Häder */ @FacesConverter (value = "BusinessContactConverter") -public class PizzaBusinessContactConverter implements Converter { +public class PizzaBusinessContactConverter implements Converter { /** * Business contact EJB */ - private static BusinessDataSessionBeanRemote BUSINESS_CONTACT_BEAN; + private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN; /** * Default constructor @@ -50,7 +49,7 @@ public class PizzaBusinessContactConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public BusinessBasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -62,14 +61,14 @@ public class PizzaBusinessContactConverter implements Converter { // Is the bean there? // @TODO Requires this synchronization or is it (sync) confusing the container? - if (null == PizzaBusinessContactConverter.BUSINESS_CONTACT_BEAN) { + if (null == PizzaBusinessContactConverter.BASIC_DATA_BEAN) { // Try to get it try { // Get initial context Context initialContext = new InitialContext(); // ... and user controller - PizzaBusinessContactConverter.BUSINESS_CONTACT_BEAN = (BusinessDataSessionBeanRemote) initialContext.lookup("java:global/pizzaapplication-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N + PizzaBusinessContactConverter.BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initialContext.lookup("java:global/pizzaapplication-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N } catch (final NamingException ex) { // Continue to throw it throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N @@ -84,7 +83,7 @@ public class PizzaBusinessContactConverter implements Converter { Long basicDataId = Long.valueOf(submittedValue); // Try to get user instance from it - businessContact = PizzaBusinessContactConverter.BUSINESS_CONTACT_BEAN.findBusinessDataById(basicDataId); + businessContact = PizzaBusinessContactConverter.BASIC_DATA_BEAN.findBusinessDataById(basicDataId); } catch (final NumberFormatException ex) { // Throw again throw new ConverterException(ex); @@ -98,18 +97,15 @@ public class PizzaBusinessContactConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final BusinessBasicData value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof Contact)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Contact.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((BusinessBasicData) value).getCompanyDataId()); + return String.valueOf(value.getCompanyDataId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/business/company_employee/PizzaCompanyEmployeeConverter.java b/src/java/org/mxchange/pizzaapplication/converter/business/company_employee/PizzaCompanyEmployeeConverter.java index f7283561..b72f51bc 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/business/company_employee/PizzaCompanyEmployeeConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/business/company_employee/PizzaCompanyEmployeeConverter.java @@ -35,7 +35,7 @@ import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoun * @author Roland Häder */ @FacesConverter (value = "CompanyEmployeeConverter") -public class PizzaCompanyEmployeeConverter implements Converter { +public class PizzaCompanyEmployeeConverter implements Converter { /** * CompanyEmployee EJB @@ -49,7 +49,7 @@ public class PizzaCompanyEmployeeConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public Employee getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -68,7 +68,7 @@ public class PizzaCompanyEmployeeConverter implements Converter { Context initialContext = new InitialContext(); // ... and user controller - PizzaCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN = (CompanyEmployeeSessionBeanRemote) initialContext.lookup("java:global/pizzaservice-ejb/companyEmployee!org.mxchange.jcontactsbusiness.company_employee.CompanyEmployeeSessionBeanRemote"); //NOI18N + PizzaCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN = (CompanyEmployeeSessionBeanRemote) initialContext.lookup("java:global/pizzaservice-ejb/companyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote"); //NOI18N } catch (final NamingException ex) { // Continue to throw it throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N @@ -97,18 +97,15 @@ public class PizzaCompanyEmployeeConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final Employee value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof Employee)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Employee.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((Employee) value).getEmployeeId()); + return String.valueOf(value.getEmployeeId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/business/headquarters/PizzaCompanyHeadquartersConverter.java b/src/java/org/mxchange/pizzaapplication/converter/business/headquarters/PizzaCompanyHeadquartersConverter.java index 4f7de1af..8c0412bf 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/business/headquarters/PizzaCompanyHeadquartersConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/business/headquarters/PizzaCompanyHeadquartersConverter.java @@ -35,7 +35,7 @@ import org.mxchange.jcontactsbusiness.headquarters.HeadquartersData; * @author Roland Häder */ @FacesConverter (value = "CompanyHeadquartersConverter") -public class PizzaCompanyHeadquartersConverter implements Converter { +public class PizzaCompanyHeadquartersConverter implements Converter { /** * CompanyEmployee EJB @@ -49,7 +49,7 @@ public class PizzaCompanyHeadquartersConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public HeadquartersData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -97,18 +97,15 @@ public class PizzaCompanyHeadquartersConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final HeadquartersData value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof HeadquartersData)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement HeadquartersData.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((HeadquartersData) value).getHeadquartersId()); + return String.valueOf(value.getHeadquartersId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java b/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java index 945e55af..02490690 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java @@ -35,7 +35,7 @@ import org.mxchange.jcontacts.exceptions.ContactNotFoundException; * @author Roland Häder */ @FacesConverter (value = "ContactConverter") -public class PizzaContactConverter implements Converter { +public class PizzaContactConverter implements Converter { /** * User EJB @@ -49,7 +49,7 @@ public class PizzaContactConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -97,18 +97,15 @@ public class PizzaContactConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final Contact value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof Contact)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Contact.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((Contact) value).getContactId()); + return String.valueOf(value.getContactId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java b/src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java index d57413d2..07774554 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java @@ -36,7 +36,7 @@ import org.mxchange.jcountry.data.CountrySingletonBeanRemote; * @author Roland Häder */ @FacesConverter (value = "CountryConverter") -public class PizzaCountryConverter implements Converter { +public class PizzaCountryConverter implements Converter { /** * Country bean @@ -50,7 +50,7 @@ public class PizzaCountryConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -109,18 +109,15 @@ public class PizzaCountryConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final Country value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof Country)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Country.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((Country) value).getCountryId()); + return String.valueOf(value.getCountryId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java b/src/java/org/mxchange/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java index 7477f2d8..ace56e1d 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java @@ -26,7 +26,6 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.DialableNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; @@ -36,7 +35,7 @@ import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; * @author Roland Häder */ @FacesConverter (value = "FaxNumberConverter") -public class PizzaFaxNumberConverter implements Converter { +public class PizzaFaxNumberConverter implements Converter { /** * Phone EJB @@ -50,7 +49,7 @@ public class PizzaFaxNumberConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Log message // @TODO Not possible here: this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: context={1},component={2},submittedValue={3} - CALLED!", this.getClass().getSimpleName(), context, component, submittedValue)); //NOI18N @@ -105,18 +104,15 @@ public class PizzaFaxNumberConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final DialableFaxNumber value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof DialableNumber)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((DialableNumber) value).getPhoneId()); + return String.valueOf(value.getPhoneId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java b/src/java/org/mxchange/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java index 7aeccc36..e7133b03 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java @@ -26,7 +26,6 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.DialableNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; @@ -36,7 +35,7 @@ import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; * @author Roland Häder */ @FacesConverter (value = "LandLineNumberConverter") -public class PizzaLandLineNumberConverter implements Converter { +public class PizzaLandLineNumberConverter implements Converter { /** * Phone EJB @@ -50,7 +49,7 @@ public class PizzaLandLineNumberConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -98,18 +97,15 @@ public class PizzaLandLineNumberConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final DialableLandLineNumber value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof DialableNumber)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((DialableNumber) value).getPhoneId()); + return String.valueOf(value.getPhoneId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java b/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java index e686baf5..68b3359a 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java @@ -26,7 +26,6 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.DialableNumber; import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; @@ -35,8 +34,8 @@ import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; *

* @author Roland Häder */ -@FacesConverter (value = "CellphoneConverter") -public class PizzaMobileNumberConverter implements Converter { +@FacesConverter (value = "MobileNumberConverter") +public class PizzaMobileNumberConverter implements Converter { /** * Phone EJB @@ -50,7 +49,7 @@ public class PizzaMobileNumberConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -101,18 +100,15 @@ public class PizzaMobileNumberConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final DialableMobileNumber value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof DialableNumber)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((DialableNumber) value).getPhoneId()); + return String.valueOf(value.getPhoneId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java b/src/java/org/mxchange/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java index f0ff4d2f..3f88e361 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java @@ -36,7 +36,7 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBe * @author Roland Häder */ @FacesConverter (value = "MobileProviderConverter") -public class PizzaMobileProviderConverter implements Converter { +public class PizzaMobileProviderConverter implements Converter { /** * Mobile provider bean @@ -50,7 +50,7 @@ public class PizzaMobileProviderConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public MobileProvider getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -109,18 +109,15 @@ public class PizzaMobileProviderConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final MobileProvider value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof MobileProvider)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement MobileProvider.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((MobileProvider) value).getProviderId()); + return String.valueOf(value.getProviderId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/converter/user/PizzaUserConverter.java b/src/java/org/mxchange/pizzaapplication/converter/user/PizzaUserConverter.java index 052bb24d..d7910c07 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/user/PizzaUserConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/user/PizzaUserConverter.java @@ -35,7 +35,7 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote; * @author Roland Häder */ @FacesConverter (value = "UserConverter") -public class PizzaUserConverter implements Converter { +public class PizzaUserConverter implements Converter { /** * User EJB @@ -49,7 +49,7 @@ public class PizzaUserConverter implements Converter { } @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -97,18 +97,15 @@ public class PizzaUserConverter implements Converter { } @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + public String getAsString (final FacesContext context, final UIComponent component, final User value) { // Is the object null? if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N - } else if (!(value instanceof User)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement User.", value.getClass().getSimpleName())); //NOI18N } // Return id number - return String.valueOf(((User) value).getUserId()); + return String.valueOf(value.getUserId()); } } diff --git a/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java b/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java index b1a3c9b0..5dbc3fd1 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/birthday/PizzaBirthdayValidator.java @@ -16,17 +16,11 @@ */ package org.mxchange.pizzaapplication.validator.birthday; -import java.text.MessageFormat; import java.util.Date; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; -import javax.faces.convert.ConverterException; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; import org.mxchange.jcoreee.validator.date.BaseDateValidator; /** @@ -35,7 +29,7 @@ import org.mxchange.jcoreee.validator.date.BaseDateValidator; * @author Roland Häder */ @FacesValidator ("BirthdayValidator") -public class PizzaBirthdayValidator extends BaseDateValidator implements Validator { +public class PizzaBirthdayValidator extends BaseDateValidator { /** * Serial number @@ -44,17 +38,8 @@ public class PizzaBirthdayValidator extends BaseDateValidator implements Validat /** * Default constructor - * @TODO Get rid of this */ public PizzaBirthdayValidator () { - // Try to get it - try { - // Get initial context - Context initialContext = new InitialContext(); - } catch (final NamingException ex) { - // Continue to throw it - throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } } @Override diff --git a/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java b/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java index 143f0575..41c284b0 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java @@ -22,7 +22,6 @@ import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import javax.naming.Context; import javax.naming.InitialContext; @@ -36,7 +35,7 @@ import org.mxchange.jcoreee.validator.string.BaseStringValidator; * @author Roland Häder */ @FacesValidator ("EmailAddressValidator") -public class PizzaEmailAddressValidator extends BaseStringValidator implements Validator { +public class PizzaEmailAddressValidator extends BaseStringValidator { /** * Contact session-scoped bean @@ -113,7 +112,7 @@ public class PizzaEmailAddressValidator extends BaseStringValidator implements V String message = MessageFormat.format("Email address {0} does not match regular expression.", emailAddress); //NOI18N // Not matching - throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message)); + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); } // Is the bean not yet set? diff --git a/src/java/org/mxchange/pizzaapplication/validator/names/PizzaNameValidator.java b/src/java/org/mxchange/pizzaapplication/validator/names/PizzaNameValidator.java index ae35ce91..a28a03dd 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/names/PizzaNameValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/names/PizzaNameValidator.java @@ -19,7 +19,6 @@ package org.mxchange.pizzaapplication.validator.names; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import org.mxchange.jcoreee.validator.string.BaseStringValidator; @@ -29,7 +28,7 @@ import org.mxchange.jcoreee.validator.string.BaseStringValidator; * @author Roland Häder */ @FacesValidator ("NameValidator") -public class PizzaNameValidator extends BaseStringValidator implements Validator { +public class PizzaNameValidator extends BaseStringValidator { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/validator/number/item_amount/PizzaItemAmountValidator.java b/src/java/org/mxchange/pizzaapplication/validator/number/item_amount/PizzaItemAmountValidator.java index 00adcb60..a281f7c2 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/number/item_amount/PizzaItemAmountValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/number/item_amount/PizzaItemAmountValidator.java @@ -29,7 +29,7 @@ import org.mxchange.jcoreee.validator.number.BaseNumberValidator; * @author Roland Häder */ @FacesValidator ("ItemAmountValidator") -public class PizzaItemAmountValidator extends BaseNumberValidator implements Validator { +public class PizzaItemAmountValidator extends BaseNumberValidator { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/validator/password/PizzaUserPasswordValidator.java b/src/java/org/mxchange/pizzaapplication/validator/password/PizzaUserPasswordValidator.java index 01e775cc..31835c2c 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/password/PizzaUserPasswordValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/password/PizzaUserPasswordValidator.java @@ -20,7 +20,6 @@ import java.text.MessageFormat; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import javax.naming.Context; import javax.naming.InitialContext; @@ -33,7 +32,7 @@ import org.mxchange.jcoreee.validator.string.BaseStringValidator; * @author Roland Häder */ @FacesValidator ("UserPasswordValidator") -public class PizzaUserPasswordValidator extends BaseStringValidator implements Validator { +public class PizzaUserPasswordValidator extends BaseStringValidator { /** * Serial number @@ -70,7 +69,7 @@ public class PizzaUserPasswordValidator extends BaseStringValidator implements V // Test it here if (!UserUtils.ifPasswordMatches(container, this.userLoginController.getLoggedInUser())) { // Password mismatches - throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password mismatching.", "The password the user has entered does not match the stored password.")); //NOI18N + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, "Password mismatching.", "The password the user has entered does not match the stored password.")); //NOI18N } */ } diff --git a/src/java/org/mxchange/pizzaapplication/validator/phone/abroad/PizzaAbroadDialValidator.java b/src/java/org/mxchange/pizzaapplication/validator/phone/abroad/PizzaAbroadDialValidator.java index fbce16bd..c0fd9144 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/phone/abroad/PizzaAbroadDialValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/phone/abroad/PizzaAbroadDialValidator.java @@ -21,9 +21,8 @@ import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; -import org.mxchange.jcoreee.validator.BaseObjectValidator; +import org.mxchange.jcoreee.validator.number.BaseNumberValidator; /** * A validator for phone, fax and mobile numbers @@ -31,7 +30,7 @@ import org.mxchange.jcoreee.validator.BaseObjectValidator; * @author Roland Häder */ @FacesValidator ("AbroadDialValidator") -public class PizzaAbroadDialValidator extends BaseObjectValidator implements Validator { +public class PizzaAbroadDialValidator extends BaseNumberValidator { /** * Serial number @@ -59,11 +58,11 @@ public class PizzaAbroadDialValidator extends BaseObjectValidator implements Val // Not valid range? (1 - 99, very rude) if (number < 1 || number > 99) { // Not allowed - throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, MessageFormat.format("Number {0} is not between 1 and 99 inclusive.", number), MessageFormat.format("The entered number {0} is not in the range of 1 and 99 inclusive. This cannot be used as abroad dial prefix. Alternatively enter international '+' sign.", number))); //NOI18N + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, MessageFormat.format("Number {0} is not between 1 and 99 inclusive.", number), MessageFormat.format("The entered number {0} is not in the range of 1 and 99 inclusive. This cannot be used as abroad dial prefix. Alternatively enter international '+' sign.", number))); //NOI18N } } catch (final NumberFormatException ex) { // Didn't work - throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "No number or + entered", "No number or + sign has been entered."), ex); //NOI18N + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, "No number or + entered", "No number or + sign has been entered."), ex); //NOI18N } } } diff --git a/src/java/org/mxchange/pizzaapplication/validator/phone/number/PizzaPhoneNumberValidator.java b/src/java/org/mxchange/pizzaapplication/validator/phone/number/PizzaPhoneNumberValidator.java index f249b7c1..7585da39 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/phone/number/PizzaPhoneNumberValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/phone/number/PizzaPhoneNumberValidator.java @@ -19,7 +19,6 @@ package org.mxchange.pizzaapplication.validator.phone.number; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import org.mxchange.jcoreee.validator.number.BaseNumberValidator; @@ -29,7 +28,7 @@ import org.mxchange.jcoreee.validator.number.BaseNumberValidator; * @author Roland Häder */ @FacesValidator ("PhoneNumberValidator") -public class PizzaPhoneNumberValidator extends BaseNumberValidator implements Validator { +public class PizzaPhoneNumberValidator extends BaseNumberValidator { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/validator/privacy_terms/PizzaPrivacyTermsCheckboxValidator.java b/src/java/org/mxchange/pizzaapplication/validator/privacy_terms/PizzaPrivacyTermsCheckboxValidator.java index 378c968a..48fb3c87 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/privacy_terms/PizzaPrivacyTermsCheckboxValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/privacy_terms/PizzaPrivacyTermsCheckboxValidator.java @@ -19,7 +19,6 @@ package org.mxchange.pizzaapplication.validator.privacy_terms; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import org.mxchange.jcoreee.validator.bool.BaseBooleanValidator; @@ -29,7 +28,7 @@ import org.mxchange.jcoreee.validator.bool.BaseBooleanValidator; * @author Roland Häder */ @FacesValidator ("PrivacyTermsCheckboxValidator") -public class PizzaPrivacyTermsCheckboxValidator extends BaseBooleanValidator implements Validator { +public class PizzaPrivacyTermsCheckboxValidator extends BaseBooleanValidator { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java b/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java index 64de4bc1..101fd758 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/url/PizzaUrlValidator.java @@ -22,7 +22,6 @@ import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import org.mxchange.jcoreee.validator.string.BaseStringValidator; @@ -33,7 +32,7 @@ import org.mxchange.jcoreee.validator.string.BaseStringValidator; * @author Roland Häder */ @FacesValidator ("UrlValidator") -public class PizzaUrlValidator extends BaseStringValidator implements Validator { +public class PizzaUrlValidator extends BaseStringValidator { /** * Pattern matcher @@ -104,7 +103,7 @@ public class PizzaUrlValidator extends BaseStringValidator implements Validator String message = MessageFormat.format("URL {0} does not match regular expression.", url); //NOI18N // Not matching - throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message)); + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); } } diff --git a/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java b/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java index cd0c45e9..f72bcb94 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java @@ -22,7 +22,6 @@ import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.ConverterException; import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import javax.naming.Context; import javax.naming.InitialContext; @@ -36,7 +35,7 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote; * @author Roland Häder */ @FacesValidator ("UserIdValidator") -public class PizzaUserIdValidator extends BaseNumberValidator implements Validator { +public class PizzaUserIdValidator extends BaseNumberValidator { /** * Remote bean diff --git a/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl b/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl index 1bfcb98a..963e838f 100644 --- a/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl +++ b/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl @@ -7,112 +7,112 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns_mini.tpl b/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns_mini.tpl index f510a317..10ced2d5 100644 --- a/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns_mini.tpl +++ b/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns_mini.tpl @@ -7,33 +7,33 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - + - + - + - + - + - + - + - + - + - + diff --git a/web/WEB-INF/resources/tags/messages/message_box.tpl b/web/WEB-INF/resources/tags/messages/message_box.tpl index 6eb85ec1..95b819ab 100644 --- a/web/WEB-INF/resources/tags/messages/message_box.tpl +++ b/web/WEB-INF/resources/tags/messages/message_box.tpl @@ -5,28 +5,28 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core"> - -

+ +
- +
- +
- +
- +
-
- +
+
diff --git a/web/WEB-INF/resources/tags/messages/message_box_mini.tpl b/web/WEB-INF/resources/tags/messages/message_box_mini.tpl deleted file mode 100644 index 893620e2..00000000 --- a/web/WEB-INF/resources/tags/messages/message_box_mini.tpl +++ /dev/null @@ -1,33 +0,0 @@ - - - - -
- -
- - - -
- -
-
- - -
- -
-
-
- - -
- -
-
-
-
diff --git a/web/WEB-INF/resources/tags/table_rows/mobile_selection_table_row.tpl b/web/WEB-INF/resources/tags/table_rows/mobile_selection_table_row.tpl index 3b0981e0..f4cbe83a 100644 --- a/web/WEB-INF/resources/tags/table_rows/mobile_selection_table_row.tpl +++ b/web/WEB-INF/resources/tags/table_rows/mobile_selection_table_row.tpl @@ -6,20 +6,20 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - + - + - -
+ +
-
+
- + @@ -30,7 +30,7 @@ - + diff --git a/web/WEB-INF/resources/tags/table_rows/user_personal_title_table_row.tpl b/web/WEB-INF/resources/tags/table_rows/user_personal_title_table_row.tpl index 3609e807..c28166e7 100644 --- a/web/WEB-INF/resources/tags/table_rows/user_personal_title_table_row.tpl +++ b/web/WEB-INF/resources/tags/table_rows/user_personal_title_table_row.tpl @@ -6,24 +6,24 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - + - -
+ +
-
+
- +
- + diff --git a/web/WEB-INF/resources/tags/table_rows/user_profile_mode_table_row.tpl b/web/WEB-INF/resources/tags/table_rows/user_profile_mode_table_row.tpl index c94a6087..086ad4fe 100644 --- a/web/WEB-INF/resources/tags/table_rows/user_profile_mode_table_row.tpl +++ b/web/WEB-INF/resources/tags/table_rows/user_profile_mode_table_row.tpl @@ -6,17 +6,17 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - + - + - -
+ +
-
+
@@ -24,7 +24,7 @@ - + diff --git a/web/WEB-INF/templates/admin/admin_footer.tpl b/web/WEB-INF/templates/admin/admin_footer.tpl index b569c98d..eeeb4add 100644 --- a/web/WEB-INF/templates/admin/admin_footer.tpl +++ b/web/WEB-INF/templates/admin/admin_footer.tpl @@ -5,7 +5,7 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> diff --git a/web/WEB-INF/templates/admin/admin_menu.tpl b/web/WEB-INF/templates/admin/admin_menu.tpl index cbef48b1..03dde486 100644 --- a/web/WEB-INF/templates/admin/admin_menu.tpl +++ b/web/WEB-INF/templates/admin/admin_menu.tpl @@ -7,7 +7,7 @@