Package org.apache.lenya.cms.site

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


     * @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


            if (!doc.existsAreaVersion(Publication.LIVE_AREA)) {
                addErrorMessage("This usecase can only be invoked when the live version exists.");
            } else {
                Document liveDoc = doc.getAreaVersion(Publication.LIVE_AREA);
                NodeSet subSite = SiteUtil.getSubSite(this.manager, liveDoc.getLink().getNode());
                SiteNode node = liveDoc.getLink().getNode();
                subSite.remove(node);

                if (!subSite.isEmpty()) {
                    addErrorMessage("You can't deactivate this document because it has children.");
                }
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

            SiteNode[] children;

            if (this.path.equals("/")) {
                children = this.site.getTopLevelNodes();
            } else {
                SiteNode node = this.site.getNode(this.path);
                children = node.getChildren();
            }

            addNodes(children);
        } catch (PublicationException e) {
            throw new ProcessingException(e);
View Full Code Here

        return null;
    }

    public Link getByUuid(String uuid, String language) throws SiteException {
        String path = getPath(uuid, language);
        SiteNode node = new SimpleSiteNode(this, path, uuid, getLogger());
        return node.getLink(language);
    }
View Full Code Here

    private Map path2node = new WeakHashMap();

    public SiteNode getNode(String path) throws SiteException {

        SiteNode node = (SiteNode) this.path2node.get(path);
        if (node == null) {
            Set keys = doc2path().keySet();
            for (Iterator i = keys.iterator(); i.hasNext();) {
                String key = (String) i.next();
                String value = (String) doc2path().get(key);
View Full Code Here

        return (SiteNode[]) topLevelNodes.toArray(new SiteNode[topLevelNodes.size()]);
    }

    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

    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.