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=29f0723f90ecc1bd06e97b7a8a17de3dbafa3ad5;hpb=5601456984fcef20493401a175361094b452d3a7;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 29f0723f..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,11 +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.jcontacts.events.contact.add.AdminAddedContactEvent; +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; @@ -31,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 { @@ -41,35 +44,33 @@ public interface PizzaUserWebSessionController extends Serializable { public static final Integer MINIMUM_PASSWORD_LENGTH = 5; /** - * All users + * Event observer for newly added users by adminstrator *

- * @return A list of all public user profiles + * @param event Event being fired */ - List allUsers (); + void afterAdminAddedUserEvent (final AdminAddedUserEvent event); /** - * Checks whether users are registered + * Event observer for updated user data by administrator *

- * @return Whether users are registered + * @param event Event being updated */ - boolean hasUsers (); + void afterAdminUpdatedUserDataEvent (final AdminUpdatedUserDataEvent event); /** - * Checks whether the given contact is a user + * Event observer when user confirmed account. *

- * @param contact Contact to check - *

- * @return Whether the contact is a user + * @param event Event being fired */ - boolean isContactFound (final Contact contact); + void afterUserConfirmedAccount (final UserConfirmedAccountEvent event); /** - * Observes events being fired when an administrator has added a new - * contact. + * Method being call after user's password has been updated (and history + * entry has been created). *

- * @param event Event being fired + * @param event Event being observed */ - void afterAdminAddedContact (final AdminAddedContactEvent event); + void afterUserUpdatedPasswordEvent (final UpdatedUserPasswordEvent event); /** * Listens to fired event when user updated personal data @@ -79,66 +80,98 @@ public interface PizzaUserWebSessionController extends Serializable { void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event); /** - * Updates list with given user + * Event observer for new user registrations *

- * @param user User to update + * @param event User registration event */ - void updateList (final User user); + void afterRegistrationEvent (final UserRegisteredEvent event); /** - * Returns a list of all selectable contacts for user creation. Contacts - * from already existing users are excluded in this list. + * Event observer for logged-in user *

- * @return A list of all selectable contacts + * @param event Event instance */ - List selectableContacts (); + void afterUserLogin (final UserLoggedInEvent 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. + * All users *

- * @param userId User id + * @return A list of all public user profiles + */ + List allUsers (); + + /** + * All public user profiles *

- * @return User instance + * @return A list of all public user profiles + */ + List allVisibleUsers (); + + /** + * Checks whether the given contact is a user *

- * @throws UserNotFoundException If the user is not found + * @param contact Contact to check + *

+ * @return Whether the contact is a user */ - User lookupUserById (final Long userId) throws UserNotFoundException; + boolean isContactFound (final Contact contact); /** - * Event observer for newly added users by an administrator + * Checks whether a public user account is registered. This means that at + * least one user profile has its flag "public user profile" enabled. *

- * @param event Event being fired + * @return Whether at least one user has a public profile */ - void afterAdminAddedUserEvent (final AdminAddedUserEvent event); + boolean isVisibleUserFound (); /** - * Event observer for new user registrations + * Checks whether given user instance's name is used *

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

+ * @return Whether it is already used */ - void afterRegistrationEvent (final UserRegisteredEvent event); + boolean isUserNameRegistered (final User user); /** - * Event observer for logged-in 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 event Event instance + * @param userId User id + *

+ * @return User instance + *

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

- * @return A list of all public user profiles + * @param emailAddress Email address + *

+ * @return User instance + *

+ * @throws UserEmailAddressNotFoundException If the user's email address is not found */ - List allVisibleUsers (); + 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 @@ -232,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 (); }