]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Cleanup a bit + fix:
authorRoland Häder <roland@mxchange.org>
Fri, 13 May 2016 08:22:45 +0000 (10:22 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 13 May 2016 19:43:15 +0000 (21:43 +0200)
- removed not needed assertion
- renamed variables
- if multi-page is enabled, don't create contact instance, that will be done on 2nd page

src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java

index 51a7f625d2a8d9c0338ba5497ed4646b6c406d04..b05478a184215a28cfb9728597d5ef9902df1342 100644 (file)
@@ -428,9 +428,6 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                        throw new FaceletException(new IllegalArgumentException("Not all personal data is set, but createContactInstance() is called.")); //NOI18N
                }
 
-               // Required personal data must be set
-               assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
-
                // Generate phone number
                DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
                DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
index 105f9ddc856ca90fbadcd5b1fd1dfd4622827bf2..d82fc7012e2b5b66aac876ec94b529ea71a555d3 100644 (file)
@@ -382,7 +382,7 @@ public class PizzaUserWebSessionBean extends BasePizzaController implements Pizz
                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()) {
@@ -402,23 +402,26 @@ public class PizzaUserWebSessionBean extends BasePizzaController implements Pizz
                }
 
                // 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
@@ -642,16 +645,16 @@ public class PizzaUserWebSessionBean extends BasePizzaController implements Pizz
                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
@@ -697,10 +700,10 @@ public class PizzaUserWebSessionBean extends BasePizzaController implements Pizz
                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