From: Roland Haeder Date: Sat, 5 Mar 2016 15:33:26 +0000 (+0100) Subject: Continued with updating personal data: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0e611b6020b9c081ae0f084e6e8b1daaa2bb34db;p=jjobs-war.git Continued with updating personal data: - added check if all required fields are set - added preparing user instance and sending it to the EJB - doChangeFoo() all need to return a string for next target page (not added yet) - updated jar(s) --- diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar index 35588bb0..03505911 100644 Binary files a/lib/juser-lib.jar and b/lib/juser-lib.jar differ diff --git a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java index 61363cfd..bee8b1df 100644 --- a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java @@ -239,15 +239,31 @@ public class UserWebSessionBean implements UserWebSessionController { } @Override - public void doChangePersonalData () throws UserPasswordMismatchException { + public String doChangePersonalData () throws UserPasswordMismatchException { // This method shall only be called if the user is logged-in if (!this.loginController.isUserLoggedIn()) { // Not logged-in throw new IllegalStateException("User is not logged-in"); //NOI18N + } else if (!this.isRequiredPersonalDataSet()) { + // Not all required fields are set + throw new FaceletException("Not all required fields are set."); //NOI18N } else if (!this.loginController.ifCurrentPasswordMatches()) { // Password not matching throw new UserPasswordMismatchException(this.loginController.getLoggedInUser()); } + + // Create new user instance from existing data + User user = this.createUserInstance(); + + // Update it from logged-in user (e.g. user and contact id) + user.setUserId(this.loginController.getLoggedInUser().getUserId()); + user.getUserContact().setContactId(this.loginController.getLoggedInUser().getUserContact().getContactId()); + + // Send it to the EJB + this.userBean.updateUserPersonalData(user); + + // All fine + return "login_personal_data_changed"; //NOI18N } @Override diff --git a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java index cbb933fd..d9553011 100644 --- a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java +++ b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java @@ -484,7 +484,9 @@ public interface UserWebSessionController extends Serializable { * Changes logged-in user's personal data if the current password matches * and TAC + privacy statement has been accepted. *

+ * @return New target page + *

* @throws UserPasswordMismatchException If the entered password doesn't match */ - void doChangePersonalData () throws UserPasswordMismatchException; + String doChangePersonalData () throws UserPasswordMismatchException; }