From fd6f89a5bb4b081963341821bb7bb2b2664e7236 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 13 May 2016 10:22:45 +0200 Subject: [PATCH] Cleanup a bit + fix: - removed not needed assertion - renamed variables - if multi-page is enabled, don't create contact instance, that will be done on 2nd page --- .../beans/user/JobsUserWebSessionBean.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java index eb4e781f..34eaf370 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java @@ -375,7 +375,7 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N // Create new user instance - User localUser = new LoginUser(); + User user = new LoginUser(); // Is user name required? if (!this.isUserNameRequired()) { @@ -395,23 +395,26 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs } // Set user name and mode - localUser.setUserName(this.getUserName()); - localUser.setUserProfileMode(this.getUserProfileMode()); + user.setUserName(this.getUserName()); + user.setUserProfileMode(this.getUserProfileMode()); - // Create contact instance - Contact contact = this.contactController.createContactInstance(); + // Is multiple registration page + if (!this.registerController.isMultiplePageEnabled()) { + // Create contact instance + Contact contact = this.contactController.createContactInstance(); - // Debug message - //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createUserInstance: contact={1}", this.getClass().getSimpleName(), contact)); + // Debug message + //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createUserInstance: contact={1}", this.getClass().getSimpleName(), contact)); - // Set contact in user - localUser.setUserContact(contact); + // Set contact in user + user.setUserContact(contact); + } // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createUserInstance: user={1} - EXIT!", this.getClass().getSimpleName(), user)); // Return it - return localUser; + return user; } @Override @@ -635,16 +638,16 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_public_profile_enabled"); //NOI18N // Is it set? - boolean isPublicUserProfileEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N + boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N // This requires user names being enabled, too. - if ((isPublicUserProfileEnabled) && (!this.isUserNameRequired())) { + if ((isEnabled) && (!this.isUserNameRequired())) { // Not valid state, users must be able to modify their profile, especially when it is public throw new IllegalStateException("Public user profiles are enabled but user name requirement is disabled, this is not possible."); //NOI18N } // Return value - return isPublicUserProfileEnabled; + return isEnabled; } @Override @@ -690,10 +693,10 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_user_name_required"); //NOI18N // Is it set? - boolean isUserNameRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N + boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N // Return value - return isUserNameRequired; + return isRequired; } @Override -- 2.39.5