From: Roland Häder Date: Fri, 6 May 2016 11:06:52 +0000 (+0200) Subject: Introduced createUserLogin() (safe to cherry-pick) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2f1dc01f247f98b5b0c564d95434960ddf5cbb3f;p=jjobs-war.git Introduced createUserLogin() (safe to cherry-pick) Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java index 43bd9254..e79a0f79 100644 --- a/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/login/JobsUserLoginWebSessionBean.java @@ -113,7 +113,7 @@ public class JobsUserLoginWebSessionBean implements JobsUserLoginWebSessionContr @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()); diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java index 4318d410..c95bc7c1 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java @@ -359,6 +359,33 @@ public class JobsUserWebSessionBean implements JobsUserWebSessionController { 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 diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java index cbce3c01..e7869ec9 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java @@ -149,6 +149,13 @@ public interface JobsUserWebSessionController extends Serializable { */ User createUserInstance (); + /** + * Creates a user instance for login phase + *

+ * @return User instance + */ + User createUserLogin (); + /** * Getter for user id *