Package org.jboss.dashboard.ui.controller

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


                PanelSecurity.PanelSecurityEntry entry = (PanelSecurity.PanelSecurityEntry) it.next();
                checkMethodSecurity(entry.getMethodName(), entry.getPermissionClass(), entry.getAction(), panel);
            }
        }
        // Invoke the panel's action method.
        CommandResponse res = null;
        if (!isSystemAction(action)) res = fireBeforeInvokeAction(panel, req);
        if (res == null) res = (CommandResponse) method.invoke(this, args);
        if (!isSystemAction(action)) res = fireAfterInvokeAction(panel, req, res);

        // If no AJAX then return the response get from panel invocation.
        String ajaxParam = req.getParameter(Parameters.AJAX_ACTION);
        if (ajaxParam == null || !Boolean.valueOf(ajaxParam).booleanValue()) return res;

        // Despite the request was AJAX the panel has decided refreshing the full screen.
        if (res != null && res.getClass().equals(ShowCurrentScreenResponse.class)) return res;

        // Else return the response wrapped as AJAX.
        PanelAjaxResponse response = PanelAjaxResponse.getEquivalentAjaxResponse(panel, res);
        if (response == null) log.error("Cannot convert response with " + res.getClass() + " to PanelAjaxResponse.");
        return response;
    }
View Full Code Here


    /**
     * Action that dispatches to a factory component.
     */
    public CommandResponse panelActionFactory(final Panel panel, CommandRequest request) throws Exception {
        FactoryRequestHandler requestHandler = (FactoryRequestHandler) Factory.lookup("org.jboss.dashboard.ui.components.FactoryRequestHandler");
        CommandResponse factoryResponse = requestHandler.handleRequest(request);
        String action = request.getRequestObject().getParameter(FactoryURL.PARAMETER_PROPERTY);
        String componentName = request.getRequestObject().getParameter(FactoryURL.PARAMETER_BEAN);
        if (action != null) {
            HandlerFactoryElement handler = (HandlerFactoryElement)Factory.lookup(componentName);
            if (handler != null) action = handler.getActionForShortcut(action);
View Full Code Here

        final boolean useBlanks = BooleanParameter.value(panel.getParameterValue(PARAM_USE_BLANKS), false);
        final ExportResult exportResult = getSessionInfo().getExportResult();

        super.fireAfterRenderPanel(panel,request.getRequestObject(), null);

        return new CommandResponse() {
            public boolean execute(CommandRequest cmdReq) throws Exception {
                HttpServletResponse response = cmdReq.getResponseObject();
                response.setHeader("Content-Disposition", disposition);
                response.setContentType(contentType != null ? contentType : "application/force-download");
                ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
View Full Code Here

        final boolean useBlanks = BooleanParameter.value(panel.getParameterValue(PARAM_USE_BLANKS), false);
        final ExportResult exportResult = getSessionInfo().getExportResult();

        super.fireAfterRenderPanel(panel,request.getRequestObject(), null);

        return new CommandResponse() {
            public boolean execute(CommandRequest cmdReq) throws Exception {
                HttpServletResponse response = cmdReq.getResponseObject();
                response.setHeader("Content-Disposition", disposition);
                response.setContentType(contentType != null ? contentType : "application/force-download");
                ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
View Full Code Here

                PanelSecurity.PanelSecurityEntry entry = (PanelSecurity.PanelSecurityEntry) it.next();
                checkMethodSecurity(entry.getMethodName(), entry.getPermissionClass(), entry.getAction(), panel);
            }
        }
        // Invoke the panel's action method.
        CommandResponse res = null;
        if (!isSystemAction(action)) res = fireBeforeInvokeAction(panel, req);
        if (res == null) res = (CommandResponse) method.invoke(this, args);
        if (!isSystemAction(action)) res = fireAfterInvokeAction(panel, req, res);

        // If no AJAX then return the response get from panel invocation.
        String ajaxParam = req.getParameter(Parameters.AJAX_ACTION);
        if (ajaxParam == null || !Boolean.valueOf(ajaxParam).booleanValue()) return res;

        // Despite the request was AJAX the panel has decided refreshing the full screen.
        if (res != null && res.getClass().equals(ShowCurrentScreenResponse.class)) return res;

        // Else return the response wrapped as AJAX.
        PanelAjaxResponse response = PanelAjaxResponse.getEquivalentAjaxResponse(panel, res);
        if (response == null) log.error("Cannot convert response with " + res.getClass() + " to PanelAjaxResponse.");
        return response;
    }
View Full Code Here

    /**
     * Action that dispatches to a factory component.
     */
    public CommandResponse panelActionFactory(final Panel panel, CommandRequest request) throws Exception {
        BeanDispatcher requestHandler = CDIBeanLocator.getBeanByType(BeanDispatcher.class);
        CommandResponse factoryResponse = requestHandler.handleRequest(request);
        String action = request.getRequestObject().getParameter(FactoryURL.PARAMETER_ACTION);
        String beanName = request.getRequestObject().getParameter(FactoryURL.PARAMETER_BEAN);
        if (action != null) {
            BeanHandler handler = (BeanHandler) CDIBeanLocator.getBeanByNameOrType(beanName);
            if (handler != null) action = handler.getActionForShortcut(action);
View Full Code Here

        // Invoke the component's action and keep track of the execution.
        CodeBlockTrace trace = new HandlerTrace(this, action).begin();
        try {
            String methodName = "action" + action;
            beforeInvokeAction(request, action);
            CommandResponse response = null;
            Method handlerMethod = this.getClass().getMethod(methodName, new Class[]{CommandRequest.class});
            if (log.isDebugEnabled()) log.debug("Invoking method " + methodName + " on " + getBeanName());
            response = (CommandResponse) handlerMethod.invoke(this, new Object[]{request});
            afterInvokeAction(request, action);
View Full Code Here

        String action = null;
        if (tokenizer.hasMoreTokens()) action = tokenizer.nextToken();

        try {
            // Invoke the right action
            CommandResponse cmdResponse = null;
            if ("show".equalsIgnoreCase(action)) {
                cmdResponse = processShowKPI(request, response);
                requestContext.consumeURIPart("/" + action);
            }
            else {
View Full Code Here

        HttpServletRequest request = getHttpRequest();
        String pAction = request.getParameter(Parameters.DISPATCH_ACTION);
        String idPanel = request.getParameter(Parameters.DISPATCH_IDPANEL);
        if (StringUtils.isEmpty(pAction) || StringUtils.isEmpty(idPanel)) {
            log.debug("Running bean action.");
            CommandResponse res = beanDispatcher.handleRequest(getRequest());
            if (request.getServletPath().indexOf("/" + URLMarkupGenerator.COMMAND_RUNNER) != -1) {
                requestContext.consumeURIPart(requestContext.getURIToBeConsumed());
            }
            if (res != null) {
                requestContext.setResponse(res);
            }
            return true;
        }

        // Get the specified panel from the current page.
        Section currentPage = NavigationManager.lookup().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();
                        CommandResponse response = handler.execute(panel, getRequest());
                        if (response != null)
                            requestContext.setResponse(response);
                        if (request.getServletPath().indexOf("/" + URLMarkupGenerator.COMMAND_RUNNER) != -1) {
                            requestContext.consumeURIPart(requestContext.getURIToBeConsumed());
                        }
View Full Code Here

    @Inject
    private NavigationManager navigationManager;

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

TOP

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

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.