]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Introduced createUserLogin() (safe to cherry-pick)
authorRoland Häder <roland@mxchange.org>
Fri, 6 May 2016 11:06:52 +0000 (13:06 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 7 May 2016 10:31:14 +0000 (12:31 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/login/AddressbookUserLoginWebSessionBean.java
src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java
src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java

index ae742cebe26eb73ce119256eb1702f6afebe2b02..38b4ee8e42c16a1d16216f411a348baa02e3cdb2 100644 (file)
@@ -113,7 +113,7 @@ public class AddressbookUserLoginWebSessionBean implements AddressbookUserLoginW
        @Override
        public String doLogin () {
                // Get user instance
-               User user = this.userController.createUserInstance();
+               User user = this.userController.createUserLogin();
 
                // Create login container
                LoginContainer container = new UserLoginContainer(user, this.userController.getUserPassword());
index 93a52e5fb9b569676512b5001c692bcc56fe346e..f20cb812c0c31ec48cca435e3cb2221603b69d2c 100644 (file)
@@ -364,6 +364,33 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
                return localUser;
        }
 
+       @Override
+       public User createUserLogin () {
+               // Trace message
+               //* NOISY-DEBUG */ System.out.println(MessageFormat.format("{0}.createUserLogin: CALLED!", this.getClass().getSimpleName()));
+
+               // Is all data set?
+               if (this.getUserName() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("recruiterName is null"); //NOI18N
+               } else if (this.getUserName().isEmpty()) {
+                       // Is empty
+                       throw new IllegalStateException("recruiterName is empty."); //NOI18N
+               }
+
+               // Create new recruiter instance
+               User recruiter = new LoginUser();
+
+               // Update all data ...
+               recruiter.setUserName(this.getUserName());
+
+               // Trace message
+               //* NOISY-DEBUG */ System.out.println(MessageFormat.format("{0}.createUserLogin: recruiter={1} - EXIT!", this.getClass().getSimpleName(), recruiter));
+
+               // Return the new instance
+               return recruiter;
+       }
+
        @Override
        public String doChangePersonalData () {
                // This method shall only be called if the user is logged-in
index 7ae377a3bffe44155f5e21b7f071b789433808f9..edac6ccec741d45deef280f0dadfee21cee89ace 100644 (file)
@@ -149,6 +149,13 @@ public interface AddressbookUserWebSessionController extends Serializable {
         */
        User createUserInstance ();
 
+       /**
+        * Creates a user instance for login phase
+        * <p>
+        * @return User instance
+        */
+       User createUserLogin ();
+
        /**
         * Getter for user id
         * <p>