Package org.apache.lenya.cms.site

Examples of org.apache.lenya.cms.site.SiteNode


    }

    protected void doExecute() throws Exception {
        super.doExecute();
        Document doc = getSourceDocument();
        SiteNode node = doc.getLink().getNode();
        node.setVisible(!node.isVisible());

        String[] languages = doc.getLanguages();
        for (int i = 0; i < languages.length; i++) {
            Document version = doc.getTranslation(languages[i]);
            WorkflowUtil.invoke(this.manager, getSession(), getLogger(), version, getEvent());
View Full Code Here


                newDoc = docManager.add(area.getPublication().getFactory(), resourceType,
                        contentUri, area.getPublication(), area.getName(), path, language, "xml",
                        navigationTitle, visibleInNav);
                newDoc.setMimeType(mimeType);
            } else {
                SiteNode node = site.getNode(path);
                Document doc = node.getLink(node.getLanguages()[0]).getDocument();
                newDoc = docManager.addVersion(doc, area.getName(), language, true);
                resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
                SourceUtil.copy(resolver, contentUri, newDoc.getOutputStream());
                newDoc.getLink().setLabel(navigationTitle);
            }
View Full Code Here

                Document sourceDocument = getSourceDocument();
 
                NodeSet subsite = SiteUtil.getSubSite(this.manager, sourceDocument.getLink().getNode());
                for (NodeIterator i = subsite.ascending(); i.hasNext();) {
                    SiteNode node = i.next();
                    String[] languages = node.getLanguages();
                    for (int l = 0; l < languages.length; l++) {
                        Document doc = node.getLink(languages[l]).getDocument();
                        nodes.add(doc.getRepositoryNode());
                    }
                }
            }
        } catch (Exception e) {
View Full Code Here

        doTestCopyToArea(docManager, path2, sourceAreaName, destAreaName);
        doTestCopyToArea(docManager, path1, sourceAreaName, destAreaName);

        List sourceNodes = Arrays.asList(sourceArea.getNodes());

        SiteNode authoringNode1 = sourceArea.getNode(path1);
        assertTrue(sourceNodes.contains(authoringNode1));
        int sourcePos1 = sourceNodes.indexOf(authoringNode1);

        SiteNode sourceNode2 = sourceArea.getNode(path2);
        int sourcePos2 = sourceNodes.indexOf(sourceNode2);

        assertTrue(sourcePos1 < sourcePos2);

        assertTrue(destArea.contains(path1));
        List liveNodes = Arrays.asList(destArea.getNodes());
        SiteNode liveNode1 = destArea.getNode(path1);
        assertTrue(liveNodes.contains(liveNode1));
        int livePos1 = liveNodes.indexOf(liveNode1);

        SiteNode liveNode2 = destArea.getNode(path2);
        int livePos2 = liveNodes.indexOf(liveNode2);

        assertTrue(livePos1 < livePos2);
    }
View Full Code Here

            throws SiteException, DocumentException, PublicationException {
        DocumentFactory factory = getFactory();
        Publication pub = factory.getPublication("test");
        Area authoring = pub.getArea("authoring");

        SiteNode sourceNode = authoring.getSite().getNode(sourcePath);
       
        NodeSet nodes = SiteUtil.getSubSite(getManager(), sourceNode);
        Document[] docs = nodes.getDocuments();
        Map doc2path = new HashMap();

        String sourceBase = sourcePath.substring(0, sourcePath.lastIndexOf("/"));
        String targetBase = targetPath.substring(0, targetPath.lastIndexOf("/"));

        for (int i = 0; i < docs.length; i++) {
            doc2path.put(docs[i], docs[i].getPath().substring(sourceBase.length()));
        }

        docManager.copyAll(authoring, sourcePath, authoring, targetPath);
        for (int i = 0; i < docs.length; i++) {
            assertTrue(docs[i].hasLink());
            String oldPath = (String) doc2path.get(docs[i]);
            String newPath = targetBase + oldPath;
            assertTrue(authoring.getSite().contains(newPath));
            SiteNode newNode = authoring.getSite().getNode(newPath);
            Document newDoc = newNode.getLink(docs[i].getLanguage()).getDocument();
            assertEquals(newDoc.getContentLength(), docs[i].getContentLength());
            assertFalse(newDoc.getUUID().equals(docs[i].getUUID()));
        }
       
        String[] sourceNames = getChildNames(sourceNode);
        SiteNode targetNode = authoring.getSite().getNode(targetPath);
        String[] targetNames = getChildNames(targetNode);
        assertEquals(StringUtil.join(sourceNames, ","), StringUtil.join(targetNames, ","));
    }
