]> git.mxchange.org Git - jjobs-war.git/commitdiff
init() and @PostConstruct is the wrong place for checking logged-in user status,...
authorRoland Haeder <roland@mxchange.org>
Mon, 15 Feb 2016 19:28:15 +0000 (20:28 +0100)
committerRoland Haeder <roland@mxchange.org>
Mon, 15 Feb 2016 19:28:15 +0000 (20:28 +0100)
lib/addressbook-lib.jar
src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java
src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionController.java

index a8382ba7879a4c436264e18b5fa74f027cb5c495..a63b563001b349091d70b01c7528dc0d637ad2e2 100644 (file)
Binary files a/lib/addressbook-lib.jar and b/lib/addressbook-lib.jar differ
index 307605808c50db772dddba3b6d82f01fa8b6b9e7..988b25ca8dc110ef8c73d9b71852fc53ddca06e5 100644 (file)
@@ -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<ShareableAddressbook> allShares () {
                // Is the user logged in?
index 1be32834e296ca18a2b9e9fa073f3bbdb4c34038..d2a96f5c6f2b7c0d988bb77097a65953a27c478b 100644 (file)
@@ -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.
+        * <p>
+        * @param event
+        */
+       void afterLoginEvent (final UserLoggedInEvent event);
+
        /**
         * Returns a list of all address books the user is sharing with others.
         * <p>