Package org.jboss.dashboard.commons.xml

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


        // 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

    private XMLNode rootNode;
    private XMLNode currentNode;

    public ExportVisitor() {
        rootNode = new XMLNode(WORKSPACE_EXPORT, null);
        currentNode = rootNode;
    }
View Full Code Here

    public XMLNode getRootNode() {
        return rootNode;
    }

    public Object visitWorkspace(Workspace p) throws Exception {
        XMLNode node = new XMLNode(WORKSPACE, currentNode);
        node.addAttribute(WORKSPACE_ATTR_ID, p.getId());
        node.addAttribute(WORKSPACE_ATTR_SKIN_ID, p.getSkinId());
        node.addAttribute(WORKSPACE_ATTR_ENVELOPE_ID, p.getEnvelopeId());
        if (p.getFriendlyUrl() != null) node.addAttribute(WORKSPACE_ATTR_FR_URL, p.getFriendlyUrl());
        node.addAttribute(WORKSPACE_ATTR_HOME_MODE, String.valueOf(p.getHomeSearchMode()));
        currentNode.addChild(node);
        currentNode = node;
        return node;
    }
View Full Code Here

        currentNode = node;
        return node;
    }

    public Object visitSection(Section section) throws Exception {
        XMLNode node = new XMLNode(SECTION, currentNode);
        node.addAttribute(SECTION_ATTR_ID, section.getId().toString());
        node.addAttribute(SECTION_ATTR_ID_TEMPLATE, section.getLayoutId());
        node.addAttribute(SECTION_ATTR_POSITION, String.valueOf(section.getPosition()));
        node.addAttribute(SECTION_ATTR_VISIBLE, section.isVisible().toString());
        node.addAttribute(SECTION_ATTR_REGIONSPACING, section.getRegionsCellSpacing().toString());
        node.addAttribute(SECTION_ATTR_PANELSPACING, section.getPanelsCellSpacing().toString());
        if (section.getParentSectionId() != null)
            node.addAttribute(SECTION_ATTR_PARENT_ID, section.getParentSectionId().toString());
        node.addAttribute(SECTION_ATTR_FR_URL, section.getFriendlyUrl());
        node.addAttribute(SECTION_ATTR_SKIN_ID, section.getSkinId());
        node.addAttribute(SECTION_ATTR_ENVELOPE_ID, section.getEnvelopeId());
        Map title = section.getTitle();
        for (Iterator it = title.keySet().iterator(); it.hasNext();) {
            String lang = (String) it.next();
            String value = (String) title.get(lang);
            XMLNode titleNode = new XMLNode(PARAMETER, node);
            titleNode.addAttribute(PARAMETER_ATTR_NAME, SECTION_CHILD_TITLE);
            titleNode.addAttribute(PARAMETER_ATTR_VALUE, value);
            titleNode.addAttribute(PARAMETER_ATTR_LANG, lang);
            node.addChild(titleNode);
        }
        currentNode.addChild(node);
        currentNode = node;
        return node;
View Full Code Here

        renderFragment("entryEnd");
        return !result.hasErrors();
    }

    protected void renderElementsInEntry(ImportResult result, int index) {
        XMLNode node = result.getRootNode();
        List children = node.getChildren();
        if (children == null || children.isEmpty()) {
            renderFragment("emptyEntry");
        } else {
            renderFragment("entryElementsOutputStart");
            BackOfficePermission createPerm = BackOfficePermission.newInstance(null, BackOfficePermission.ACTION_CREATE_WORKSPACE);
            boolean canCreate = UserStatus.lookup().hasPermission(createPerm);
            for (int j = 0; j < children.size(); j++) {
                XMLNode childNode = (XMLNode) children.get(j);
                setAttribute("inputName", ExportDriver.IMPORT_PREFFIX + index + " " + j);
                if (childNode.getObjectName().equals(ExportVisitor.WORKSPACE)) {
                    if (canCreate) {
                        setAttribute("entryElementName", childNode.getAttributes().getProperty("id"));
                        renderFragment("workspaceEntryElement");
                    }
                } else if (childNode.getObjectName().equals(ExportVisitor.RESOURCE)) {
                    setAttribute("entryElementName", childNode.getAttributes().getProperty("id"));
                    renderFragment("resourceEntryElement");
                } else {
                    setAttribute("entryElementName", childNode.getObjectName());
                    renderFragment("entryElement");
                }
            }
            renderFragment("entryElementsOutputEnd");
        }
View Full Code Here

    private XMLNode rootNode;
    private XMLNode currentNode;

    public ExportVisitor() {
        rootNode = new XMLNode(WORKSPACE_EXPORT, null);
        currentNode = rootNode;
    }
View Full Code Here

    public XMLNode getRootNode() {
        return rootNode;
    }

    public Object visitWorkspace(Workspace p) throws Exception {
        XMLNode node = new XMLNode(WORKSPACE, currentNode);
        node.addAttribute(WORKSPACE_ATTR_ID, p.getId());
        node.addAttribute(WORKSPACE_ATTR_SKIN_ID, p.getSkinId());
        node.addAttribute(WORKSPACE_ATTR_ENVELOPE_ID, p.getEnvelopeId());
        if (p.getFriendlyUrl() != null) node.addAttribute(WORKSPACE_ATTR_FR_URL, p.getFriendlyUrl());
        node.addAttribute(WORKSPACE_ATTR_HOME_MODE, String.valueOf(p.getHomeSearchMode()));
        currentNode.addChild(node);
        currentNode = node;
        return node;
    }
View Full Code Here

        currentNode = node;
        return node;
    }

    public Object visitSection(Section section) throws Exception {
        XMLNode node = new XMLNode(SECTION, currentNode);
        node.addAttribute(SECTION_ATTR_ID, section.getId().toString());
        node.addAttribute(SECTION_ATTR_ID_TEMPLATE, section.getLayoutId());
        node.addAttribute(SECTION_ATTR_POSITION, String.valueOf(section.getPosition()));
        node.addAttribute(SECTION_ATTR_VISIBLE, section.isVisible().toString());
        node.addAttribute(SECTION_ATTR_REGIONSPACING, section.getRegionsCellSpacing().toString());
        node.addAttribute(SECTION_ATTR_PANELSPACING, section.getPanelsCellSpacing().toString());
        if (section.getParentSectionId() != null)
            node.addAttribute(SECTION_ATTR_PARENT_ID, section.getParentSectionId().toString());
        node.addAttribute(SECTION_ATTR_FR_URL, section.getFriendlyUrl());
        node.addAttribute(SECTION_ATTR_SKIN_ID, section.getSkinId());
        node.addAttribute(SECTION_ATTR_ENVELOPE_ID, section.getEnvelopeId());
        Map title = section.getTitle();
        for (Iterator it = title.keySet().iterator(); it.hasNext();) {
            String lang = (String) it.next();
            String value = (String) title.get(lang);
            XMLNode titleNode = new XMLNode(PARAMETER, node);
            titleNode.addAttribute(PARAMETER_ATTR_NAME, SECTION_CHILD_TITLE);
            titleNode.addAttribute(PARAMETER_ATTR_VALUE, value);
            titleNode.addAttribute(PARAMETER_ATTR_LANG, lang);
            node.addChild(titleNode);
        }
        currentNode.addChild(node);
        currentNode = node;
        return node;
View Full Code Here

        currentNode = node;
        return node;
    }

    public Object visitPanelInstance(PanelInstance instance) throws Exception {
        XMLNode node = new XMLNode(PANEL_INSTANCE, currentNode);
        node.addAttribute(PANELINSTANCE_ATTR_ID, instance.getInstanceId().toString());
        node.addAttribute(PANELINSTANCE_ATTR_SERIALIZATION, instance.getPersistence() == null ? "" : instance.getPersistence());
        node.addAttribute(PANELINSTANCE_ATTR_PROVIDER, instance.getProviderName());
        if (instance.getProvider().getDriver() instanceof Exportable) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ((Exportable) instance.getProvider().getDriver()).exportContent(instance, bos);
            byte[] content = bos.toByteArray();
            XMLNode contentNode = new XMLNode(RAWCONTENT, node);
            contentNode.setContent(content);
            node.addChild(contentNode);
        }
        currentNode.addChild(node);
        currentNode = node;
        return node;
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.