From c66eb205cd1a0b6d4eaf0e1e7e576da1d5796ff5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 20 Apr 2017 17:53:23 +0200 Subject: [PATCH] Please cherry-pick: - removed event-observing methods from interfaces as they should not be called from other beans, but only invoked when the specific event has been fired. - remember these guide-lines: 1) Use interface for type-hinting objects, not direct class name. 2) All methods in interface are considered as callable (by you) 3) If you still need public methods (like it is needed for @PostConstruct or @Observes) don't add that method to interface. 4) This way, the interface is clean and simple (KISS), no exceptions (of, course thrown ...)! MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../AddressbookContactWebSessionBean.java | 53 ++++++--- ...ddressbookContactWebSessionController.java | 58 ---------- ...AddressbookContactPhoneWebSessionBean.java | 25 ++++- ...sbookContactPhoneWebSessionController.java | 25 ----- .../AddressbookCountryWebApplicationBean.java | 9 +- ...ssbookCountryWebApplicationController.java | 9 -- .../AddressbookLocalizationSessionBean.java | 12 +- ...ressbookLocalizationSessionController.java | 16 --- .../AddressbookUserLoginWebSessionBean.java | 13 ++- ...ressbookUserLoginWebSessionController.java | 9 -- ...dressbookMobileProviderWebRequestBean.java | 9 +- ...ookMobileProviderWebRequestController.java | 9 -- ...AddressbookUserRegisterWebSessionBean.java | 4 +- .../AddressbookAdminUserWebRequestBean.java | 13 ++- ...ressbookAdminUserWebRequestController.java | 24 ++-- .../user/AddressbookUserWebSessionBean.java | 105 ++++++++++-------- .../AddressbookUserWebSessionController.java | 81 ++------------ ...AddressbookUserPasswordWebRequestBean.java | 4 +- ...sbookUserPasswordWebRequestController.java | 24 ++-- .../AddressbookCellphoneConverter.java | 22 +--- .../contact/AddressbookContactConverter.java | 12 -- .../country/AddressbookCountryConverter.java | 9 -- .../AddressbookMobileProviderConverter.java | 9 -- .../user/AddressbookUserConverter.java | 12 -- .../AddressbookBirthdayValidator.java | 5 - .../user/AddressbookUserIdValidator.java | 17 +-- 26 files changed, 196 insertions(+), 392 deletions(-) diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java index c5f824e6..d69694df 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java @@ -251,11 +251,13 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.emailAddressList = new LinkedList<>(); } - @Override - public void afterAdminAddedContact (@Observes final ObservableAdminAddedContactEvent event) { - // Trace message - //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedContact(): event={0} - CALLED!", event)); //NOI18N - + /** + * 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 @@ -281,7 +283,11 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.selectableContacts.add(event.getAddedContact()); } - @Override + /** + * Event observer for newly added users by adminstrator + *

+ * @param event Event being fired + */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedUserEvent(): event={0} - CALLED!", event)); //NOI18N @@ -305,8 +311,13 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.clear(); } - @Override - public void afterAdminLinkedUser (@Observes final ObservableAdminLinkedUserEvent event) { + /** + * Observes events being fired when an administrator has linked a new user + * with existing contact data. + *

