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;
this.shareeUserId = shareeUserId;
}
- @PostConstruct
- public void init () {
- // Check conditions
- if (!this.loginController.isUserLoggedIn()) {
- // No, then throw exception
- throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
+ @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(this.loginController.getLoggedInUser());
+ this.sharedAddressbooks = this.shareBean.allSharedAddressbooks(event.getUser());
+ }
+
+ @PostConstruct
+ public void init () {
}
@Override
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;
/**
* @return Redirect target
*/
String startSharing (final User user, final Addressbook addressbook);
+
+ /**
+ * This method is called when a user has successfully logged in his/her
+ * account.
+ * <p>
+ * @param event
+ */
+ void afterLoginEvent (final UserLoggedInEvent event);
}