View Full Code Here

            throws SiteException, DocumentException, PublicationException {
        DocumentFactory factory = getFactory();
        Publication pub = factory.getPublication("test");
        Area authoring = pub.getArea("authoring");

        SiteNode sourceNode = authoring.getSite().getNode(sourcePath);
        String[] sourceNames = getChildNames(sourceNode);

        NodeSet nodes = SiteUtil.getSubSite(getManager(), sourceNode);
        Document[] docs = nodes.getDocuments();
        Map doc2path = new HashMap();

        String sourceBase = sourcePath.substring(0, sourcePath.lastIndexOf("/"));
        String targetBase = targetPath.substring(0, targetPath.lastIndexOf("/"));

        for (int i = 0; i < docs.length; i++) {
            doc2path.put(docs[i], docs[i].getPath().substring(sourceBase.length()));
        }

        docManager.moveAll(authoring, sourcePath, authoring, targetPath);
        for (int i = 0; i < docs.length; i++) {
            assertTrue(docs[i].hasLink());
            String oldPath = (String) doc2path.get(docs[i]);
            String newPath = docs[i].getPath();
            assertEquals(targetBase + oldPath, newPath);
        }
       
        SiteNode targetNode = authoring.getSite().getNode(targetPath);
        String[] targetNames = getChildNames(targetNode);
        assertEquals(StringUtil.join(sourceNames, ","), StringUtil.join(targetNames, ","));
       
    }
View Full Code Here

        Session session = login("lenya");

        Publication pub = getPublication(session, "test");
        SiteStructure site = pub.getArea("authoring").getSite();
       
        SiteNode sourceNode = site.getNode("/tutorial");
        SiteNode destNode = site.getNode("/concepts");
       
        Document sourceDoc = sourceNode.getLink(sourceNode.getLanguages()[0]).getDocument();
        Document destDoc = destNode.getLink(destNode.getLanguages()[0]).getDocument();

        sourceDoc.getRepositoryNode().lock();

        DocumentManager docMgr = null;
        try {
View Full Code Here

    protected void removeChild(String name) {
        Assert.notNull("name", name);
        if (!this.name2child.containsKey(name)) {
            throw new RuntimeException("The node [" + name + "] is not contained!");
        }
        SiteNode node = (SiteNode) this.name2child.get(name);
        this.name2child.remove(node.getName());
        this.children.remove(node);
        getTree().nodeRemoved(getPath() + "/" + name);
        deleteIfEmpty();
    }
View Full Code Here

    }

    public SiteNode addChild(String name, String followingNodeName, boolean visible) {
        Assert.notNull("name", name);
        Assert.notNull("following node name", followingNodeName);
        SiteNode followingSibling = getChild(followingNodeName);
        int pos = this.children.indexOf(followingSibling);
        return addChild(name, pos, visible);
    }
View Full Code Here

        if (this.name2child.containsKey(name)) {
            throw new RuntimeException("The child [" + name + "] is already contained.");
        }

        SiteNode node = new TreeNodeImpl(this, name, visible, getLogger());
        this.children.add(pos, node);
        this.name2child.put(name, node);
        getTree().nodeAdded(node);
        getTree().changed();
        return node;
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.site.SiteNode

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.