From 01cd6bf17949040e251919a4446e3f259e1c814b 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 --- .../AddressbookAdminUserWebSessionBean.java | 66 ++++++++++--------- ...ressbookAdminUserWebSessionController.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/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java index 8b40d30c..a55f4e38 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.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 AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW */ private final UserSessionBeanRemote userBean; - /** - * User id - */ - private Long userId; - /** * A list of all user profiles */ @@ -185,11 +181,6 @@ public class AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW */ private String userPasswordRepeat; - /** - * Whether the user wants a public profile - */ - private ProfileMode userProfileMode; - /** * ZIP code */ @@ -226,7 +217,8 @@ public class AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW // 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 AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW // Throw again throw new FaceletException(ex); } + + // Clear all + this.clear(); } @Override @@ -529,16 +524,6 @@ public class AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW 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 AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW 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 AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW 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/addressbook/beans/user/AddressbookAdminUserWebSessionController.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionController.java index e5cd9c12..26f734ca 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionController.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 AddressbookAdminUserWebSessionController 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 AddressbookAdminUserWebSessionController 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