From 445f40ad0b59739f6cfdf4d45dfd735ccd442475 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 13 Apr 2016 23:28:04 +0200 Subject: [PATCH] A bit cleanup and introduced private method: - 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 --- .../user/JobsAdminUserWebSessionBean.java | 66 ++++++++++--------- .../JobsAdminUserWebSessionController.java | 29 -------- web/admin/admin_user_add.xhtml | 33 ---------- web/admin/admin_user_list.xhtml | 15 +++++ 4 files changed, 50 insertions(+), 93 deletions(-) delete mode 100644 web/admin/admin_user_add.xhtml diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java index 2e6e1265..0f5b8b96 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java @@ -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); + } + } diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionController.java b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionController.java index 23345a64..3580232d 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionController.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionController.java @@ -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 - *

- * @return User id - */ - Long getUserId (); - - /** - * Setter for user id - *

- * @param userId User id - */ - void setUserId (final Long userId); - /** * Getter for user name *

@@ -374,20 +359,6 @@ public interface JobsAdminUserWebSessionController extends Serializable { */ void setUserPasswordRepeat (final String userPasswordRepeat); - /** - * Getter for user profile mode - *

- * @return User profile mode - */ - ProfileMode getUserProfileMode (); - - /** - * Setter for user profile mode - *

- * @param userProfileMode User profile mode - */ - void setUserProfileMode (final ProfileMode userProfileMode); - /** * ZIP code *

diff --git a/web/admin/admin_user_add.xhtml b/web/admin/admin_user_add.xhtml deleted file mode 100644 index 19e2ddeb..00000000 --- a/web/admin/admin_user_add.xhtml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - #{msg.PAGE_TITLE_ADMIN_ADD_USER} - - - #{msg.CONTENT_TITLE_ADMIN_ADD_USER} - - - -

- -
- #{msg.ADMIN_ADD_USER_TITLE} -
- - - - -
-
- - - diff --git a/web/admin/admin_user_list.xhtml b/web/admin/admin_user_list.xhtml index 876f195d..b8b0e353 100644 --- a/web/admin/admin_user_list.xhtml +++ b/web/admin/admin_user_list.xhtml @@ -16,6 +16,21 @@ + +
+ +
+ #{msg.ADMIN_ADD_USER_TITLE} +
+ + + + +
+
-- 2.39.5