* @return the {@link BaseAction} called once the application is loaded. It is the only chain action called at this
* time, it retrieves current logged user and shows default screen.
*/
public static BaseAction<?> get()
{
final BaseUser previousLoggedUser = DkMain.model().getUserLogged();
// first retrieve the current logged user on server side
final BaseAction<BaseUser> actionLoadCurrentLoggedUser = new BaseAction<BaseUser>("")
{
@Override
protected void run()
{
DkMain.controller().baseRpcUser().getCurrentUser(new BaseAsyncCallback<BaseUser>(this, true)
{
@Override
public void processSuccess(final BaseUser result)
{
BaseLogger.getLog(BaseOnApplicationLoadedAction.class).debug("setUserLogged(" + result + ")");
DkMain.model().setUserLogged(result);
}
});
}
};
// create different action according to the current logged user.
actionLoadCurrentLoggedUser.setLastChainActionCreator(new ChainActionCreator()
{
@Override
public BaseAction<?> getCreatedActions()
{
final BaseUser loggedUser = DkMain.model().getUserLogged();
BaseAction<?> chainAction = null;
if (loggedUser != null)
{
chainAction = BaseAfterConnectAction.get(previousLoggedUser, null);
}