+ * @param event Event being fired + */ + public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) { // event should not be null if (null == event) { // Throw NPE @@ -332,7 +343,11 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.clear(); } - @Override + /** + * Event observer for updated contact data by administrators + *

+ * @param event Updated contact data event + */ public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) { // event should not be null if (null == event) { @@ -359,8 +374,12 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController //* NOISY-DEBUG: */ System.out.println("contactController.afterAdminUpdatedContactDataEvent(): EXIT!"); //NOI18N } - @Override - public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { + /** + * Event observer for new user registrations + *

+ * @param event User registration event + */ + public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { // event should not be null if (null == event) { // Throw NPE @@ -392,7 +411,11 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.clear(); } - @Override + /** + * Event observer when user confirmed account. + *

+ * @param event Event being fired + */ public void afterUserConfirmedAccount (@Observes final ObservableUserConfirmedAccountEvent event) { // event should not be null if (null == event) { @@ -413,7 +436,11 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.uniqueAddContact(event.getConfirmedUser().getUserContact()); } - @Override + /** + * Event observer for logged-in user + *

+ * @param event Event instance + */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { // event should not be null if (null == event) { diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java index 677db969..131028cc 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java @@ -25,13 +25,6 @@ import org.mxchange.jcontacts.contact.gender.Gender; import org.mxchange.jcontacts.exceptions.ContactNotFoundException; import org.mxchange.jcountry.data.Country; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; -import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; -import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent; -import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent; -import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent; /** * An interface for user beans @@ -53,20 +46,6 @@ public interface AddressbookContactWebSessionController extends Serializable { */ List allContacts (); - /** - * Event observer for newly added users by adminstrator - *

- * @param event Event being fired - */ - void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event); - - /** - * Event observer when user confirmed account. - *

- * @param event Event being fired - */ - void afterUserConfirmedAccount (final ObservableUserConfirmedAccountEvent event); - /** * Updates all data from bean in given contact instance *

@@ -86,43 +65,6 @@ public interface AddressbookContactWebSessionController extends Serializable { */ Contact lookupContactById (final Long contactId) throws ContactNotFoundException; - /** - * Event observer for new user registrations - *

- * @param event User registration event - */ - void afterRegistrationEvent (final ObservableUserRegisteredEvent event); - - /** - * Observes events being fired when an administrator has added a new - * contact. - *

- * @param event Event being fired - */ - void afterAdminAddedContact (final ObservableAdminAddedContactEvent event); - - /** - * Observes events being fired when an administrator has linked a new user - * with existing contact data. - *

- * @param event Event being fired - */ - void afterAdminLinkedUser (final ObservableAdminLinkedUserEvent event); - - /** - * Event observer for updated contact data by administrators - *

- * @param event Updated contact data event - */ - void afterAdminUpdatedContactDataEvent (final ObservableAdminUpdatedContactEvent event); - - /** - * Event observer for logged-in user - *

- * @param event Event instance - */ - void afterUserLoginEvent (final ObservableUserLoggedInEvent event); - /** * Creates an instance from all properties *

diff --git a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java index 5357e3d6..96219458 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java @@ -34,10 +34,10 @@ import org.mxchange.addressbook.beans.BaseAddressbookController; import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController; import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestController; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote; -import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent; import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent; +import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote; +import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; /** * A general contact bean (controller) @@ -96,8 +96,13 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro this.contacts = new HashMap<>(10); } - @Override - public void afterAdminAddedContact (@Observes final ObservableAdminAddedContactEvent event) { + /** + * 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 @@ -117,7 +122,11 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro this.clear(); } - @Override + /** + * Event observer for newly added users by adminstrator + *

+ * @param event Event being fired + */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { // event should not be null if (null == event) { @@ -138,7 +147,11 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro this.clear(); } - @Override + /** + * Event observer for updated contact data by administrators + *

+ * @param event Updated contact data event + */ public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) { // event should not be null if (null == event) { diff --git a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java index 160826d5..d6ced2f7 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java @@ -20,9 +20,6 @@ import java.io.Serializable; import java.util.List; import javax.ejb.Local; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; -import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent; -import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent; /** * An interface for user beans @@ -44,26 +41,4 @@ public interface AddressbookContactPhoneWebSessionController extends Serializabl */ List allMobileContacts (); - /** - * Event observer for newly added users by adminstrator - *

- * @param event Event being fired - */ - void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event); - - /** - * Observes events being fired when an administrator has added a new - * contact. - *

- * @param event Event being fired - */ - void afterAdminAddedContact (final ObservableAdminAddedContactEvent event); - - /** - * Event observer for updated contact data by administrators - *

- * @param event Updated contact data event - */ - void afterAdminUpdatedContactDataEvent (final ObservableAdminUpdatedContactEvent event); - } diff --git a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java index 69bfb3e8..5265fe0e 100644 --- a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java +++ b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java @@ -72,8 +72,13 @@ public class AddressbookCountryWebApplicationBean extends BaseAddressbookControl } } - @Override - public void afterAdminAddedCountry (@Observes final ObservableAdminAddedCountryEvent event) { + /** + * Observing method when the event is fired that an administrator added a + * new country + *

+ * @param event Event instance + */ + public void afterAdminAddedCountryEvent (@Observes final ObservableAdminAddedCountryEvent event) { // Is all valid? if (null == event) { // Throw NPE diff --git a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java index a6eaaf17..f1ad5ee1 100644 --- a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java +++ b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java @@ -19,7 +19,6 @@ package org.mxchange.addressbook.beans.country; import java.io.Serializable; import java.util.List; import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent; /** * An interface for country beans @@ -35,12 +34,4 @@ public interface AddressbookCountryWebApplicationController extends Serializable */ List allCountries (); - /** - * Observing method when the event is fired that an administrator added a - * new country - *

- * @param event Event instance - */ - void afterAdminAddedCountry (final ObservableAdminAddedCountryEvent event); - } diff --git a/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java index c3efdfc0..4b8dbb84 100644 --- a/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java @@ -49,7 +49,11 @@ public class AddressbookLocalizationSessionBean extends BaseAddressbookControlle */ private Locale locale; - @Override + /** + * Event observer for logged-in user + *

+ * @param event Event instance + */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { // event should not be null if (null == event) { @@ -73,7 +77,11 @@ public class AddressbookLocalizationSessionBean extends BaseAddressbookControlle } } - @Override + /** + * Event observer for logged-out user + *

+ * @param event Event instance + */ public void afterUserLogoutEvent (@Observes final ObservableUserLogoutEvent event) { // event should not be null if (null == event) { diff --git a/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionController.java b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionController.java index 35e3be91..1b68ca32 100644 --- a/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionController.java @@ -18,8 +18,6 @@ package org.mxchange.addressbook.beans.localization; import java.io.Serializable; import java.util.Locale; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; /** * An interface for localization change beans @@ -28,20 +26,6 @@ import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; */ public interface AddressbookLocalizationSessionController extends Serializable { - /** - * Event observer for logged-in user - *

- * @param event Event instance - */ - void afterUserLoginEvent (final ObservableUserLoggedInEvent event); - - /** - * Event observer for logged-out user - *

- * @param event Event instance - */ - void afterUserLogoutEvent (final ObservableUserLogoutEvent event); - /** * Getter for locale *

diff --git a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java index afcf854f..43ad2912 100644 --- a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java @@ -35,8 +35,11 @@ import org.mxchange.addressbook.beans.BaseAddressbookController; import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController; import org.mxchange.jusercore.container.login.LoginContainer; import org.mxchange.jusercore.container.login.UserLoginContainer; +import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; +import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; import org.mxchange.jusercore.events.logout.UserLogoutEvent; +import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; @@ -48,9 +51,6 @@ import org.mxchange.jusercore.model.user.password_history.PasswordHistory; import org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; import org.mxchange.jusercore.model.user.status.UserAccountStatus; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; /** * A web bean for user registration @@ -154,7 +154,12 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle } } - @Override + /** + * Method being call after user's password has been updated (and history + * entry has been created). + *

+ * @param event Event being observed + */ public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) { // Check parameter if (null == event) { diff --git a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java index 7e7c74c2..fdffbe9c 100644 --- a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java @@ -21,7 +21,6 @@ import java.util.List; import javax.ejb.Local; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.password_history.PasswordHistory; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; /** * An interface for registration web controllers @@ -31,14 +30,6 @@ import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserP @Local public interface AddressbookUserLoginWebSessionController extends Serializable { - /** - * Method being call after user's password has been updated (and history - * entry has been created). - *

- * @param event Event being observed - */ - void afterUserUpdatedPasswordEvent (final ObservableUpdatedUserPasswordEvent event); - /** * Checks whether given clear-text password is in user's password history. *

diff --git a/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestBean.java index 0d214d79..90f094f6 100644 --- a/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestBean.java @@ -72,8 +72,13 @@ public class AddressbookMobileProviderWebRequestBean extends BaseAddressbookCont } } - @Override - public void afterAdminAddedMobileProvider (@Observes final AdminAddedMobileProviderEvent event) { + /** + * Observes events being fired after the administrator has added a new + * mobile provider + *

+ * @param event Event being fired + */ + public void afterAdminAddedMobileProviderEvent (@Observes final AdminAddedMobileProviderEvent event) { // Is all valid? if (null == event) { // Throw NPE diff --git a/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestController.java b/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestController.java index 8fef39db..5db40ab2 100644 --- a/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestController.java @@ -18,7 +18,6 @@ package org.mxchange.addressbook.beans.mobileprovider; import java.io.Serializable; import java.util.List; -import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; /** @@ -35,12 +34,4 @@ public interface AddressbookMobileProviderWebRequestController extends Serializa */ List allMobileProviders (); - /** - * Observes events being fired after the administrator has added a new - * mobile provider - *

- * @param event Event being fired - */ - void afterAdminAddedMobileProvider (final AdminAddedMobileProviderEvent event); - } diff --git a/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java index eadd0df1..b0b38d78 100644 --- a/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java @@ -77,7 +77,7 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro private AddressbookFeaturesWebApplicationController featureController; /** - * Reemote register session bean + * Remote register session bean */ private UserRegistrationSessionBeanRemote registerBean; @@ -221,7 +221,7 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro } // Now only redirect to next page as the JSF does it - return "register_page2"; //NOI18N + return "user_register_page2"; //NOI18N } } diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java index 5b097d9e..1bd9b687 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java @@ -144,12 +144,12 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle private String userName; /** - * User password (unencrypted from web form) + * User password (clear-text from web form) */ private String userPassword; /** - * User password repeated (unencrypted from web form) + * User password repeated (clear-text from web form) */ private String userPasswordRepeat; @@ -297,8 +297,12 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle return "admin_list_user"; //NOI18N } - @Override - public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { + /** + * Event observer for new user registrations + *

+ * @param event User registration event + */ + public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { // event should not be null if (null == event) { // Throw NPE @@ -318,7 +322,6 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle User registeredUser = event.getRegisteredUser(); // @TODO Nothing to do with the user here? - // Clear all data this.clear(); } diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java index 3ed61f22..12a12d4c 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java @@ -18,7 +18,6 @@ package org.mxchange.addressbook.beans.user; import java.io.Serializable; import org.mxchange.jusercore.model.user.User; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; /** * An interface for user beans @@ -27,13 +26,6 @@ import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; */ public interface AddressbookAdminUserWebRequestController extends Serializable { - /** - * Event observer for new user registrations - *

- * @param event User registration event - */ - void afterRegistrationEvent (final ObservableUserRegisteredEvent event); - /** * Adds user instance to database by preparing a complete user instance and * sending it to the EJB. The data set in the controller is being verified, @@ -85,30 +77,30 @@ public interface AddressbookAdminUserWebRequestController extends Serializable { void setUserName (final String userName); /** - * Getter for unencrypted user password + * Getter for clear-text user password *

- * @return Unencrypted user password + * @return Clear-text user password */ String getUserPassword (); /** - * Setter for unencrypted user password + * Setter for clear-text user password *

- * @param userPassword Unencrypted user password + * @param userPassword Clear-text user password */ void setUserPassword (final String userPassword); /** - * Getter for unencrypted user password repeated + * Getter for clear-text user password repeated *

- * @return Unencrypted user password repeated + * @return Clear-text user password repeated */ String getUserPasswordRepeat (); /** - * Setter for unencrypted user password repeated + * Setter for clear-text user password repeated *

- * @param userPasswordRepeat Unencrypted user password repeated + * @param userPasswordRepeat Clear-text user password repeated */ void setUserPasswordRepeat (final String userPasswordRepeat); diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java index 574bb70c..07d12cf2 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java @@ -39,6 +39,13 @@ import org.mxchange.addressbook.beans.localization.AddressbookLocalizationSessio import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; +import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; +import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; +import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; +import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; +import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; +import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; +import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent; import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; import org.mxchange.jusercore.exceptions.UserNotFoundException; @@ -48,13 +55,6 @@ import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; import org.mxchange.jusercore.model.user.UserUtils; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; -import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; -import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; -import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; /** * A user bean (controller) @@ -132,12 +132,12 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp private List userNameList; /** - * User password (unencrypted from web form) + * User password (clear-text from web form) */ private String userPassword; /** - * User password repeated (unencrypted from web form) + * User password repeated (clear-text from web form) */ private String userPasswordRepeat; @@ -174,7 +174,11 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp } } - @Override + /** + * Event observer for newly added users by adminstrator + *

+ * @param event Event being fired + */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterAdminAddedUserEvent: event={0} - CALLED!", event)); //NOI18N @@ -207,7 +211,11 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp //* NOISY-DEBUG: */ System.out.println("UserWebBean:afterAdminAddedUserEvent: EXIT!"); //NOI18N } - @Override + /** + * Event observer for updated user data by administrator + *

+ * @param event Event being updated + */ public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) { // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterAdminUpdatedUserEvent: event={0} - CALLED!", event)); //NOI18N @@ -237,11 +245,12 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp //* NOISY-DEBUG: */ System.out.println("UserWebBean:afterAdminUpdatedUserEvent: EXIT!"); //NOI18N } - @Override - public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { - // Trace message - //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N - + /** + * Event observer for new user registrations + *

+ * @param event User registration event + */ + public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { // event should not be null if (null == event) { // Throw NPE @@ -288,11 +297,12 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp //* NOISY-DEBUG: */ System.out.println("UserWebBean:afterRegistration: EXIT!"); //NOI18N } - @Override - public void afterUserConfirmedAccount (@Observes final ObservableUserConfirmedAccountEvent event) { - // Trace message - //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N - + /** + * Event observer when user confirmed account. + *

+ * @param event Event being fired + */ + public void afterUserConfirmedAccountEvent (@Observes final ObservableUserConfirmedAccountEvent event) { // event should not be null if (null == event) { // Throw NPE @@ -312,7 +322,11 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp this.uniqueAddUser(event.getConfirmedUser()); } - @Override + /** + * Event observer for logged-in user + *

+ * @param event Event instance + */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N @@ -345,7 +359,12 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp } } - @Override + /** + * Method being call after user's password has been updated (and history + * entry has been created). + *

+ * @param event Event being observed + */ public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) { // Check parameter if (null == event) { @@ -366,8 +385,12 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp this.updateList(event.getPasswordHistory().getUserPasswordHistoryUser()); } - @Override - public void afterUserUpdatedPersonalData (@Observes final ObservableUpdatedUserPersonalDataEvent event) { + /** + * Listens to fired event when user updated personal data + *

+ * @param event Event being fired + */ + public void afterUserUpdatedPersonalDataEvent (@Observes final ObservableUpdatedUserPersonalDataEvent event) { // Check parameter if (null == event) { // Throw NPE @@ -413,7 +436,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp User user = new LoginUser(); // Is user name required? - if (!this.isUserNameRequired()) { + if ((!this.featureController.isFeatureEnabled("user_name_required")) && (this.getUserName() == null)) { //NOI18N // Generate pseudo-random user name String randomName = this.userBean.generateRandomUserName(); @@ -492,7 +515,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp } else if (!this.userLoginController.ifCurrentPasswordMatches()) { // Password not matching throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser())); - } else if (!this.featureController.isFeatureEnabled("edit_user_data")) { + } else if (!this.featureController.isFeatureEnabled("edit_user_data")) { //NOI18N // Editing is not allowed throw new IllegalStateException("User tried to edit personal data."); //NOI18N } @@ -504,12 +527,12 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp this.contactController.updateContactDataFromController(user.getUserContact()); // It should be there, so run some tests on it - assert (user instanceof User) : "Instance userLoginController.loggedInUser is null"; - assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null"; - assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId()); - assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; - assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; - assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); + assert (user instanceof User) : "Instance userLoginController.loggedInUser is null"; //NOI18N + assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null"; //NOI18N + assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N + assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N + assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; //NOI18N + assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N // Update all fields user.setUserProfileMode(this.getUserProfileMode()); @@ -641,7 +664,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N // This requires user names being enabled, too. - if ((isEnabled) && (!this.isUserNameRequired())) { + if ((isEnabled) && (!this.featureController.isFeatureEnabled("user_name_required"))) { //NOI18N // Not valid state, users must be able to modify their profile, especially when it is public throw new IllegalStateException("Public user profiles are enabled but user name requirement is disabled, this is not possible."); //NOI18N } @@ -664,7 +687,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp return this.contactController.isRequiredPersonalDataSet(); } else { // Single registration page - return (((this.getUserName() != null) || (!this.isUserNameRequired())) && + return (((this.getUserName() != null) || (!this.featureController.isFeatureEnabled("user_name_required"))) && //NOI18N (this.getUserProfileMode() != null) && (this.contactController.isRequiredPersonalDataSet()) && (this.getUserPassword() != null) && @@ -687,18 +710,6 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp return ((this.userNameList instanceof List) && (this.userNameList.contains(user.getUserName()))); } - @Override - public boolean isUserNameRequired () { - // Get context parameter - String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_user_name_required"); //NOI18N - - // Is it set? - boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N - - // Return value - return isRequired; - } - @Override public boolean isVisibleUserFound () { return ((this.visibleUserList instanceof List) && (!this.visibleUserList.isEmpty())); diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java index 76bfc7a6..3ba71627 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java @@ -23,13 +23,6 @@ import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; -import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; -import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; -import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; /** * An interface for user beans @@ -43,56 +36,6 @@ public interface AddressbookUserWebSessionController extends Serializable { */ public static final Integer MINIMUM_PASSWORD_LENGTH = 5; - /** - * Event observer for newly added users by adminstrator - *

- * @param event Event being fired - */ - void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event); - - /** - * Event observer for updated user data by administrator - *

- * @param event Event being updated - */ - void afterAdminUpdatedUserDataEvent (final ObservableAdminUpdatedUserDataEvent event); - - /** - * Event observer when user confirmed account. - *

- * @param event Event being fired - */ - void afterUserConfirmedAccount (final ObservableUserConfirmedAccountEvent event); - - /** - * Method being call after user's password has been updated (and history - * entry has been created). - *

- * @param event Event being observed - */ - void afterUserUpdatedPasswordEvent (final ObservableUpdatedUserPasswordEvent event); - - /** - * Listens to fired event when user updated personal data - *

- * @param event Event being fired - */ - void afterUserUpdatedPersonalData (final ObservableUpdatedUserPersonalDataEvent event); - - /** - * Event observer for new user registrations - *

- * @param event User registration event - */ - void afterRegistrationEvent (final ObservableUserRegisteredEvent event); - - /** - * Event observer for logged-in user - *

- * @param event Event instance - */ - void afterUserLoginEvent (final ObservableUserLoggedInEvent event); - /** * All users *

@@ -202,30 +145,30 @@ public interface AddressbookUserWebSessionController extends Serializable { void setUserName (final String userName); /** - * Getter for unencrypted user password + * Getter for clear-text user password *

- * @return Unencrypted user password + * @return Clear-text user password */ String getUserPassword (); /** - * Setter for unencrypted user password + * Setter for clear-text user password *

- * @param userPassword Unencrypted user password + * @param userPassword Clear-text user password */ void setUserPassword (final String userPassword); /** - * Getter for unencrypted user password repeated + * Getter for clear-text user password repeated *

- * @return Unencrypted user password repeated + * @return Clear-text user password repeated */ String getUserPasswordRepeat (); /** - * Setter for unencrypted user password repeated + * Setter for clear-text user password repeated *

- * @param userPasswordRepeat Unencrypted user password repeated + * @param userPasswordRepeat Clear-text user password repeated */ void setUserPasswordRepeat (final String userPasswordRepeat); @@ -279,14 +222,6 @@ public interface AddressbookUserWebSessionController extends Serializable { */ String doChangePersonalData (); - /** - * Checks whether this application requires a user name to be entered. - * Otherwise a random name like "userXXXXX" is generated - *

- * @return Whether this application requires a user name - */ - boolean isUserNameRequired (); - /** * Checks wether public user profiles are enabled. This requires that user * names are also enabled. diff --git a/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java index 4463dbba..04f61277 100644 --- a/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java @@ -78,12 +78,12 @@ public class AddressbookUserPasswordWebRequestBean extends BaseAddressbookContro private AddressbookUserLoginWebSessionController userLoginController; /** - * User password (unencrypted from web form) + * User password (clear-text from web form) */ private String userPassword; /** - * User password repeated (unencrypted from web form) + * User password repeated (clear-text from web form) */ private String userPasswordRepeat; diff --git a/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestController.java b/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestController.java index b53e7d99..01fc52a5 100644 --- a/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestController.java @@ -28,44 +28,44 @@ import javax.ejb.Local; public interface AddressbookUserPasswordWebRequestController extends Serializable { /** - * Getter for unencrypted user password + * Getter for clear-text user password *

- * @return Unencrypted user password + * @return Clear-text user password */ String getUserPassword (); /** - * Setter for unencrypted user password + * Setter for clear-text user password *

- * @param userPassword Unencrypted user password + * @param userPassword Clear-text user password */ void setUserPassword (final String userPassword); /** - * Getter for current unencrypted user password + * Getter for current clear-text user password *

- * @return Current unencrypted user password + * @return Current clear-text user password */ String getUserCurrentPassword (); /** - * Setter for current unencrypted user password + * Setter for current clear-text user password *

- * @param userCurrentPassword Current unencrypted user password + * @param userCurrentPassword Current clear-text user password */ void setUserCurrentPassword (final String userCurrentPassword); /** - * Getter for unencrypted user password repeated + * Getter for clear-text user password repeated *

- * @return Unencrypted user password repeated + * @return Clear-text user password repeated */ String getUserPasswordRepeat (); /** - * Setter for unencrypted user password repeated + * Setter for clear-text user password repeated *

- * @param userPasswordRepeat Unencrypted user password repeated + * @param userPasswordRepeat Clear-text user password repeated */ void setUserPasswordRepeat (final String userPasswordRepeat); diff --git a/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java b/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java index 10e4d509..f9576c05 100644 --- a/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java +++ b/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java @@ -62,9 +62,6 @@ public class AddressbookCellphoneConverter implements Converter { @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N - // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -75,20 +72,14 @@ public class AddressbookCellphoneConverter implements Converter { } // Init instance - DialableMobileNumber cellphone = null; + DialableMobileNumber mobile = null; try { // Try to parse the value as long - Long cellphoneId = Long.valueOf(submittedValue); - - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId)); //NOI18N + Long mobileId = Long.valueOf(submittedValue); - // Try to get cellphone instance from it - cellphone = this.phoneBean.findMobileNumberById(cellphoneId); - - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: cellphone={0}", cellphone)); //NOI18N + // Try to get mobile instance from it + mobile = this.phoneBean.findMobileNumberById(mobileId); } catch (final NumberFormatException ex) { // Throw again throw new ConverterException(ex); @@ -97,11 +88,8 @@ public class AddressbookCellphoneConverter implements Converter { // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N } - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: cellphone={0} - EXIT!", cellphone)); //NOI18N - // Return it - return cellphone; + return mobile; } @Override diff --git a/src/java/org/mxchange/addressbook/converter/contact/AddressbookContactConverter.java b/src/java/org/mxchange/addressbook/converter/contact/AddressbookContactConverter.java index 06b4d10d..ccf23f59 100644 --- a/src/java/org/mxchange/addressbook/converter/contact/AddressbookContactConverter.java +++ b/src/java/org/mxchange/addressbook/converter/contact/AddressbookContactConverter.java @@ -61,9 +61,6 @@ public class AddressbookContactConverter implements Converter { @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N - // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -80,14 +77,8 @@ public class AddressbookContactConverter implements Converter { // Try to parse the value as long Long contactId = Long.valueOf(submittedValue); - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contactId{0}", contactId)); //NOI18N - // Try to get user instance from it contact = this.contactBean.findContactById(contactId); - - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contact={0}", contact)); //NOI18N } catch (final NumberFormatException ex) { // Throw again throw new ConverterException(ex); @@ -96,9 +87,6 @@ public class AddressbookContactConverter implements Converter { // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N } - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: contact={0} - EXIT!", contact)); //NOI18N - // Return it return contact; } diff --git a/src/java/org/mxchange/addressbook/converter/country/AddressbookCountryConverter.java b/src/java/org/mxchange/addressbook/converter/country/AddressbookCountryConverter.java index c96fd7da..89b9f4e8 100644 --- a/src/java/org/mxchange/addressbook/converter/country/AddressbookCountryConverter.java +++ b/src/java/org/mxchange/addressbook/converter/country/AddressbookCountryConverter.java @@ -62,9 +62,6 @@ public class AddressbookCountryConverter implements Converter { @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2},this.countryBean={3} - CALLED!", context, component, submittedValue, this.countryBean)); //NOI18N - // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -88,9 +85,6 @@ public class AddressbookCountryConverter implements Converter { // Category id should not be below 1 assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: countryId={0}", countryId)); //NOI18N - // Try to find it for (final Country cntry : countryList) { // Is the id the same? (null-safe) @@ -105,9 +99,6 @@ public class AddressbookCountryConverter implements Converter { throw new ConverterException(ex); } - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: country={0} - EXIT!", country)); //NOI18N - // Return it return country; } diff --git a/src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java b/src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java index 1695e7a3..2f27fef2 100644 --- a/src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java +++ b/src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java @@ -62,9 +62,6 @@ public class AddressbookMobileProviderConverter implements Converter { @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N - // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -88,9 +85,6 @@ public class AddressbookMobileProviderConverter implements Converter { // Category id should not be below 1 assert (providerId > 0) : "providerId is smaller than one: " + providerId; //NOI18N - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: providerId={0}", providerId)); //NOI18N - // Try to find it for (final MobileProvider prov : providerList) { // Is the id the same? (null-safe) @@ -105,9 +99,6 @@ public class AddressbookMobileProviderConverter implements Converter { // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logException(ex); } - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: provider={0} - EXIT!", provider)); //NOI18N - // Return it return provider; } diff --git a/src/java/org/mxchange/addressbook/converter/user/AddressbookUserConverter.java b/src/java/org/mxchange/addressbook/converter/user/AddressbookUserConverter.java index 732f8ff7..33f0b350 100644 --- a/src/java/org/mxchange/addressbook/converter/user/AddressbookUserConverter.java +++ b/src/java/org/mxchange/addressbook/converter/user/AddressbookUserConverter.java @@ -61,9 +61,6 @@ public class AddressbookUserConverter implements Converter { @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N - // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -80,14 +77,8 @@ public class AddressbookUserConverter implements Converter { // Try to parse the value as long Long userId = Long.valueOf(submittedValue); - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId)); //NOI18N - // Try to get user instance from it user = this.userBean.findUserById(userId); - - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: user={0}", user)); //NOI18N } catch (final NumberFormatException ex) { // Throw again throw new ConverterException(ex); @@ -96,9 +87,6 @@ public class AddressbookUserConverter implements Converter { // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex)); //NOI18N } - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: user={0} - EXIT!", user)); //NOI18N - // Return it return user; } diff --git a/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java b/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java index 896bef50..a2a0d5a0 100644 --- a/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java +++ b/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java @@ -58,9 +58,6 @@ public class AddressbookBirthdayValidator extends BaseDateValidator implements V @Override public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N - // All accepted, required fields String[] requiredFields = {"birthday", "contactBirthday"}; //NOI18N @@ -71,8 +68,6 @@ public class AddressbookBirthdayValidator extends BaseDateValidator implements V Date birthday = (Date) value; // @TODO Finish this, e.g. load maximum,minimum birthday from properties file - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N } } diff --git a/src/java/org/mxchange/addressbook/validator/user/AddressbookUserIdValidator.java b/src/java/org/mxchange/addressbook/validator/user/AddressbookUserIdValidator.java index 2bad9606..e35ad92b 100644 --- a/src/java/org/mxchange/addressbook/validator/user/AddressbookUserIdValidator.java +++ b/src/java/org/mxchange/addressbook/validator/user/AddressbookUserIdValidator.java @@ -80,10 +80,7 @@ public class AddressbookUserIdValidator extends BaseLongValidator implements Val *

* @param event User registration event */ - public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterRegistrationEvent: event={0} - CALLED!", event)); //NOI18N - + public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { // event should not be null if (null == event) { // Throw NPE @@ -102,21 +99,12 @@ public class AddressbookUserIdValidator extends BaseLongValidator implements Val // Get user instance User registeredUser = event.getRegisteredUser(); - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N - // Update cache AddressbookUserIdValidator.cachedStatus.add(registeredUser.getUserId()); - - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace("UserIdValidator:afterRegistrationEvent: EXIT!"); //NOI18N } @Override public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N - // All accepted, required fields String[] requiredFields = {"userId"}; //NOI18N @@ -146,9 +134,6 @@ public class AddressbookUserIdValidator extends BaseLongValidator implements Val // Add to cache if valid AddressbookUserIdValidator.cachedStatus.add(userId); - - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N } } -- 2.39.5