]> git.mxchange.org Git - addressbook-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 20:33:45 +0000 (22:33 +0200)
- removed not needed assertion
- renamed variables
- if multi-page is enabled, don't create contact instance, that will be done on 2nd page

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java
src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java

index 17c5695b2a19ad153a6693423dfee95acb2c621a..39cf52859775258023bb8dcdacb72ba7b9f85602 100644 (file)
@@ -407,9 +407,6 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController
                // Required personal data must be set
                assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
 
-               // Create new contact instance
-               Contact localContact = new UserContact();
-
                // Generate phone number
                DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
                DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
index d65e27a1b8591a6d96c63190496c4f74770eba75..be477ac84efbc855b8b75db95ef8c827120d05f2 100644 (file)
@@ -380,7 +380,7 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
                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()) {
@@ -400,23 +400,26 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
                }
 
                // 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
@@ -640,16 +643,16 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
                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
@@ -695,10 +698,10 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp
                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