From: Roland Häder Date: Tue, 3 May 2016 15:25:29 +0000 (+0200) Subject: Rewrites: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3ef309fc4b8cc6af07696a0bd305a702f01651b8;p=pizzaservice-war.git Rewrites: - moved a lot unrelated user-only methods to proper admin controller Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java index 0c8a886e..264d7a9b 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java @@ -141,7 +141,7 @@ public class PizzaUserLoginWebSessionBean implements PizzaUserLoginWebSessionCon @Override public String getCurrentPassword () { - return currentPassword; + return this.currentPassword; } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java index 1e0c3f2b..912fe1db 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java @@ -42,7 +42,7 @@ public class PizzaUserProfileWebRequestBean implements PizzaUserProfileWebReques private static final long serialVersionUID = 187_687_145_286_710L; /** - * User controller + * Administrative user controller */ @Inject private PizzaAdminUserWebRequestController adminUserController; @@ -51,7 +51,7 @@ public class PizzaUserProfileWebRequestBean implements PizzaUserProfileWebReques * Login controller */ @Inject - private PizzaUserLoginWebSessionController loginController; + private PizzaUserLoginWebSessionController userLoginController; @Override public boolean isProfileLinkVisibleById (final Long userId) { @@ -113,4 +113,5 @@ public class PizzaUserProfileWebRequestBean implements PizzaUserProfileWebReques return ((profileMode.equals(ProfileMode.PUBLIC)) || (this.userLoginController.isUserLoggedIn()) && (profileMode.equals(ProfileMode.MEMBERS))); } + } diff --git a/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java index 03346915..b53734e0 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java @@ -53,6 +53,12 @@ public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSess */ private static final long serialVersionUID = 47_828_986_719_691_592L; + /** + * User controller + */ + @Inject + private PizzaAdminUserWebRequestController adminUserController; + /** * User controller */ @@ -77,12 +83,6 @@ public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSess @Inject private PizzaUserWebSessionController userController; - /** - * User controller - */ - @Inject - private PizzaAdminUserWebRequestController adminUserController; - /** * Default constructor */ diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java index b0a3dcaf..8a498d80 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java @@ -94,12 +94,6 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon @Inject private PizzaContactWebSessionController contactController; - /** - * Login bean (controller) - */ - @Inject - private PizzaUserLoginWebSessionController loginController; - /** * A list of all selectable contacts */ @@ -128,6 +122,12 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon */ private List userList; + /** + * Login bean (controller) + */ + @Inject + private PizzaUserLoginWebSessionController userLoginController; + /** * User name */ @@ -324,7 +324,6 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon // Debug message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminUserWebBean:afterRegistration: registeredUser={0}", registeredUser)); //NOI18N - // Add user to local list this.userList.add(registeredUser); @@ -337,6 +336,9 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon // Add user name and email address this.addUserNameEmailAddress(registeredUser); + // Clear all data + this.clear(); + // Trace message //* NOISY-DEBUG: */ System.out.println("AdminUserWebBean:afterRegistration: EXIT!"); //NOI18N } @@ -512,18 +514,31 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon this.userNameList = this.userBean.getUserNameList(); // Is the user logged-in? - if (this.loginController.isUserLoggedIn()) { + if (this.userLoginController.isUserLoggedIn()) { // Is logged-in, so load also users visible to memebers this.visibleUserList = this.userBean.allMemberPublicVisibleUsers(); } else { // Initialize user list this.visibleUserList = this.userBean.allPublicUsers(); } + // Initialize user list this.userList = this.userBean.allUsers(); + // Get full user name list for reducing EJB calls + this.userNameList = this.userBean.getUserNameList(); + + // Is the user logged-in? + if (this.userLoginController.isUserLoggedIn()) { + // Is logged-in, so load also users visible to memebers + this.visibleUserList = this.userBean.allMemberPublicVisibleUsers(); + } else { + // Initialize user list + this.visibleUserList = this.userBean.allPublicUsers(); + } + // Get all contacts - List allContacts = this.contactBean.getAllContacts(); + List allContacts = this.contactController.allContacts(); // Get iterator Iterator iterator = allContacts.iterator(); @@ -709,7 +724,8 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon * Clears this bean */ private void clear () { - // Clear all fields + // Clear all data + // - other data this.setUserName(null); this.setUserPassword(null); this.setUserPasswordRepeat(null); diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestController.java index c971812a..268e154f 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestController.java @@ -84,6 +84,14 @@ public interface PizzaAdminUserWebRequestController extends Serializable { */ 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 *

@@ -93,14 +101,6 @@ public interface PizzaAdminUserWebRequestController extends Serializable { */ boolean isUserNameRegistered (final User user); - /** - * 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 (); - /** * 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. diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java index 46f1e0cb..a214fc52 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java @@ -150,7 +150,6 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { // Debug message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: registeredUser={0}", registeredUser)); //NOI18N - // Copy all data from registered->user this.copyUser(registeredUser); diff --git a/web/admin/user/admin_user_delete.xhtml b/web/admin/user/admin_user_delete.xhtml index 0fdcb199..720c9033 100644 --- a/web/admin/user/admin_user_delete.xhtml +++ b/web/admin/user/admin_user_delete.xhtml @@ -10,6 +10,7 @@ + diff --git a/web/admin/user/admin_user_list.xhtml b/web/admin/user/admin_user_list.xhtml index 6f1b0780..ed3caab9 100644 --- a/web/admin/user/admin_user_list.xhtml +++ b/web/admin/user/admin_user_list.xhtml @@ -88,7 +88,7 @@

- +
diff --git a/web/admin/user/admin_user_show.xhtml b/web/admin/user/admin_user_show.xhtml index 98d5d702..927dfc9b 100644 --- a/web/admin/user/admin_user_show.xhtml +++ b/web/admin/user/admin_user_show.xhtml @@ -10,6 +10,7 @@ + diff --git a/web/admin/user/admin_user_unlock.xhtml b/web/admin/user/admin_user_unlock.xhtml index fe96f551..7b33fdaa 100644 --- a/web/admin/user/admin_user_unlock.xhtml +++ b/web/admin/user/admin_user_unlock.xhtml @@ -10,6 +10,7 @@ +