From b31f89c41525529a7e269414d4b177864aca70c2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 10 Jun 2016 12:03:45 +0200 Subject: [PATCH] New "feature" controller introduced: (please cherry-pick this) - no more tons of separate and same-looking methods, just one central and very flexible method isFeatureEnabled() - renamed all context parameters - added features "imprint", "terms" and "privacy" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- ...AddressbookAdminContactWebRequestBean.java | 11 +++ .../AddressbookContactWebSessionBean.java | 23 ++++++ ...ddressbookContactWebSessionController.java | 24 ++++++ .../AddressbookEmailChangeWebSessionBean.java | 10 +++ ...AddressbookFeatureWebApplicationBean.java} | 6 +- ...sbookFeaturesWebApplicationController.java | 39 +++++++++ .../AddressbookUserLoginWebSessionBean.java | 5 -- ...ressbookUserLoginWebSessionController.java | 7 -- ...AddressbookUserRegisterWebSessionBean.java | 48 +++++------ ...sbookUserRegisterWebSessionController.java | 14 ---- .../user/AddressbookUserWebSessionBean.java | 80 +++++++++---------- .../generic/gender_selection_box.tpl | 2 +- web/WEB-INF/templates/guest/guest_base.tpl | 4 +- web/WEB-INF/templates/guest/guest_footer.tpl | 32 +++++--- web/WEB-INF/templates/guest/guest_menu.tpl | 14 ++-- .../register/guest_form_register_page1.tpl | 4 +- .../register/guest_form_register_single.tpl | 4 +- .../templates/login/user/user_menu.tpl | 24 ++++-- web/WEB-INF/web.xml | 68 +++++++++++++--- web/admin/user/admin_user_export.xhtml | 2 +- web/admin/user/admin_user_show.xhtml | 2 +- web/guest/user/login.xhtml | 23 +++--- web/guest/user/lost_passwd.xhtml | 4 +- web/guest/user/register.xhtml | 34 ++++---- web/guest/user/register_page2.xhtml | 6 +- web/guest/user/resend_link.xhtml | 6 +- web/guest/user/user_list.xhtml | 73 +++++++++-------- web/imprint.xhtml | 4 +- web/privacy.xhtml | 4 +- web/terms.xhtml | 4 +- web/user/login_change_email_address.xhtml | 66 ++++++++------- web/user/login_change_password.xhtml | 28 ++++--- web/user/login_change_personal_data.xhtml | 42 +++++----- web/user/login_contact_data_saved.xhtml | 20 +++-- 34 files changed, 455 insertions(+), 282 deletions(-) rename src/java/org/mxchange/{pizzaapplication/beans/features/PizzaFeatureWebApplicationBean.java => addressbook/beans/features/AddressbookFeatureWebApplicationBean.java} (89%) create mode 100644 src/java/org/mxchange/addressbook/beans/features/AddressbookFeaturesWebApplicationController.java diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java index e360eeea..61b8ac50 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java @@ -541,6 +541,17 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro this.contactId = contactId; } + @Override + public String getControllerType () { + return "admin"; //NOI18N + } + + @Override + @Deprecated + public void setControllerType (final String controllerType) { + throw new UnsupportedOperationException("Setting controller type is not supported."); //NOI18N + } + @Override public Country getCountry () { return this.country; diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java index 49b39b5f..bcf3acc1 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java @@ -243,6 +243,9 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController @Override public void afterAdminAddedContact (@Observes final AdminAddedContactEvent event) { + // Trace message + //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedContact(): event={0} - CALLED!", event)); //NOI18N + // The event must be valid if (null == event) { // Throw NPE @@ -267,6 +270,9 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController @Override public void afterAdminAddedUserEvent (@Observes final AdminAddedUserEvent event) { + // Trace message + //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("contactController.afterAdminAddedUserEvent(): event={0} - CALLED!", event)); //NOI18N + // event should not be null if (null == event) { // Throw NPE @@ -354,6 +360,9 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController // Add email address to list this.emailAddressList.add(event.getUpdatedContact().getContactEmailAddress()); + + // Trace message + //* NOISY-DEBUG: */ System.out.println("contactController.afterAdminUpdatedContactDataEvent(): EXIT!"); //NOI18N } @Override @@ -424,6 +433,9 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController // Add contact to list this.contactList.add(contact); + + // Trace message + //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterAdminUpdatedContactDataEvent: EXIT!"); //NOI18N } @Override @@ -656,6 +668,17 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.comment = comment; } + @Override + public String getControllerType () { + return "general"; //NOI18N + } + + @Override + @Deprecated + public void setControllerType (final String controllerType) { + throw new UnsupportedOperationException("Setting controller type is not supported."); //NOI18N + } + @Override public Country getCountry () { return this.country; diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java index 7ba90cbc..faa7d0f0 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java @@ -430,6 +430,22 @@ public interface AddressbookContactWebSessionController extends Serializable { */ void setZipCode (final Integer zipCode); + /** + * Getter for controller type + *

+ * @return controller type + */ + String getControllerType (); + + /** + * Setter for controller type + *

+ * @param controllerType Controller type + * @deprecated Don't use this method. + */ + @Deprecated + void setControllerType (final String controllerType); + /** * Checks whether contact instance's email address is used *

@@ -468,4 +484,12 @@ public interface AddressbookContactWebSessionController extends Serializable { */ String doChangePersonalContactData (); + /** + * Returns a list of all selectable contacts for user creation. Contacts + * from already existing users are excluded in this list. + *

+ * @return A list of all selectable contacts + */ + List selectableContacts (); + } diff --git a/src/java/org/mxchange/addressbook/beans/email_address/AddressbookEmailChangeWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/email_address/AddressbookEmailChangeWebSessionBean.java index 456052cf..15589bd0 100644 --- a/src/java/org/mxchange/addressbook/beans/email_address/AddressbookEmailChangeWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/email_address/AddressbookEmailChangeWebSessionBean.java @@ -27,6 +27,7 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.addressbook.beans.BaseAddressbookController; +import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController; import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcoreee.utils.FacesUtils; @@ -70,6 +71,12 @@ public class AddressbookEmailChangeWebSessionBean extends BaseAddressbookControl */ private final EmailChangeSessionBeanRemote emailBean; + /** + * Features controller + */ + @Inject + private AddressbookFeaturesWebApplicationController featureController; + /** * Login bean (controller) */ @@ -112,6 +119,9 @@ public class AddressbookEmailChangeWebSessionBean extends BaseAddressbookControl // Password not matching this.showFacesMessage("login_change_email_address_form:currentPassword", new UserPasswordMismatchException(this.loginController.getLoggedInUser())); //NOI18N return ""; //NOI18N + } else if (!this.featureController.isFeatureEnabled("edit_user_data")) { //NOI18N + // Editing is not allowed + throw new IllegalStateException("User tried to edit personal data"); //NOI18N } // Get user instance diff --git a/src/java/org/mxchange/pizzaapplication/beans/features/PizzaFeatureWebApplicationBean.java b/src/java/org/mxchange/addressbook/beans/features/AddressbookFeatureWebApplicationBean.java similarity index 89% rename from src/java/org/mxchange/pizzaapplication/beans/features/PizzaFeatureWebApplicationBean.java rename to src/java/org/mxchange/addressbook/beans/features/AddressbookFeatureWebApplicationBean.java index e590cdaa..602ff4c2 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/features/PizzaFeatureWebApplicationBean.java +++ b/src/java/org/mxchange/addressbook/beans/features/AddressbookFeatureWebApplicationBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Cho-Time GmbH + * Copyright (C) 2016 Roland Haeder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaapplication.beans.features; +package org.mxchange.addressbook.beans.features; import javax.enterprise.context.ApplicationScoped; import javax.faces.context.FacesContext; @@ -28,7 +28,7 @@ import org.mxchange.pizzaapplication.beans.BasePizzaController; */ @Named ("featureController") @ApplicationScoped -public class PizzaFeatureWebApplicationBean extends BasePizzaController implements PizzaFeaturesWebApplicationController { +public class AddressbookFeatureWebApplicationBean extends BasePizzaController implements AddressbookFeaturesWebApplicationController { /** * Serial number diff --git a/src/java/org/mxchange/addressbook/beans/features/AddressbookFeaturesWebApplicationController.java b/src/java/org/mxchange/addressbook/beans/features/AddressbookFeaturesWebApplicationController.java new file mode 100644 index 00000000..d8eac965 --- /dev/null +++ b/src/java/org/mxchange/addressbook/beans/features/AddressbookFeaturesWebApplicationController.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * 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.addressbook.beans.features; + +import java.io.Serializable; +import javax.ejb.Local; + +/** + * An interface for country beans + *

