Package org.jboss.dashboard.ui.controller

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


    }

    protected HttpSession getSession() {
        RequestContext reqCtx = RequestContext.lookup();
        if (reqCtx != null) {
            CommandRequest request = reqCtx.getRequest();
            if (request != null) {
                Panel currentPanel = RequestContext.lookup().getActivePanel();
                if (currentPanel != null) {
                    return currentPanel.getPanelSession();
                } else {
                    if (log.isDebugEnabled()) log.debug("Using a PanelScoped bean outside a panel. Will default to SessionScoped.");
                    return request.getSessionObject();
                }
            }
        }
        return null;
    }
View Full Code Here


    private NavigationManager navigationManager;

    public boolean processRequest() throws Exception {
        navigationManager.freezeNavigationStatus();
        CommandResponse cmdResponse = getResponse();
        CommandRequest cmdRequest = getRequest();
        return cmdResponse.execute(cmdRequest);
    }
View Full Code Here

    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;
            }
        }
        if (!setInRequest) {
            Map m = (Map) backup.get();
View Full Code Here

    }

    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);
                request.getRequestObject().removeAttribute(Parameters.RENDER_PANEL);
                Object object = request.getRequestObject().getSession().getAttribute(ATTR_PREFFIX + s);
                request.getRequestObject().setAttribute(Parameters.RENDER_PANEL, currentPanel);
                return object;
            }
        }
        Map m = (Map) backup.get();
        if (m == null) {
View Full Code Here

    }

    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 {
                    if (log.isDebugEnabled())
                        log.debug("Using a panelSession component outside a panel. Will default to session component.");
                    return request.getSessionObject();
                }
            }
        }
        return null;
    }
View Full Code Here

     * Make required processing of request.
     *
     * @return true if processing must continue, false otherwise.
     */
    protected boolean processRequest() throws Exception {
        CommandRequest request = RequestContext.getCurrentContext().getRequest();
        String pAction = request.getRequestObject().getParameter(Parameters.DISPATCH_ACTION);
        String idPanel = request.getRequestObject().getParameter(Parameters.DISPATCH_IDPANEL);
        if (StringUtils.isEmpty(pAction) || StringUtils.isEmpty(idPanel)) {
            log.debug("Running pure factory action.");
            CommandResponse response = factoryRequestHandler.handleRequest(request);
            if (getRequest().getServletPath().indexOf("/" + URLMarkupGenerator.COMMAND_RUNNER) != -1) {
                getControllerStatus().consumeURIPart(getControllerStatus().getURIToBeConsumed());
            }
            if (response != null) {
                getControllerStatus().setResponse(response);
            }
            return true;
        }

        // Get the specified panel from the current page.
        Section currentPage = getNavigationManager().getCurrentSection();
        Panel panel = currentPage.getPanel(idPanel);
        if (panel == null) {
            // If not found then try to get the panel from wherever the request comes from.
            panel = UIServices.lookup().getPanelsManager().getPaneltById(new Long(idPanel));
            if (panel == null) {
                log.error("Cannot dispatch to panel " + idPanel + ". Panel not found.");
                return true;
            }
            // Ensure the panel's section is set as current.
            // This is needed to support requests coming from pages reached after clicking the browser's back button.
            NavigationManager.lookup().setCurrentSection(panel.getSection());
        }

        CodeBlockTrace trace = new PanelActionTrace(panel, pAction).begin();
        try {
            WorkspacePermission workspacePerm = WorkspacePermission.newInstance(panel.getWorkspace(), WorkspacePermission.ACTION_LOGIN);
            if (UserStatus.lookup().hasPermission(workspacePerm)) {
                SectionPermission sectionPerm = SectionPermission.newInstance(panel.getSection(), SectionPermission.ACTION_VIEW);
                if (UserStatus.lookup().hasPermission(sectionPerm)) {
                    PanelProvider provider = panel.getInstance().getProvider();
                    if (provider.isEnabled()) {
                        PanelDriver handler = provider.getDriver();
                        request.getRequestObject().setAttribute(Parameters.RENDER_PANEL, panel);
                        CommandResponse response = handler.execute(panel, request);
                        request.getRequestObject().removeAttribute(Parameters.RENDER_PANEL);
                        if (response != null)
                            getControllerStatus().setResponse(response);
                        if (getRequest().getServletPath().indexOf("/" + URLMarkupGenerator.COMMAND_RUNNER) != -1) {
                            getControllerStatus().consumeURIPart(getControllerStatus().getURIToBeConsumed());
                        }
View Full Code Here

    protected boolean processRequest() throws Exception {
        NavigationManager navigationManager = NavigationManager.lookup();
        navigationManager.freezeNavigationStatus();
        final CommandResponse cmdResponse = getControllerStatus().getResponse();
        final CommandRequest cmdRequest = RequestContext.getCurrentContext().getRequest();
        return cmdResponse.execute(cmdRequest);
    }
View Full Code Here

        return null;
    }

    protected Panel getPanel() {
        RequestContext reqCtx = RequestContext.getCurrentContext();
        CommandRequest request = reqCtx.getRequest();
        return (Panel) request.getRequestObject().getAttribute(Parameters.RENDER_PANEL);
    }
View Full Code Here

        return null;
    }

    protected Panel getPanel() {
        RequestContext reqCtx = RequestContext.getCurrentContext();
        CommandRequest request = reqCtx.getRequest();
        return (Panel) request.getRequestObject().getAttribute(Parameters.RENDER_PANEL);
    }
View Full Code Here

TOP

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

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.