From ba3852417436a0684edf9a0268f06f6253b4a773 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 15 Feb 2016 20:28:15 +0100 Subject: [PATCH] init() and @PostConstruct is the wrong place for checking logged-in user status, better use the new event --- lib/addressbook-lib.jar | Bin 51640 -> 52636 bytes .../beans/shares/SharesWebSessionBean.java | 16 ++++++++++++++++ .../shares/SharesWebSessionController.java | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/lib/addressbook-lib.jar b/lib/addressbook-lib.jar index a8382ba7879a4c436264e18b5fa74f027cb5c495..a63b563001b349091d70b01c7528dc0d637ad2e2 100644 GIT binary patch delta 4283 zcmbtXX;4&G7XIGrreD+jWN8pY8vy~8rMnSClx19^i6|imP6&ykX`sVm(;$l>qfX0c zbfSq0HyIO^s05<~lPD^S$l?}_GfvDT`7xEmajH_Y#l)Fp%9^RlGUwiAN%JFBQ}e3s zJMVn=oYUui=e&1s_cG0)gBmq&rABK2^uV3AW;Jfor)`fcU;OHuJ8A&bG%v}O<~275 z`==#aDqQuBT9@5vDNagl?u?c%wKd<0u9a&Sa?zn($;Ex` zaxND6EaT!6DS>Uh?*D`35O~ukna@eOG%nJ0NnAK}SzL7LvPqn|uX9UWKCN%pa2c+C zE_8!mfDhNrK~sgCKjn{Fu7`zNgj^oAP}n~glP%^yjN2ygBI`nh+Z{;#D1^%mIrRen zOP+5q*S{+LM<|z{Z9Xmh_ix><<9hf`y|A0LyGP~vo&9@7+zqWIK7p60Ci&YBw|;2? z_{d^MB{MBI#(m?v^Mh2V6nyB5d8pT;LBU1?o<^e)7CfWi=Xz{1K!?pnY{4(|a2v4| zO?v#&fN9vKV7ngA8sLY`zSx1Cdi=_O=dg=O+mXJ z#}vG-;JAVldUO~t2X83oG+-__KdInN1#d}EOY9}(j?#j9dwoNl1pk~$`$oHs-F>Yq z-``nXR_3T(;;_4Ns!Qxn2@7+oYs+j^jV0xFSDC|BSyEl=a5y|>wqmlYvpKmX-MObN z$2&j<`{&{5DJlPZ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q+4G}%9bT68pfI5w2|T@%hv6FMb| z&@2{sP1r?T)8s9&qLnY~if3QPn)_#t(oAon=)MahZ0wKM^<4kaklA^M%EU*WPXKu- z!g%iW6rN|zbxqzoP9XQj4Q2PP3wK`=TAWMh7?#l+Eq1Yc(}r8e9RMFWK7@Z_HN6Ws z*PnYe`Th#QMIQpoC=Pk1rA|dQ$k|kWK5~6nKHJ>4a5&F_)7|`yChx8h=+@d$mU2VS z?6>EtSJu;VKIZsP4B0`(QEahMVT*SpvTtvST)J*(^6=fF$+sMcW}!C)`NU5(`FDo| zI^wXKMcmX+gZp0w{)J9v`j-H4ZT0gv))v?IeJ8O4#yhQAGOjdKt!oI(0<+)pLX~y`AqVwIXy*-iULd**<@kRdw;Zbl% diff --git a/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java index 30760580..988b25ca 100644 --- a/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java @@ -39,6 +39,7 @@ import org.mxchange.addressbook.exceptions.UserAlreadySharingAddressbookExceptio import org.mxchange.addressbook.model.addressbook.Addressbook; import org.mxchange.addressbook.model.addressbook.shared.ShareableAddressbook; import org.mxchange.addressbook.model.shared.SharedAddressbooksSessionBeanRemote; +import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; @@ -153,6 +154,21 @@ public class SharesWebSessionBean implements SharesWebSessionController { this.sharedAddressbooks.add(event.getShareableAddressbook()); } + @Override + public void afterLoginEvent (final @Observes UserLoggedInEvent event) { + // Is the user logged in? + if (null == event) { + // Is null + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getUser() == null) { + // user is null + throw new NullPointerException("event.user is null"); //NOI18N + } + + // Init share list + this.sharedAddressbooks = this.shareBean.allSharedAddressbooks(event.getUser()); + } + @Override public List allShares () { // Is the user logged in? diff --git a/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionController.java b/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionController.java index 1be32834..d2a96f5c 100644 --- a/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionController.java @@ -21,6 +21,7 @@ import java.util.List; import org.mxchange.addressbook.events.sharing.AddressbookSharingEvent; import org.mxchange.addressbook.model.addressbook.Addressbook; import org.mxchange.addressbook.model.addressbook.shared.ShareableAddressbook; +import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.model.user.User; /** @@ -44,6 +45,14 @@ public interface SharesWebSessionController extends Serializable { */ void afterAdressbookShareStarted (final AddressbookSharingEvent event); + /** + * This method is called when a user has successfully logged in his/her + * account. + *

+ * @param event + */ + void afterLoginEvent (final UserLoggedInEvent event); + /** * Returns a list of all address books the user is sharing with others. *

-- 2.39.5