Package org.apache.lenya.cms.site

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


            throw new RuntimeException(e);
        }
    }

    public Link getByUuid(String uuid, String language) throws SiteException {
        SiteNode node = getByUuidInternal(uuid, language);
        if (node == null) {
            throw new SiteException("The link for [" + uuid + ":" + language
                    + "] is not contained!");
        }
        return node.getLink(language);
    }
View Full Code Here


    public Link add(String path, org.apache.lenya.cms.publication.Document doc)
            throws SiteException {

        if (contains(path)) {
            SiteNode node = getNode(path);
            if (node.getLanguages().length > 0 && !node.getUuid().equals(doc.getUUID())) {
                throw new SiteException("Node for path [" + path + "] exists with different UUID!");
            }
        }

        SiteTreeNodeImpl node = addNode(path, doc.getUUID(), true, null, "", false);
        node.addLabel(doc.getLanguage(), "");

        if (node.getLanguages().length == 1) {
            node.setUUID(doc.getUUID());
        }

        return node.getLink(doc.getLanguage());
    }
View Full Code Here

     */
    final public void testAddNodeStringStringLabelArray() throws SiteException {
        String uuid = "12345";
        this.siteTree.addNode("/foo", "tutorial", uuid, true);
        this.siteTree.addLabel("/foo", "en", "Tutorial");
        SiteNode node = this.siteTree.getNode("/foo/tutorial");
        assertNotNull(node);
        assertEquals(node.getName(), "tutorial");
        assertEquals(node.getUuid(), uuid);
    }
View Full Code Here

        return root;
    }

    public boolean contains(String path, String language) {
        if (contains(path)) {
            SiteNode node;
            try {
                node = getNode(path);
            } catch (SiteException e) {
                throw new RuntimeException(e);
            }
            return node.hasLink(language);
        }
        return false;
    }
View Full Code Here

     * @param document The document.
     * @return A link or <code>null</code>.
     * @throws SiteException if an error occurs.
     */
    protected Link getExistingLink(String path, Document document) throws SiteException {
        SiteNode node = document.area().getSite().getNode(path);
        Link link = null;
        String uuid = node.getUuid();
        if (uuid != null) {
            if (node.hasLink(document.getLanguage())) {
                link = node.getLink(document.getLanguage());
            } else if (node.getLanguages().length > 0) {
                link = node.getLink(node.getLanguages()[0]);
            }
        }
        return link;
    }
View Full Code Here

            throws SAXException, SiteException {
        if (path.equals("/") || path.equals("")) {
            SiteNode[] nodes = site.getTopLevelNodes();
            selectNodes(generator, nodes, lang);
        } else if (site.contains(path)) {
            SiteNode node = site.getNode(path);
            SiteNode[] siblings = getSiblings(node);
            for (int i = 0; i < siblings.length; i++) {
                if (siblings[i] == node) {
                    selectSubtree(generator, siblings[i], lang);
                } else {
View Full Code Here

                Document sourceDocument = getSourceDocument();
 
                NodeSet subsite = SiteUtil.getSubSite(this.manager, sourceDocument.getLink().getNode());
                for (NodeIterator i = subsite.iterator(); 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

        else {
            Document doc = getSourceDocument();
            if(doc != null) {
                Document clippedDoc = clipboard.getDocument(getDocumentFactory(), doc.getPublication());
                String uuid = clippedDoc.getUUID();
                SiteNode node = doc.getLink().getNode();
                if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
                    if (willPasteInOwnSubtree(node, uuid)) {
                        addErrorMessage("will-paste-in-own-subtree");
                    }
                }
View Full Code Here

    }

    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

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
     */
    protected Node[] getNodesToLock() throws UsecaseException {
        List nodes = new ArrayList();
        try {       
            SiteNode node = getSourceDocument().getLink().getNode();
            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) {
            throw new UsecaseException(e);
        }
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.