From 0e611b6020b9c081ae0f084e6e8b1daaa2bb34db Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sat, 5 Mar 2016 16:33:26 +0100 Subject: [PATCH] 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) --- lib/juser-lib.jar | Bin 4024 -> 4112 bytes .../jjobs/beans/user/UserWebSessionBean.java | 18 +++++++++++++++++- .../beans/user/UserWebSessionController.java | 4 +++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar index 35588bb0d8abbf068242701f1cb361706e19cff3..035059115efb07232f8a6f59afc1ea2b3c2c3bb4 100644 GIT binary patch delta 634 zcmdlXKS6;vz?+$ci-CcIfx)>sbt10@uTyiXhvU4pZ3PSr3%q9)5R8iDCxMhh_A$7lzp&oerLX<;T?5WP8= ziI*A7NM>bc76giToPHXuRKN_h5QuFjD>A80UcjNkCBx1j$<83f&LF+{9LHHkak0{Z zl*E$M(BjmhfYhSme4t}o5=#;%2XN^!hE1Nyb%v31avFDnE(;@rFoOut{Y(s^U{Z`h z97wYVw$G=o$W?)d9+`!?>CB@Dl&dwmg&LFw@I>%YY$*;LiF>*}a#+{(bz{DU7bPf}P z2!kk)W@BJv5My8n@MdHZVTL&#;Ui1gdL{-25O#)ZVqjR(=mydBj?YLQ6!zY; v{Tk;36@joXio&qT_WUslDDeY~BU=%ta86#!AwKyRzX01EZjcH9xPo=x 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; } -- 2.39.5