Example usage for com.vaadin.server VaadinSession getCurrent

List of usage examples for com.vaadin.server VaadinSession getCurrent

Introduction

In this page you can find the example usage for com.vaadin.server VaadinSession getCurrent.

Prototype

public static VaadinSession getCurrent() 

Source Link

Document

Gets the currently used session.

Usage

From source file:com.hybridbpm.ui.HybridbpmUI.java

License:Apache License

public static AccessAPI getAccessAPI() {
    return AccessAPI.get(getCurrent().user, VaadinSession.getCurrent().getSession().getId());
}

From source file:com.hybridbpm.ui.HybridbpmUI.java

License:Apache License

public static SystemAPI getSystemAPI() {
    return SystemAPI.get(getCurrent().user, VaadinSession.getCurrent().getSession().getId());
}

From source file:com.hybridbpm.ui.HybridbpmUI.java

License:Apache License

public static BpmAPI getBpmAPI() {
    return BpmAPI.get(getCurrent().user, VaadinSession.getCurrent().getSession().getId());
}

From source file:com.hybridbpm.ui.HybridbpmUI.java

License:Apache License

public static CrudAPI getCrudAPI() {
    return CrudAPI.get(getCurrent().user, VaadinSession.getCurrent().getSession().getId());
}

From source file:com.hybridbpm.ui.HybridbpmUI.java

License:Apache License

public void logout() {
    HazelcastServer.removeDashboardNotificationEventTopic(user.getId().toString(), notificationListenerId);
    HazelcastServer.getDashboardEventTopic().removeMessageListener(dashboardListenerId);
    user = null;//from w w w  . j  av a 2  s  .  c om
    CookieManager.setCookie(COOKIENAME_USERNAME, null, VaadinService.getCurrentRequest().getContextPath());
    VaadinSession.getCurrent().close();
    getUI().getPage().setLocation(VaadinService.getCurrentRequest().getContextPath());
    VaadinService.getCurrentRequest().getWrappedSession().invalidate();
}

From source file:com.hybridbpm.ui.util.DashBoardMessageListener.java

License:Apache License

@Override
public void onMessage(final Message<DashboardEvent> message) {
    try {/*from  w w w.  ja v  a  2  s .co m*/
        hybridbpmUI.access(new Runnable() {
            @Override
            public void run() {
                DashboardEvent event = message.getMessageObject();
                if (!VaadinSession.getCurrent().getSession().getId().equals(event.getSessionId())) { // if changes from another session
                    switch (event.getType()) {
                    case VIEW_CHANGED:
                        if (hybridbpmUI.getNavigator().getState().equals(event.getViewUrl())) {
                            hybridbpmUI.buildMenu(event.getViewUrl(), true,
                                    hybridbpmUI.getNavigator().getState());
                        } else {
                            hybridbpmUI.buildMenu(null, false, hybridbpmUI.getNavigator().getState());
                        }
                        break;
                    case VIEW_DELETED:
                        if (hybridbpmUI.getNavigator().getState().equals(event.getViewUrl())) {
                            hybridbpmUI.buildMenu(null, true, hybridbpmUI.getNavigator().getState());
                        } else {
                            hybridbpmUI.buildMenu(null, false, hybridbpmUI.getNavigator().getState());
                        }
                        break;
                    }
                } else { // if changes from this session
                    switch (event.getType()) {
                    case VIEW_CHANGED:
                        hybridbpmUI.buildMenu(event.getViewUrl(), true, null);
                        break;
                    case VIEW_DELETED:
                        if (hybridbpmUI.getNavigator().getState().equals(event.getViewUrl())) {
                            hybridbpmUI.buildMenu(null, true, null);
                        }
                        break;
                    }
                }
                hybridbpmUI.push();
            }
        });
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
    }
}

From source file:com.klwork.explorer.web.MyNavigationUI.java

License:Apache License

@Override
protected void init(final VaadinRequest request) {
    VaadinSession.getCurrent().setErrorHandler(this);
    setSizeFull();/*ww w  .j  a v  a  2s.  c  o  m*/

    ShiroSecurityNavigator navigator = new ShiroSecurityNavigator(this, this);
}

From source file:com.klwork.explorer.web.VaadinMessageSource.java

License:Apache License

public String getMessage(String code) {
    Locale locale = VaadinSession.getCurrent().getLocale();
    return messageSource.getMessage(code, null, locale);
}

From source file:com.klwork.explorer.web.VaadinMessageSource.java

License:Apache License

public String getMessage(String code, String defaultMessage) {
    Locale locale = VaadinSession.getCurrent().getLocale();
    return messageSource.getMessage(code, null, defaultMessage, locale);
}

From source file:com.klwork.explorer.web.VaadinMessageSource.java

License:Apache License

public String getMessage(String code, Object[] args) {
    Locale locale = VaadinSession.getCurrent().getLocale();
    return messageSource.getMessage(code, args, locale);
}