]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Rewrites:
authorRoland Häder <roland@mxchange.org>
Tue, 3 May 2016 15:25:29 +0000 (17:25 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 3 May 2016 21:13:11 +0000 (23:13 +0200)
- moved a lot unrelated user-only methods to proper admin controller

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java
web/admin/user/admin_user_delete.xhtml
web/admin/user/admin_user_list.xhtml
web/admin/user/admin_user_show.xhtml
web/admin/user/admin_user_unlock.xhtml

index 0c8a886e3046d80eac958d842d61c12b8ad86a37..264d7a9b52d7fdd064d872c287120fae08f8bb44 100644 (file)
@@ -141,7 +141,7 @@ public class PizzaUserLoginWebSessionBean implements PizzaUserLoginWebSessionCon
 
        @Override
        public String getCurrentPassword () {
-               return currentPassword;
+               return this.currentPassword;
        }
 
        @Override
index 1e0c3f2be6a2783fefd51599f5c5851531264245..912fe1db35d8159533dcec8c963c2e3d78f8471e 100644 (file)
@@ -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)));
        }
+
 }
index 0334691577afc4e796f5ed4116fc66a9acb82b2d..b53734e0172de85ae0c039bdb6f8f3186bbcc74a 100644 (file)
@@ -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
         */
index b0a3dcaf931acf76ae7acb452baf8aad1ee8a2b2..8a498d806afd32645783544e41d86abf50ca354e 100644 (file)
@@ -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<User> 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<Contact> allContacts = this.contactBean.getAllContacts();
+               List<Contact> allContacts = this.contactController.allContacts();
 
                // Get iterator
                Iterator<Contact> 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);
index c971812a4d0bf6182bcc40da91e26299aaf199ba..268e154f13a0cb3d55d6f2c16a2b157101eb8977 100644 (file)
@@ -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.
+        * <p>
+        * @return Whether at least one user has a public profile
+        */
+       boolean isVisibleUserFound ();
+
        /**
         * Checks whether given user instance's name is used
         * <p>
@@ -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.
-        * <p>
-        * @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.
index 46f1e0cb316afc3e3c95f3f8487509ebcd1a4e5a..a214fc52c4e13b3ada974ba6a1fff34c92a7768e 100644 (file)
@@ -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);
 
index 0fdcb19947c3ad782deec6f2e934d02d5b8c7027..720c9033efa056f05a38d7bb9ac905c8cd14e2fc 100644 (file)
@@ -10,6 +10,7 @@
 
        <f:metadata>
                <f:viewParam name="userId" value="#{adminHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
+               <f:viewAction action="#{adminHelper.copyUserToController()}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
index 6f1b0780c6546fa58a311e96f7ad7eabfdded8bb..ed3caab91ae700216c95fb65731a1e37f717df18 100644 (file)
@@ -88,7 +88,7 @@
                                                                <div class="table_right_medium">
                                                                        <h:selectOneMenu class="select" id="userContact" value="#{adminHelper.contact}" converter="ContactConverter">
                                                                                <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                                                                               <f:selectItems value="#{userController.selectableContacts()}" var="contact" itemValue="#{contact}" itemLabel="#{contact.contactId}: #{msg[contact.contactGender.messageKey]} #{contact.contactFirstName} #{contact.contactFamilyName}" />
+                                                                               <f:selectItems value="#{adminUserController.selectableContacts()}" var="contact" itemValue="#{contact}" itemLabel="#{contact.contactId}: #{msg[contact.contactGender.messageKey]} #{contact.contactFirstName} #{contact.contactFamilyName}" />
                                                                        </h:selectOneMenu>
                                                                </div>
 
index 98d5d702efdceaa4c936c3d72fed03628862d6a3..927dfc9b74ad1f63eee940d94f4ad2454af3fed1 100644 (file)
@@ -10,6 +10,7 @@
 
        <f:metadata>
                <f:viewParam name="userId" value="#{adminHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
+               <f:viewAction action="#{adminHelper.copyUserToController()}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
index fe96f5512baed7fceab3e970ce1e017cb8e154d7..7b33fdaa463d22fbcf5b7ac0420c18115b2b0b74 100644 (file)
@@ -10,6 +10,7 @@
 
        <f:metadata>
                <f:viewParam name="userId" value="#{adminHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" />
+               <f:viewAction action="#{adminHelper.copyUserToController()}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">