]> git.mxchange.org Git - jjobs-war.git/commitdiff
Continued with updating personal data:
authorRoland Haeder <roland@mxchange.org>
Sat, 5 Mar 2016 15:33:26 +0000 (16:33 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 5 Mar 2016 15:33:26 +0000 (16:33 +0100)
- 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
src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java

index 35588bb0d8abbf068242701f1cb361706e19cff3..035059115efb07232f8a6f59afc1ea2b3c2c3bb4 100644 (file)
Binary files a/lib/juser-lib.jar and b/lib/juser-lib.jar differ
index 61363cfd1e658d5d391a4bd24e150c8f2f3dceb1..bee8b1df805ed69670a316194b0bd00f4390c5dc 100644 (file)
@@ -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
index cbb933fd8ccc62776e8cf97aa3ecb805f8e1be2e..d95530113c31eb9f15ca8a07408a6bcbf64ab497 100644 (file)
@@ -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.
         * <p>
+        * @return New target page
+        * <p>
         * @throws UserPasswordMismatchException If the entered password doesn't match
         */
-       void doChangePersonalData () throws UserPasswordMismatchException;
+       String doChangePersonalData () throws UserPasswordMismatchException;
 }