]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Mon, 18 Apr 2016 16:08:12 +0000 (18:08 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 18 Apr 2016 18:50:01 +0000 (20:50 +0200)
- added event for added user accounts (by admin)
- updated jar(s)

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java

index 1ac72d0b20c23922a2e1dcc8762338f967fb18a9..2afbb491b131e07936e221d03db6bb4812ed2ecf 100644 (file)
@@ -23,6 +23,8 @@ import java.util.List;
 import java.util.Objects;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -40,6 +42,7 @@ import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jusercore.events.user.AdminAddedUserEvent;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -65,7 +68,13 @@ public class AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /////////////////////// Properties /////////////////////
+       /**
+        * An event fired when the administrator has added a new user
+        */
+       @Inject
+       @Any
+       private Event<AdminAddedUserEvent> addedUserEvent;
+
        /**
         * Birth day
         */
@@ -326,14 +335,19 @@ public class AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW
                // Encrypt password and set it
                user.setUserEncryptedPassword(UserUtils.encryptPassword(password));
 
+               // Init updated user instance
+               User updatedUser = null;
+
                try {
                        // Now, that all is set, call EJB
-                       this.userBean.addUser(user);
+                       updatedUser = this.userBean.addUser(user);
                } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
                        // Throw again
                        throw new FaceletException(ex);
                }
 
+               // Fire event
+
                // Clear all
                this.clear();
        }