]> git.mxchange.org Git - pizzaservice-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 14:25:00 +0000 (16:25 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java

index 264d7a9b52d7fdd064d872c287120fae08f8bb44..e4d5ecb772a6687f9cd5c78a45799e0839326fef 100644 (file)
@@ -113,7 +113,7 @@ public class PizzaUserLoginWebSessionBean implements PizzaUserLoginWebSessionCon
        @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 483c13143d0cc39d3f047164f55f39afd6687651..de9ef070f742ee1ed38fd94209b87d41c39908ba 100644 (file)
@@ -365,6 +365,33 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                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 4edcd87aecdb992a4e13763d008374d654c91ef9..1821a80863c65a8ed7b0bba32a16fe76fac17e72 100644 (file)
@@ -149,6 +149,13 @@ public interface PizzaUserWebSessionController extends Serializable {
         */
        User createUserInstance ();
 
+       /**
+        * Creates a user instance for login phase
+        * <p>
+        * @return User instance
+        */
+       User createUserLogin ();
+
        /**
         * Getter for user id
         * <p>