From ccecb6c9bc26e900062848923f50360396216274 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 15 Oct 2015 19:22:48 +0200 Subject: [PATCH] Continued: - implemented observer that will update user's address book list - updated jar(s) --- lib/juser-core.jar | Bin 24745 -> 26225 bytes .../beans/addressbook/AddressbookWebBean.java | 36 ++++++++++++++++-- .../addressbook/AddressbookWebController.java | 11 +++++- .../beans/login/UserLoginWebBean.java | 15 +++++++- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/lib/juser-core.jar b/lib/juser-core.jar index 0a7e08ccd541827054c107c421cc7fa41f2604cd..94920473f0bd2dcfee1d99e5be9f16c81e3bd70d 100644 GIT binary patch delta 1663 zcmaKtUrf_i6vyxV{b;rD>mN#?(EeN{YbjYKYn&XjuJwmsisa^n@SaHs(puRcBHPA zOC#yje=dB!_Od5<=*Q?nv=QA|x(D4n{iG0On8M1>4M**E*k#n3#}d(4ylS;9OR!6R zo+o*sx=)|K+z^YLml`sWUFe*0Gjmsm<%bmgKFyex7kcWu^20M$3Tpck=JBEUx0Ry<;{%k`!6J27GwrQmz*JuhFY`7*k7)z1d82({enuh$ zt$w+tQOJ(PAz$g%{`|dJPL;yt@>)38s)KXN5n2mVN+~oN*R4rt)OTzw%2toXSKCvF zo@`J^0Z}Na!A31Pr8vsFEYor6>_xwS68O|GsPPdUse}uL7Fq)f1`l53&4RCG^cG{7 zUu@D8kZ?U?4&?&rL1rO3OR<~gtN-(HXFJ6+eb zQY;OpdK<*~g5P`V7ywJXYRPT(@)F0QY%-{1kuxL7Le&RU`T)K>pd$ATTNJ|4fX$FY zU1EV248Vk(pBsG3f~T`V(^fH4oKnZiyqd`4-G8zipL5M53yc;n_u24GX5WXX4wC_u z?#&_=cob0Z6tCE3if>l;S#hJaPo;O+hAX#oBo&~+&HvlASLmpN@%5;>GpJHv3%nEe z8Uf$m*Ik8LLeM^25g_FJsgrOk*y+M!3*VK%EEK?0$ki&$ApgWN6MJNAAej`eqRTIQ zF@o9-J*rg*YRkj_0Vya9sZ!9ya(qywFM>qK%-dD1OO`iG80`z8z{Mg4cXNmZU%aA( zpzRSLLoraN8ysdktczq6uP)s)KamMR>lEM-D~HQ09+*9tfsYUPHUBaYtxbS`vop8? zE|obD#&;78tI``M-<=GX^TxJS-JjO6RJ3Lx{l{_!`avJz(^G#)m0o&y>V&&^rPaCg zndieS6|F@`pWc#%wb0?QEz8&=s+6pRef@3-N9@?scM+A|gvE##e$5{Lgm=67IQwTn t+b(EMw)4zHyAGWFnd8s?(*I8{8z!{R1$elJ!EFX7agyBygxEqDeFscfz4QP8 delta 1132 zcmaJ=T}V@582-+8=J023x~a46%uN^S{1?kwVNs!y6Q(s}G`G3UWra;KFQSWCcNr`= zz86^}5!6LLU}RlIh0sNim0$>6h!J!VHl?l-3Hsj8ZEz&oc+a!DquVfr7! zDuwVm3Tt7bpI^XMzeJY=kOyqw^lR8|;HF=qI?9cyxDbQQUE%BXT} z7Dd}>3PRKh69L`?%Pb+Y8$NC`D*;I`KyT2*Uk_{0V8!!Znl#;-5(q&%n5jp|y(_1f zwhQN-2}-m*i=D{M + * @param event + */ + void afterLoginEvent (final UserLoggedInEvent event); } diff --git a/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java b/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java index c90b8b7f..a6c78327 100644 --- a/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java @@ -18,6 +18,8 @@ package org.mxchange.addressbook.beans.login; import java.util.Objects; 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; @@ -27,6 +29,8 @@ import javax.naming.NamingException; import org.mxchange.addressbook.beans.user.UserWebController; import org.mxchange.jusercore.container.login.LoginContainer; import org.mxchange.jusercore.container.login.UserLoginContainer; +import org.mxchange.jusercore.events.login.UserLoggedInEvent; +import org.mxchange.jusercore.events.login.UserLoginEvent; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; @@ -59,6 +63,13 @@ public class UserLoginWebBean implements UserLoginWebController { */ private UserLoginSessionBeanRemote loginBean; + /** + * Event fired when user has logged in + */ + @Inject + @Any + private Event loginEvent; + /** * Template type for pages that might be displayed in guest area and login * area. Default is guest area. @@ -110,6 +121,9 @@ public class UserLoginWebBean implements UserLoginWebController { // Set template to "login" this.setTemplateType("login"); //NOI18N + // Fire event away. Keep this last before return statement. + this.loginEvent.fire(new UserLoginEvent(confirmedUser)); + // All fine return "login"; //NOI18N } catch (final UserNotFoundException | UserStatusLockedException | UserStatusUnconfirmedException | UserPasswordMismatchException ex) { @@ -153,7 +167,6 @@ public class UserLoginWebBean implements UserLoginWebController { // Trace message // NOISY: System.out.println(MessageFormat.format("UserLoginWebBean:isUserLoggedIn: this.userLoggedIn={0} - EXIT!", this.userLoggedIn)); - // Return it return this.userLoggedIn; } -- 2.39.5