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=06ffe03e8df17ebf6063bed855a4c9df77ff6967;p=jjobs-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/jjobs/beans/user/JobsAdminUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java index 0d9cd7e7..91601556 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.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 JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr */ 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 JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr // 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(); }