Package org.jboss.dashboard.ui.controller

Examples of org.jboss.dashboard.ui.controller.RequestContext


        return l;
    }

    public int getDepthLevel() {
        // Section path number cache, to avoid lots of getParent() in the same request...
        RequestContext ctx = RequestContext.getCurrentContext();
        if (ctx == null || ctx.getRequest() == null) {
            return getPathNumber().size() - 1;
        }
        Map sectionsCache = (Map) ctx.getRequest().getRequestObject().getAttribute("sectionsPathNumberCache");
        if (sectionsCache == null)
            ctx.getRequest().getRequestObject().setAttribute("sectionsPathNumberCache", sectionsCache = new HashMap());

        List myPathNumber = (List) sectionsCache.get(this.getDbid());
        if (myPathNumber == null) {
            myPathNumber = getPathNumber();
            sectionsCache.put(this.getDbid(), myPathNumber);
View Full Code Here


        }
        return 0;
    }

    private void clearSectionsCache() {
        RequestContext ctx = RequestContext.getCurrentContext();
        if (ctx != null && ctx.getRequest() != null) {
            ctx.getRequest().getRequestObject().removeAttribute("sectionsPathNumberCache");
        }
    }
View Full Code Here

    public int compareTo(Object obj) {
        if (this == obj) return 0;
        Section section = (Section) obj;
        // Section path number cache, to avoid lots of getParent() in the same request...
        RequestContext ctx = RequestContext.getCurrentContext();
        if (ctx == null || ctx.getRequest() == null) {
            return comparePathNumbers(getPathNumber(), section.getPathNumber());
        }
        Map sectionsCache = (Map) ctx.getRequest().getRequestObject().getAttribute("sectionsPathNumberCache");
        if (sectionsCache == null)
            ctx.getRequest().getRequestObject().setAttribute("sectionsPathNumberCache", sectionsCache = new HashMap());

        List myPathNumber = (List) sectionsCache.get(this.getDbid());
        if (myPathNumber == null) {
            myPathNumber = getPathNumber();
            sectionsCache.put(this.getDbid(), myPathNumber);
View Full Code Here

     * Assume current workspace, section and panel.
     */
    public GraphicElement[] getAvailableElements() {
        Workspace workspace = NavigationManager.lookup().getCurrentWorkspace();
        Section section = NavigationManager.lookup().getCurrentSection();
        RequestContext reqCtx = RequestContext.getCurrentContext();
        Long idPanel = null;
        Panel panel = (Panel) reqCtx.getRequest().getRequestObject().getAttribute(Parameters.RENDER_PANEL);
        if (panel != null && section != null) {
            idPanel = panel.getPanelId();
            if (getElementScopeDescriptor().isAllowedInstance()) {
                idPanel = panel.getInstanceId();
            }
View Full Code Here

        PanelInstance instance = getPanel().getInstance();
        try {
            // IMPORTANT NOTE: make sure HTTP session is initialized before
            // invoking PanelProvider.initSession()
            this.session = session;
            RequestContext reqCtx = RequestContext.getCurrentContext();
            reqCtx.getRequest().getRequestObject().setAttribute(Parameters.RENDER_PANEL, getPanel());
            if (instance != null) instance.getProvider().initSession(this, session);
        } catch (Exception e) {
            String providerStr = "";
            if (instance != null) providerStr = " Provider: " + instance.getProvider().getId();
            log.error("Error initializing panel status: " + getPanel().getPanelId() + providerStr, e);
View Full Code Here

public class SessionComponentsStorage implements ComponentsStorage {
    public static final String ATTR_PREFFIX = "factory://";
    private static ThreadLocal backup = new ThreadLocal();

    public void setComponent(String s, Object o) {
        RequestContext context = RequestContext.getCurrentContext();
        boolean setInRequest = false;
        if (context != null) {
            CommandRequest request = context.getRequest();
            if (request != null) {
                request.getRequestObject().getSession().setAttribute(ATTR_PREFFIX + s, o);
                setInRequest = true;
            }
        }
View Full Code Here

            m.put(ATTR_PREFFIX + s, o);
        }
    }

    public Object getComponent(String s) {
        RequestContext context = RequestContext.getCurrentContext();
        if (context != null) {
            CommandRequest request = context.getRequest();
            if (request != null) {
                // Session components are considered out of a panelSession, thus making dependent
                // panelSession components be looked up outside a panelSession, and making it coherent
                // with panel session components falling back to session when looked up outside a panelSessionCC
                Object currentPanel = request.getRequestObject().getAttribute(Parameters.RENDER_PANEL);
View Full Code Here

            m.clear();
        }
    }

    public Object getSynchronizationObject() {
        RequestContext context = RequestContext.getCurrentContext();
        if (context != null) {
            CommandRequest request = context.getRequest();
            return request.getSessionObject() != null ? request.getSessionObject() : new Object();
        }
        return new Object();
    }
View Full Code Here

        }
    }


    protected HttpSession getSession() {
        RequestContext reqCtx = RequestContext.getCurrentContext();
        if (reqCtx != null) {
            CommandRequest request = reqCtx.getRequest();
            if (request != null) {
                Panel currentPanel = (Panel) request.getRequestObject().getAttribute(Parameters.RENDER_PANEL);
                if (currentPanel != null) {
                    return SessionManager.getPanelSession(currentPanel);
                } else {
View Full Code Here

            log.error("Error: ", e);
        }
    }

    protected void clearRequestCache() {
        RequestContext rqctx = RequestContext.getCurrentContext();
        rqctx.getRequest().getRequestObject().removeAttribute(CURRENT_WORKSPACE_ATTR);
        rqctx.getRequest().getRequestObject().removeAttribute(CURRENT_PAGE_ATTR);
    }
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.ui.controller.RequestContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.