]> git.mxchange.org Git - jjobs-war.git/commitdiff
A bit cleanup and introduced private method:
authorRoland Haeder <roland@mxchange.org>
Wed, 13 Apr 2016 21:28:04 +0000 (23:28 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 13 Apr 2016 21:46:42 +0000 (23:46 +0200)
- introduced clear() to cleanup after adding user
- Fields such as userId and so are not right in this bean
- got rid of add_user as this can be merged with list_user as many other pages are constructed like this, too

src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionController.java
web/admin/admin_user_add.xhtml [deleted file]
web/admin/admin_user_list.xhtml

index 2e6e126542390ac740f6f96b98fbe1939967466d..0f5b8b969fbc4b2a13b0a7438fad9931bafad44b 100644 (file)
@@ -49,6 +49,7 @@ import org.mxchange.jusercore.model.user.User;
 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;
 
 /**
  * A user bean (controller)
@@ -160,11 +161,6 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
         */
        private final UserSessionBeanRemote userBean;
 
-       /**
-        * User id
-        */
-       private Long userId;
-
        /**
         * A list of all user profiles
         */
@@ -185,11 +181,6 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
         */
        private String userPasswordRepeat;
 
-       /**
-        * Whether the user wants a public profile
-        */
-       private ProfileMode userProfileMode;
-
        /**
         * ZIP code
         */
@@ -226,7 +217,8 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
                // Create new user instance
                User user = new LoginUser();
                user.setUserName(this.getUserName());
-               user.setUserProfileMode(this.getUserProfileMode());
+               user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
+               user.setUserProfileMode(ProfileMode.INVISIBLE);
 
                // Generate phone number
                DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
@@ -341,6 +333,9 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
                        // Throw again
                        throw new FaceletException(ex);
                }
+
+               // Clear all
+               this.clear();
        }
 
        @Override
@@ -529,16 +524,6 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
                this.street = street;
        }
 
-       @Override
-       public Long getUserId () {
-               return this.userId;
-       }
-
-       @Override
-       public void setUserId (final Long userId) {
-               this.userId = userId;
-       }
-
        @Override
        public String getUserName () {
                return this.userName;
@@ -569,16 +554,6 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
                this.userPasswordRepeat = userPasswordRepeat;
        }
 
-       @Override
-       public ProfileMode getUserProfileMode () {
-               return this.userProfileMode;
-       }
-
-       @Override
-       public void setUserProfileMode (final ProfileMode userProfileMode) {
-               this.userProfileMode = userProfileMode;
-       }
-
        @Override
        public Integer getZipCode () {
                return this.zipCode;
@@ -640,4 +615,33 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
                return user;
        }
 
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all
+               this.setBirthday(null);
+               this.setCellphoneCarrier(null);
+               this.setCellphoneNumber(null);
+               this.setCity(null);
+               this.setComment(null);
+               this.setCountry(null);
+               this.setEmailAddress(null);
+               this.setFamilyName(null);
+               this.setFaxAreaCode(null);
+               this.setFaxCountry(null);
+               this.setFaxNumber(null);
+               this.setFirstName(null);
+               this.setGender(null);
+               this.setHouseNumber(null);
+               this.setPhoneAreaCode(null);
+               this.setPhoneCountry(null);
+               this.setPhoneNumber(null);
+               this.setStreet(null);
+               this.setUserName(null);
+               this.setUserPassword(null);
+               this.setUserPasswordRepeat(null);
+               this.setZipCode(null);
+       }
+
 }
index 23345a6454970528243107fed58bba4c94086fbc..3580232dabc1bebb85a5bab703d55767772c9348 100644 (file)
@@ -24,7 +24,6 @@ import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 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
@@ -318,20 +317,6 @@ public interface JobsAdminUserWebSessionController extends Serializable {
         */
        void setStreet (final String street);
 
-       /**
-        * Getter for user id
-        * <p>
-        * @return User id
-        */
-       Long getUserId ();
-
-       /**
-        * Setter for user id
-        * <p>
-        * @param userId User id
-        */
-       void setUserId (final Long userId);
-
        /**
         * Getter for user name
         * <p>
@@ -374,20 +359,6 @@ public interface JobsAdminUserWebSessionController extends Serializable {
         */
        void setUserPasswordRepeat (final String userPasswordRepeat);
 
-       /**
-        * Getter for user profile mode
-        * <p>
-        * @return User profile mode
-        */
-       ProfileMode getUserProfileMode ();
-
-       /**
-        * Setter for user profile mode
-        * <p>
-        * @param userProfileMode User profile mode
-        */
-       void setUserProfileMode (final ProfileMode userProfileMode);
-
        /**
         * ZIP code
         * <p>
diff --git a/web/admin/admin_user_add.xhtml b/web/admin/admin_user_add.xhtml
deleted file mode 100644 (file)
index 19e2dde..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-         xmlns:ui="http://java.sun.com/jsf/facelets"
-         xmlns:h="http://xmlns.jcp.org/jsf/html"
-         xmlns:f="http://xmlns.jcp.org/jsf/core"
-         >
-
-       <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
-               <ui:define name="admin_title">#{msg.PAGE_TITLE_ADMIN_ADD_USER}</ui:define>
-
-               <ui:define name="content_header">
-                       #{msg.CONTENT_TITLE_ADMIN_ADD_USER}
-               </ui:define>
-
-               <ui:define name="content">
-                       <div class="table">
-                               <h:form id="admin_add_user">
-                                       <div class="table_header">
-                                               #{msg.ADMIN_ADD_USER_TITLE}
-                                       </div>
-
-                                       <ui:include src="/WEB-INF/templates/admin/admin_form_personal_data.tpl" />
-
-                                       <div class="table_footer">
-                                               <h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
-                                               <h:commandButton class="submit" type="submit" id="register" value="#{msg.BUTTON_ADMIN_ADD_USER}" action="#{adminUserController.addUser()}" />
-                                       </div>
-                               </h:form>
-                       </div>
-               </ui:define>
-       </ui:composition>
-</html>
index 876f195dda0f4a0bd5a1d6a8b1e995afdaefb18f..b8b0e3530744289c93bcf5d604648c8159381e25 100644 (file)
                <ui:define name="content">
                        <h:dataTable id="table_list_users" var="user" value="#{adminUserController.allUsers()}" styleClass="table" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_USERS}" rendered="#{adminUserController.hasUsers()}">
                        </h:dataTable>
+
+                       <div class="table">
+                               <h:form id="admin_add_user">
+                                       <div class="table_header">
+                                               #{msg.ADMIN_ADD_USER_TITLE}
+                                       </div>
+
+                                       <ui:include src="/WEB-INF/templates/admin/admin_form_personal_data.tpl" />
+
+                                       <div class="table_footer">
+                                               <h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
+                                               <h:commandButton class="submit" type="submit" id="register" value="#{msg.BUTTON_ADMIN_ADD_USER}" action="#{adminUserController.addUser()}" />
+                                       </div>
+                               </h:form>
+                       </div>
                </ui:define>
        </ui:composition>
 </html>