From 06ffe03e8df17ebf6063bed855a4c9df77ff6967 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 18 Apr 2016 18:08:12 +0200 Subject: [PATCH] Continued a bit: - added event for added user accounts (by admin) - updated jar(s) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../user/JobsAdminUserWebSessionBean.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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(); } -- 2.39.5