X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Fjava%2Forg%2Fmxchange%2Fpizzaapplication%2Fbeans%2Fuser%2FPizzaUserWebSessionController.java;h=aa87e4af41861f083242f3dd735b2c6b5960a859;hb=fea403ed5c05f960a2d17fd4c8f4ca639c46cbb2;hp=19fef777cf21eeb4f88d78552e12b38df2b5de42;hpb=14b2944fd8d813757ab7ecc150a1e80439cfddf8;p=pizzaservice-war.git diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java index 19fef777..aa87e4af 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Roland Haeder + * Copyright (C) 2016 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 @@ -19,9 +19,14 @@ package org.mxchange.pizzaapplication.beans.user; import java.io.Serializable; import java.util.List; import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; +import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent; +import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent; +import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent; +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; @@ -29,7 +34,7 @@ import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; /** * An interface for user beans *

- * @author Roland Haeder + * @author Roland Häder */ public interface PizzaUserWebSessionController extends Serializable { @@ -39,31 +44,40 @@ public interface PizzaUserWebSessionController extends Serializable { public static final Integer MINIMUM_PASSWORD_LENGTH = 5; /** - * Returns a list of all selectable contacts for user creation. Contacts - * from already existing users are excluded in this list. + * Event observer for newly added users by adminstrator *

- * @return A list of all selectable contacts + * @param event Event being fired */ - List selectableContacts (); + void afterAdminAddedUserEvent (final AdminAddedUserEvent event); /** - * Tries to lookup user by given id number. If the user is not found or the - * account status is not CONFIRMED proper exceptions are thrown. + * Event observer for updated user data by administrator *

- * @param userId User id + * @param event Event being updated + */ + void afterAdminUpdatedUserDataEvent (final AdminUpdatedUserDataEvent event); + + /** + * Event observer when user confirmed account. *

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

- * @throws UserNotFoundException If the user is not found + * @param event Event being observed */ - User lookupUserById (final Long userId) throws UserNotFoundException; + void afterUserUpdatedPasswordEvent (final UpdatedUserPasswordEvent event); /** - * Event observer for newly added users by an administrator + * Listens to fired event when user updated personal data *

* @param event Event being fired */ - void afterAdminAddedUserEvent(final AdminAddedUserEvent event); + void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event); /** * Event observer for new user registrations @@ -79,6 +93,13 @@ public interface PizzaUserWebSessionController extends Serializable { */ void afterUserLogin (final UserLoggedInEvent event); + /** + * All users + *

+ * @return A list of all public user profiles + */ + List allUsers (); + /** * All public user profiles *

@@ -86,12 +107,71 @@ public interface PizzaUserWebSessionController extends Serializable { */ List allVisibleUsers (); + /** + * Checks whether the given contact is a user + *

+ * @param contact Contact to check + *

+ * @return Whether the contact is a user + */ + boolean isContactFound (final Contact contact); + + /** + * Checks whether a public user account is registered. This means that at + * least one user profile has its flag "public user profile" enabled. + *

+ * @return Whether at least one user has a public profile + */ + boolean isVisibleUserFound (); + + /** + * Checks whether given user instance's name is used + *

+ * @param user User instance's name to check + *

+ * @return Whether it is already used + */ + boolean isUserNameRegistered (final User user); + + /** + * Tries to lookup user by given id number. If the user is not found or the + * account status is not CONFIRMED proper exceptions are thrown. + *

+ * @param userId User id + *

+ * @return User instance + *

+ * @throws UserNotFoundException If the user is not found + */ + User lookupUserById (final Long userId) throws UserNotFoundException; + + /** + * Tries to lookup user by given email address. If the user is not found a + * proper exceptions is thrown. + *

+ * @param emailAddress Email address + *

+ * @return User instance + *

+ * @throws UserEmailAddressNotFoundException If the user's email address is not found + */ + User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException; + /** * Creates an instance from all properties *

+ * @param createContactData Whether contact data should be created + *

* @return A user instance */ - User createUserInstance (); + User createUserInstance (final boolean createContactData); + + /** + * Creates a user instance for login phase + *

+ * @return User instance + */ + User createUserLogin (); /** * Getter for user id @@ -185,35 +265,34 @@ public interface PizzaUserWebSessionController extends Serializable { boolean isSamePasswordEntered (); /** - * Checks whether given user instance's name is used - *

- * @param user User instance's name to check + * Checks if the user id is empty *

- * @return Whether it is already used + * @return Whether the user id is empty */ - boolean isUserNameRegistered (final User user); + boolean isUserIdEmpty (); /** - * Checks whether a public user account is registered. This means that at - * least one user profile has its flag "public user profile" enabled. + * Changes logged-in user's personal data if the current password matches + * and TAC + privacy statement has been accepted. *

- * @return Whether at least one user has a public profile + * @return New target page */ - boolean isVisibleUserFound (); + String doChangePersonalData (); /** - * Checks if the user id is empty + * Checks whether this application requires a user name to be entered. + * Otherwise a random name like "userXXXXX" is generated *

- * @return Whether the user id is empty + * @return Whether this application requires a user name */ - boolean isUserIdEmpty (); + boolean isUserNameRequired (); /** - * Changes logged-in user's personal data if the current password matches - * and TAC + privacy statement has been accepted. + * Checks wether public user profiles are enabled. This requires that user + * names are also enabled. *

- * @return New target page + * @return Whether public user profiles are enabled */ - String doChangePersonalData (); + boolean isPublicUserProfileEnabled (); }