+ * @author Roland Haeder + */ +@Local +public interface AddressbookFeaturesWebApplicationController extends Serializable { + + /** + * Checks if given feature is enabled. + *

+ * @param feature Feature to be checked + *

+ * @return Whether given feature is enabled + */ + boolean isFeatureEnabled (final String feature); + +} diff --git a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java index ef7f22a2..7cc02845 100644 --- a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java @@ -238,11 +238,6 @@ public class AddressbookUserLoginWebSessionBean extends BaseAddressbookControlle return UserUtils.ifPasswordMatches(container, this.getLoggedInUser()); } - @Override - public boolean isGuest () { - return (!this.isUserLoggedIn()); - } - @Override public boolean isInvisible () { // Check on login diff --git a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java index f5ee4f8b..25159a2c 100644 --- a/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionController.java @@ -90,13 +90,6 @@ public interface AddressbookUserLoginWebSessionController extends Serializable { */ boolean isUserLoggedIn (); - /** - * Is this truly a guest? - *

- * @return Whether the user is truly a guest - */ - boolean isGuest (); - /** * Whether the currently logged-in user is invisible *

diff --git a/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java index 450f50c8..a3dbfe74 100644 --- a/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionBean.java @@ -20,7 +20,6 @@ import java.text.MessageFormat; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.enterprise.inject.Any; -import javax.faces.context.FacesContext; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; @@ -29,6 +28,7 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.addressbook.beans.BaseAddressbookController; import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController; +import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController; import org.mxchange.addressbook.beans.user.AddressbookAdminUserWebRequestController; import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController; import org.mxchange.jcontacts.contact.Contact; @@ -70,6 +70,12 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro @Inject private AddressbookContactWebSessionController contactController; + /** + * Features controller + */ + @Inject + private AddressbookFeaturesWebApplicationController featureController; + /** * Reemote register session bean */ @@ -106,6 +112,12 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro @Override public String doFinishRegistration () { + // Is registration enabled? + if (!this.featureController.isFeatureEnabled("user_registration")) { //NOI18N + // Is not enabled + throw new FaceletException("Registration is disabled."); //NOI18N + } + // Get user instance User user = this.userController.createUserInstance(true); @@ -116,7 +128,7 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro } else if (!this.userController.isRequiredPersonalDataSet()) { // Not all required fields are set throw new FaceletException("Not all required fields are set."); //NOI18N - } else if ((this.userController.isUserNameRequired()) && (this.userController.isUserNameRegistered(user))) { + } else if ((this.featureController.isFeatureEnabled("user_name_required")) && (this.userController.isUserNameRegistered(user))) { //NOI18N // User name is already used throw new FaceletException(new UserNameAlreadyRegisteredException(user)); } else if (this.contactController.isEmailAddressRegistered(user.getUserContact())) { @@ -174,6 +186,12 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro @Override public String doRegisterMultiPage1 () { + // Is registration enabled? + if (!this.featureController.isFeatureEnabled("user_registration")) { //NOI18N + // Is not enabled + throw new FaceletException("Registration is disabled."); //NOI18N + } + // Get user instance User user = this.userController.createUserInstance(false); @@ -181,7 +199,7 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro if (null == user) { // user must be set throw new NullPointerException("user is null after createUserInstance() was called"); //NOI18N - } else if ((this.userController.isUserNameRequired()) && (this.userController.isUserNameRegistered(user))) { + } else if ((this.featureController.isFeatureEnabled("user_name_required")) && (this.userController.isUserNameRegistered(user))) { //NOI18N // User name is already used throw new FaceletException(new UserNameAlreadyRegisteredException(user)); } else if (!this.contactController.isSameEmailAddressEntered()) { @@ -206,28 +224,4 @@ public class AddressbookUserRegisterWebSessionBean extends BaseAddressbookContro return "register_page2"; //NOI18N } - @Override - public boolean isMultiplePageEnabled () { - // Get context parameter - String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_multi_register_page"); //NOI18N - - // Is it set? - boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N - - // Return value - return isEnabled; - } - - @Override - public boolean isResendConfirmationLinkEnabled () { - // Get context parameter - String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_resend_confirm_link_enabled"); //NOI18N - - // Is it set? - boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N - - // Return value - return isEnabled; - } - } diff --git a/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionController.java b/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionController.java index d076d5ae..14947d43 100644 --- a/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/register/AddressbookUserRegisterWebSessionController.java @@ -42,18 +42,4 @@ public interface AddressbookUserRegisterWebSessionController extends Serializabl */ String doRegisterMultiPage1 (); - /** - * Checks wether multi-page or single-page registration is active - *

- * @return Whether multi (true) or single page (false) is active - */ - boolean isMultiplePageEnabled (); - - /** - * Checks whether the "resend confirmation link" feature is enabled - *

- * @return Whether "resend confirmation link" is enabled - */ - boolean isResendConfirmationLinkEnabled (); - } diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java index ffb8f66a..8e60563a 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java @@ -35,9 +35,9 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.addressbook.beans.BaseAddressbookController; import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController; +import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController; import org.mxchange.addressbook.beans.localization.AddressbookLocalizationSessionController; import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController; -import org.mxchange.addressbook.beans.register.AddressbookUserRegisterWebSessionController; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; @@ -82,27 +82,16 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp private AddressbookContactWebSessionController contactController; /** - * Localization controller - */ - @Inject - private AddressbookLocalizationSessionController localizationController; - - /** - * Login bean (controller) + * Features controller */ @Inject - private AddressbookUserLoginWebSessionController loginController; + private AddressbookFeaturesWebApplicationController featureController; /** - * Registration controller + * Localization controller */ @Inject - private AddressbookUserRegisterWebSessionController registerController; - - /** - * A list of all selectable contacts - */ - private List selectableContacts; + private AddressbookLocalizationSessionController localizationController; /** * Event being fired when user updated personal data @@ -432,7 +421,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp user.setUserProfileMode(this.getUserProfileMode()); // Is multiple registration page - if (!this.registerController.isMultiplePageEnabled()) { + if ((createContactData) || (!this.featureController.isFeatureEnabled("user_register_multiple_page"))) { //NOI18N // Create contact instance Contact contact = this.contactController.createContactInstance(); @@ -488,7 +477,10 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp throw new FaceletException("Not all required fields are set."); //NOI18N } else if (!this.userLoginController.ifCurrentPasswordMatches()) { // Password not matching - throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser())); + throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser())); + } else if (!this.featureController.isFeatureEnabled("edit_user_data")) { + // Editing is not allowed + throw new IllegalStateException("User tried to edit personal data"); //NOI18N } // Get user instance @@ -658,7 +650,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp @Override public boolean isRequiredPersonalDataSet () { - if (this.registerController.isMultiplePageEnabled()) { + if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N // Multiple registration page return this.contactController.isRequiredPersonalDataSet(); } else { @@ -704,14 +696,14 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp } @Override - public User lookupUserById (final Long userId) throws UserNotFoundException { + public User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException { // Parameter must be valid - if (null == userId) { + if (null == emailAddress) { // Throw NPE - throw new NullPointerException("userId is null"); //NOI18N - } else if (userId < 1) { + throw new NullPointerException("emailAddress is null"); //NOI18N + } else if (emailAddress.isEmpty()) { // Not valid - throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N + throw new IllegalArgumentException("emailAddress is empty"); //NOI18N } // Init variable @@ -722,8 +714,17 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp // Get next user User next = iterator.next(); - // Is the user id found? - if (Objects.equals(next.getUserId(), userId)) { + // Contact should be set + if (next.getUserContact() == null) { + // Contact is null + throw new NullPointerException(MessageFormat.format("next.userContact is null for user id {0}", next.getUserId())); //NOI18N + } else if (next.getUserContact().getContactEmailAddress() == null) { + // Email address should be set + throw new NullPointerException(MessageFormat.format("next.userContact.contactEmailAddress is null for user id {0}", next.getUserId())); //NOI18N //NOI18N + } + + // Is the email address found? + if (Objects.equals(next.getUserContact().getContactEmailAddress(), emailAddress)) { // Copy to other variable user = next; break; @@ -733,7 +734,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp // Is it still null? if (null == user) { // Not visible for the current user - throw new UserNotFoundException(userId); + throw new UserEmailAddressNotFoundException(emailAddress); } // Return it @@ -741,14 +742,14 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp } @Override - public User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException { + public User lookupUserById (final Long userId) throws UserNotFoundException { // Parameter must be valid - if (null == emailAddress) { + if (null == userId) { // Throw NPE - throw new NullPointerException("emailAddress is null"); //NOI18N - } else if (emailAddress.isEmpty()) { + throw new NullPointerException("userId is null"); //NOI18N + } else if (userId < 1) { // Not valid - throw new IllegalArgumentException("emailAddress is empty"); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N } // Init variable @@ -759,17 +760,8 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp // Get next user User next = iterator.next(); - // Contact should be set - if (next.getUserContact() == null) { - // Contact is null - throw new NullPointerException(MessageFormat.format("next.userContact is null for user id {0}", next.getUserId())); //NOI18N - } else if (next.getUserContact().getContactEmailAddress() == null) { - // Email address should be set - throw new NullPointerException(MessageFormat.format("next.userContact.contactEmailAddress is null for user id {0}", next.getUserId())); //NOI18N //NOI18N - } - - // Is the email address found? - if (Objects.equals(next.getUserContact().getContactEmailAddress(), emailAddress)) { + // Is the user id found? + if (Objects.equals(next.getUserId(), userId)) { // Copy to other variable user = next; break; @@ -779,7 +771,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp // Is it still null? if (null == user) { // Not visible for the current user - throw new UserEmailAddressNotFoundException(emailAddress); + throw new UserNotFoundException(userId); } // Return it diff --git a/web/WEB-INF/templates/generic/gender_selection_box.tpl b/web/WEB-INF/templates/generic/gender_selection_box.tpl index 6134e37c..dfa9efcb 100644 --- a/web/WEB-INF/templates/generic/gender_selection_box.tpl +++ b/web/WEB-INF/templates/generic/gender_selection_box.tpl @@ -6,7 +6,7 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - + diff --git a/web/WEB-INF/templates/guest/guest_base.tpl b/web/WEB-INF/templates/guest/guest_base.tpl index 5b50c7c3..16c4f0b5 100644 --- a/web/WEB-INF/templates/guest/guest_base.tpl +++ b/web/WEB-INF/templates/guest/guest_base.tpl @@ -9,7 +9,9 @@ - + + + diff --git a/web/WEB-INF/templates/guest/guest_footer.tpl b/web/WEB-INF/templates/guest/guest_footer.tpl index 30b4b95f..5fffa6f7 100644 --- a/web/WEB-INF/templates/guest/guest_footer.tpl +++ b/web/WEB-INF/templates/guest/guest_footer.tpl @@ -10,21 +10,29 @@ -

+ + + - + + + - + + + - + + + diff --git a/web/WEB-INF/templates/guest/guest_menu.tpl b/web/WEB-INF/templates/guest/guest_menu.tpl index 716799b6..1b5b5069 100644 --- a/web/WEB-INF/templates/guest/guest_menu.tpl +++ b/web/WEB-INF/templates/guest/guest_menu.tpl @@ -26,23 +26,25 @@ - + + -
    -
  • - -
  • -
+
    +
  • + +
  • +
+