X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Fjava%2Forg%2Fmxchange%2Fpizzaapplication%2Fbeans%2Fuser%2FPizzaUserWebSessionController.java;h=b56053d128ad4f4a7790fd030995495cbae5ed02;hb=7f0541570bda07790dcddb59eb93c84d82d793a9;hp=e50851eb41e6dfe764285515883b134310f0f71e;hpb=25bce04497e217c938789a190148dbcbfd2dbc14;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 e50851eb..b56053d1 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, 2017 Roland Häder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -17,15 +17,17 @@ package org.mxchange.pizzaapplication.beans.user; import java.io.Serializable; -import org.mxchange.jusercore.events.login.UserLoggedInEvent; -import org.mxchange.jusercore.events.registration.UserRegisteredEvent; +import java.util.List; +import org.mxchange.jcontacts.contact.Contact; +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; /** * An interface for user beans *

- * @author Roland Haeder + * @author Roland Häder */ public interface PizzaUserWebSessionController extends Serializable { @@ -35,25 +37,95 @@ public interface PizzaUserWebSessionController extends Serializable { public static final Integer MINIMUM_PASSWORD_LENGTH = 5; /** - * Event observer for new user registrations + * Checks if both user passwords are left empty and if this is enabled + * (allowed) in context parameter. If true, the calling bean should create a + * random password (preferable with UserUtils.createRandomPassword() and set + * it in both user password fields. *

- * @param event User registration event + * @return Whether empty passwords are allowed */ - void afterRegistrationEvent (final UserRegisteredEvent event); + boolean ifBothPasswordsEmptyAllowed (); /** - * Event observer for logged-in user + * All users *

- * @param event Event instance + * @return A list of all public user profiles */ - void afterUserLogin (final UserLoggedInEvent event); + List allUsers (); + + /** + * All public user profiles + *

+ * @return A list of all public user profiles + */ + 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 @@ -84,30 +156,30 @@ public interface PizzaUserWebSessionController 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); @@ -161,4 +233,20 @@ public interface PizzaUserWebSessionController 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. + *

+ * @return Whether public user profiles are enabled + */ + boolean isPublicUserProfileEnabled (); + }