From: Roland Häder Date: Mon, 18 Apr 2016 16:08:12 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9bf9783e4b28800443c7470cf59e9aaed6a6c339;p=pizzaservice-war.git Continued a bit: - added event for added user accounts (by admin) - updated jar(s) Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java index 1a099c7e..c3c82d7e 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java @@ -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 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(); }