]> git.mxchange.org Git - jjobs-war.git/commitdiff
Added redirect outcome + updated jar(s)
authorRoland Häder <roland@mxchange.org>
Thu, 21 Apr 2016 12:38:35 +0000 (14:38 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 21 Apr 2016 19:54:10 +0000 (21:54 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestController.java
web/admin/user/admin_user_edit.xhtml

index 62979e53001d65e380e4c77e532b860a6b1a67f5..3196ecb9fe343e4f9936da876a7012de71ddb3c0 100644 (file)
@@ -34,8 +34,12 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
+import org.mxchange.jusercore.container.login.UserLoginContainer;
 import org.mxchange.jusercore.events.user.AdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.AdminUserAddedEvent;
+import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
+import org.mxchange.jusercore.events.user.update.AdminUserDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -46,6 +50,8 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.jusercore.model.user.UserUtils;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
+import org.mxchange.pizzaapplication.beans.contact.PizzaContactWebSessionController;
+import org.mxchange.pizzaapplication.beans.helper.PizzaAdminWebRequestController;
 
 /**
  * A user bean (controller)
@@ -72,7 +78,7 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
         * Admin helper instance
         */
        @Inject
-       private RateCalcAdminWebRequestController adminHelper;
+       private PizzaAdminWebRequestController adminHelper;
 
        /**
         * Regular contact controller
@@ -136,7 +142,7 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
        }
 
        @Override
-       public void addUser () {
+       public String addUser () {
                // Create new user instance
                User localUser = new LoginUser();
 
@@ -199,6 +205,9 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
 
                // Clear contact instance
                this.contactController.clear();
+
+               // Return to user list (for now)
+               return "admin_list_user"; //NOI18N
        }
 
        @Override
@@ -206,16 +215,16 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
                // Check parameter
                if (null == event) {
                        // Throw NPE
-                       throw new NullPointerException("event is null");
+                       throw new NullPointerException("event is null"); //NOI18N
                } else if (event.getUpdatedUser() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("event.updatedUser is null");
+                       throw new NullPointerException("event.updatedUser is null"); //NOI18N
                } else if (event.getUpdatedUser().getUserId() == null) {
                        // ... and again
-                       throw new NullPointerException("event.updatedUser.userId is null");
+                       throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
                } else if (event.getUpdatedUser().getUserId() < 1) {
                        // Invalid value
-                       throw new IllegalArgumentException(MessageFormat.format("event.updatedUser.userId={0} is in valid", event.getUpdatedUser().getUserId()));
+                       throw new IllegalArgumentException(MessageFormat.format("event.updatedUser.userId={0} is in valid", event.getUpdatedUser().getUserId())); //NOI18N
                }
 
                // All fine, so update list
@@ -229,7 +238,7 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
        }
 
        @Override
-       public void editUserData () {
+       public String editUserData () {
                // Get user instance
                User user = this.adminHelper.getUser();
 
@@ -239,31 +248,31 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
                // Check if user instance is in helper and valid
                if (null == user) {
                        // Throw NPE
-                       throw new NullPointerException("adminHelper.user is null");
+                       throw new NullPointerException("adminHelper.user is null"); //NOI18N
                } else if (user.getUserId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("adminHelper.user.userId is null");
+                       throw new NullPointerException("adminHelper.user.userId is null"); //NOI18N //NOI18N
                } else if (user.getUserId() < 1) {
                        // Invalid id
                        throw new IllegalStateException(MessageFormat.format("adminHelper.user.userId={0} is invalid", user.getUserId()));
                } else if (this.getUserName() == null) {
                        // Not all required fields are set
-                       throw new NullPointerException("this.userName is null");
+                       throw new NullPointerException("this.userName is null"); //NOI18N
                } else if (this.getUserName().isEmpty()) {
                        // Not all required fields are set
-                       throw new IllegalArgumentException("this.userName is empty");
+                       throw new IllegalArgumentException("this.userName is empty"); //NOI18N
                } else if (((!this.getUserPassword().isEmpty()) || (!this.getUserPasswordRepeat().isEmpty())) && (!this.isSamePasswordEntered())) {
                        // Not same password entered
                        this.setUserPassword(null);
                        this.setUserPasswordRepeat(null);
 
                        // Throw exception
-                       throw new FaceletException("Not same password entered");
+                       throw new FaceletException("Not same password entered"); //NOI18N
                } else if (this.isSamePasswordEntered()) {
                        // Same password entered, create container
                        if (UserUtils.ifPasswordMatches(new UserLoginContainer(user, this.getUserPassword()))) {
                                // Same password entered
-                               throw new FaceletException("Same password as stored entered.");
+                               throw new FaceletException("Same password as stored entered."); //NOI18N
                        }
 
                        // Encrypt password
@@ -287,6 +296,9 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
 
                // Fire event
                this.updatedUserDataEvent.fire(new AdminUserDataUpdatedEvent(updatedUser));
+
+               // Return to user list (for now)
+               return "admin_list_user"; //NOI18N
        }
 
        @Override
@@ -388,13 +400,13 @@ public class JobsAdminUserWebRequestBean implements JobsAdminUserWebRequestContr
                // The user should be valid
                if (null == user) {
                        // Throw NPE
-                       throw new NullPointerException("user is null");
+                       throw new NullPointerException("user is null"); //NOI18N
                } else if (user.getUserId() == null) {
                        // ... again NPE
-                       throw new NullPointerException("user.userId is null");
+                       throw new NullPointerException("user.userId is null"); //NOI18N
                } else if (user.getUserId() < 1) {
                        // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId()));
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
                }
 
                // Get iterator
index 1dba6ca696940c30798b472ca1b6ce3e9433ee2e..a38935615fba3ca6902f9c7deaa55d47bf747c53 100644 (file)
@@ -66,13 +66,17 @@ public interface JobsAdminUserWebRequestController extends Serializable {
         * Adds user instance to database by preparing a complete user instance and
         * sending it to the EJB. The data set in the controller is being verified,
         * e.g. if the user name or email address is not used yet.
+        * <p>
+        * @return Redirect outcome
         */
-       void addUser ();
+       String addUser ();
 
        /**
         * Edits cuirrently loaded user's data in database.
+        * <p>
+        * @return Redirect outcome
         */
-       void editUserData();
+       String editUserData();
 
        /**
         * Getter for user name
index 2adfb62bc11ae05bde30ab4a5f4d043cf73ffdaa..9c0ca9a9d759ad8e7d27f3404cec85b6a4159be6 100644 (file)
@@ -32,7 +32,9 @@
                                                #{msg.ADMIN_PERSONAL_DATA_MINIMUM_NOTICE}
                                        </div>
 
-                                       <ui:include src="/WEB-INF/templates/admin/user/admin_form_user_data.tpl" />
+                                       <ui:include src="/WEB-INF/templates/admin/user/admin_form_user_data.tpl">
+                                               <ui:param name="mode" value="edit" />
+                                       </ui:include>
 
                                        <div class="table_footer">
                                                <h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />