Package org.jboss.dashboard.commons.xml

Examples of org.jboss.dashboard.commons.xml.XMLNode


        currentNode = node;
        return node;
    }

    public Object visitPanel(Panel panel) throws Exception {
        XMLNode node = new XMLNode(PANEL, currentNode);
        node.addAttribute(PANEL_ATTR_ID, panel.getPanelId().toString());
        node.addAttribute(PANEL_ATTR_INSTANCE_ID, panel.getInstance().getInstanceId().toString());
        node.addAttribute(PANEL_ATTR_REGION_ID, panel.getLayoutRegionId());
        node.addAttribute(PANEL_ATTR_POSITION, String.valueOf(panel.getPosition()));
        currentNode.addChild(node);
        currentNode = node;
        return node;
    }
View Full Code Here


        currentNode = node;
        return node;
    }

    public Object visitGraphicElement(GraphicElement resource) throws Exception {
        XMLNode node = new XMLNode(RESOURCE, currentNode);
        node.addAttribute(RESOURCE_ATTR_ID, resource.getId());
        node.addAttribute(RESOURCE_ATTR_CATEGORY, resource.getClass().getName());
        XMLNode rawContentNode = new XMLNode(RAWCONTENT, node);
        rawContentNode.setContent(resource.getZipFile());
        node.addChild(rawContentNode);
        currentNode.addChild(node);
        currentNode = node;
        return node;
    }
View Full Code Here

        currentNode = node;
        return node;
    }

    public Object visitPanelParameter(PanelParameter param) throws Exception {
            XMLNode node = new XMLNode(PARAMETER, currentNode);
            node.addAttribute(PARAMETER_ATTR_NAME, param.getIdParameter());
            node.addAttribute(PARAMETER_ATTR_VALUE, StringUtils.defaultString(param.getValue()));
            node.addAttribute(PARAMETER_ATTR_LANG, param.getLanguage());
            currentNode.addChild(node);
            currentNode = node;
            return node;
    }
View Full Code Here

            currentNode = node;
            return node;
    }

    public Object visitWorkspaceParameter(WorkspaceParameter param) throws Exception {
        XMLNode node = new XMLNode(PARAMETER, currentNode);
        node.addAttribute(PARAMETER_ATTR_NAME, param.getParameterId());
        node.addAttribute(PARAMETER_ATTR_VALUE, param.getValue());
        node.addAttribute(PARAMETER_ATTR_LANG, param.getLanguage());
        currentNode.addChild(node);
        currentNode = node;
        return node;
    }
View Full Code Here

        currentNode = node;
        return node;
    }

    public Object visitPermission(UIPermission perm, Principal relatedPrincipal) throws Exception {
        XMLNode node = new XMLNode(PERMISSION, currentNode);
        node.addAttribute(PERMISSION_ATTR_PERMISSION_CLASS, perm.getClass().getName());
        node.addAttribute(PERMISSION_ATTR_ACTIONS, perm.getActions());
        node.addAttribute(PERMISSION_ATTR_PRINCIPAL_CLASS, perm.getRelatedPrincipal().getClass().getName());
        node.addAttribute(PERMISSION_ATTR_PRINCIPAL, perm.getRelatedPrincipal().getName());
        currentNode.addChild(node);
        currentNode = node;
        return node;
    }
View Full Code Here

            else workspacesManager.addNewWorkspace(workspace);
        }

        //Children
        for (int i = 0; i < node.getChildren().size(); i++) {
            XMLNode child = (XMLNode) node.getChildren().get(i);
            if (ExportVisitor.PARAMETER.equals(child.getObjectName())) {
                createWorkspaceParameter(child, workspace);
            } else if (ExportVisitor.PANEL_INSTANCE.equals(child.getObjectName())) {
                createPanelInstance(result, child, workspace, attributes, onStartup);
            } else if (ExportVisitor.RESOURCE.equals(child.getObjectName())) {
                createResource(result, workspace.getId(), null, null, child, attributes, onStartup);
            } else if (ExportVisitor.SECTION.equals(child.getObjectName())) {
                createSection(result, workspace, child, attributes, onStartup);
            } else if (ExportVisitor.PERMISSION.equals(child.getObjectName())) {
                createPermission(result, workspace, workspace, child, attributes);
            }
        }
        workspacesManager.store(workspace);
        //Save the policy, as probably everybody modified it...
View Full Code Here

        workspace.addSection(section);
        UIServices.lookup().getWorkspacesManager().store(workspace);

        //Children
        for (int i = 0; i < node.getChildren().size(); i++) {
            XMLNode child = (XMLNode) node.getChildren().get(i);
            if (ExportVisitor.PARAMETER.equals(child.getObjectName())) {
                String name = child.getAttributes().getProperty(ExportVisitor.PARAMETER_ATTR_NAME);
                if (ExportVisitor.SECTION_CHILD_TITLE.equals(name)) {
                    String value = child.getAttributes().getProperty(ExportVisitor.PARAMETER_ATTR_VALUE);
                    String lang = child.getAttributes().getProperty(ExportVisitor.PARAMETER_ATTR_LANG);
                    section.setTitle(value, lang);
                }
            } else if (ExportVisitor.RESOURCE.equals(child.getObjectName())) {
                createResource(result, workspace.getId(), section.getId(), null, child, attributes, onStartup);
            } else if (ExportVisitor.PANEL.equals(child.getObjectName())) {
                createPanel(result, section, child, attributes, onStartup);
            } else if (ExportVisitor.PERMISSION.equals(child.getObjectName())) {
                createPermission(result, section.getWorkspace(), section, child, attributes);
            }
        }
    }
View Full Code Here

        // Add panel to section
        section.assignPanel(panel, regionId);
        UIServices.lookup().getSectionsManager().store(section);
        panel.getProvider().getDriver().fireAfterPanelPlacedInRegion(panel, null);
        for (int i = 0; i < node.getChildren().size(); i++) {
            XMLNode child = (XMLNode) node.getChildren().get(i);
            if (ExportVisitor.PERMISSION.equals(child.getObjectName())) {
                createPermission(result, panel.getWorkspace(), panel, child, attributes);
            }
        }
    }
View Full Code Here

        pi.setWorkspace(workspace);
        UIServices.lookup().getPanelsManager().store(pi);
        pi.init();
        //Children
        for (int i = 0; i < node.getChildren().size(); i++) {
            XMLNode child = (XMLNode) node.getChildren().get(i);
            if (ExportVisitor.PARAMETER.equals(child.getObjectName())) {
                createPanelInstanceParameter(child, pi);
            } else if (ExportVisitor.RESOURCE.equals(child.getObjectName())) {
                createResource(result, workspace.getId(), null, pi.getInstanceId(), child, attributes, onStartup);
            } else if (ExportVisitor.RAWCONTENT.equals(child.getObjectName())) {
                if (pi.getProvider().getDriver() instanceof Exportable) {
                    try {
                        ((Exportable) pi.getProvider().getDriver()).importContent(pi, new ByteArrayInputStream(child.getContent()));
                    }
                    catch (Exception e) {
                        result.getWarnings().add("panelFailedToImport");
                        result.getWarningArguments().add(new Object[]{LocaleManager.lookup().localize(pi.getTitle()), e, e.getMessage()});
                    }
View Full Code Here

                    }
            }
        }
        List createResults = new ArrayList();
        for (int i = 0; i < elementsToCreate.size(); i++) {
            XMLNode nodeToCreate = (XMLNode) elementsToCreate.get(i);
            Map attributes = (Map) attributesForCreation.get(i);
            if (ExportVisitor.WORKSPACE.equals(nodeToCreate.getObjectName())
                    ||
                    ExportVisitor.RESOURCE.equals(nodeToCreate.getObjectName())
                    ) {
                CreateResult result = workspaceBuilder.create(nodeToCreate, attributes, onStartup);
                createResults.add(result);
            }
        }
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.commons.xml.XMLNode

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.