]> git.mxchange.org Git - pizzaservice-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:42:42 +0000 (20:42 +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/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java

index 1a099c7e10659fa67684a52a0b79fa1be75bb07c..c3c82d7e2f3090ec055d6bfd7d0ab8b3a6cb0f34 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 PizzaAdminUserWebSessionBean implements PizzaAdminUserWebSessionCon
         */
        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 PizzaAdminUserWebSessionBean implements PizzaAdminUserWebSessionCon
                // 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();
        }