Examples of ShowCurrentScreenResponse


Examples of org.jboss.dashboard.ui.controller.responses.ShowCurrentScreenResponse

     */
    public CommandResponse actionChangeScopeForElement(CommandRequest request) throws Exception {
        String graphicElement = request.getParameter("graphicElement");
        if (graphicElement == null || "".equals(graphicElement)) {
            log.error("Missing required parameter: graphicElement.");
            return new ShowCurrentScreenResponse();
        }
        String graphicElementClassName = graphicElement.substring(0, 1).toUpperCase() + graphicElement.substring(1);
        Class graphicElementClass = Class.forName("org.jboss.dashboard.ui.resources." + graphicElementClassName);
        Method managerGetter = graphicElementClass.getMethod("getManager", new Class[]{});
        GraphicElementManager manager = (GraphicElementManager) managerGetter.invoke(null, new Object[]{});
        FormStatus status = SessionManager.getCurrentFormStatus();
        status.clear();

        String elementId = request.getParameter(graphicElement + "Id");
        String workspaceId = request.getParameter("workspaceId");
        String sectionIdParam = request.getParameter("sectionId");
        String panelIdParam = request.getParameter("panelId");
        log.debug("Changing scope to " + workspaceId + "->" + sectionIdParam + "->" + panelIdParam);
        workspaceId = "".equals(workspaceId) ? null : workspaceId;
        Long sectionId = "".equals(sectionIdParam) || sectionIdParam == null ? null : new Long(sectionIdParam);
        Long panelId = "".equals(panelIdParam) || panelIdParam == null ? null : new Long(panelIdParam);
        if (workspaceId == null) {
            sectionId = null;
            panelId = null;
        }
        if (sectionId == null && manager.getElementScopeDescriptor().isAllowedPanel())
            panelId = null;

        if (elementId != null) {
            final GraphicElement element = manager.getElementByDbid(elementId);
            if (element != null) {
                log.debug("Find " + graphicElement + " with id=" + element.getId() + " and workspace=" + workspaceId + " and section=" + sectionId + " and panel=" + panelId);
                GraphicElement existingElement = manager.getElement(element.getId(), workspaceId, sectionId, panelId);
                if (existingElement != null) {
                    log.warn("Refusing change " + graphicElement + " workspace, as it would match an existing one.");
                    status.addMessage("ui.admin.workarea." + graphicElement + "s.cannotChangeScope");
                } else {
                    element.clearDeploymentFiles();
                    element.setWorkspaceId(workspaceId);
                    element.setSectionId(sectionId);
                    element.setPanelId(panelId);
                    manager.createOrUpdate(element);
                }
            } else {
                log.error(graphicElementClass + " not found, id=" + elementId);
            }
        } else {
            log.error("Not all parameters informed: " + graphicElement + "Id.");
        }
        return new ShowCurrentScreenResponse();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.