Package org.apache.lenya.cms.site

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


    public String getArea() {
        return this.area.getName();
    }
   
    public Link getByUuid(String uuid, String language) throws SiteException {
        Link delegate = this.tree.getByUuid(uuid, language);
        return getLink(delegate);
    }
View Full Code Here


        Link delegate = this.tree.getByUuid(uuid, language);
        return getLink(delegate);
    }

    protected Link getLink(Link delegate) {
        Link link = (Link) this.links.get(delegate);
        if (link == null) {
            link = new DelegatingLink(this.area.getPublication().getFactory(), getNode(delegate.getNode()),
                    delegate.getLabel(), delegate.getLanguage());
        }
        return link;
View Full Code Here

    protected void saveLinks(SiteNode node, NamespaceHelper helper, Element nodeElement)
            throws SiteException {
        String[] languages = node.getLanguages();
        for (int i = 0; i < languages.length; i++) {
            Link link = node.getLink(languages[i]);
            Element linkElement = helper.createElement("label", link.getLabel());
            linkElement.setAttribute("xml:lang", languages[i]);
            nodeElement.appendChild(linkElement);
        }
    }
View Full Code Here

                }
            }
        }
        for (Iterator keys = this.uuidLanguage2link.keySet().iterator(); keys.hasNext();) {
            String key = (String) keys.next();
            Link link = (Link) this.uuidLanguage2link.get(key);
            Assert.isTrue("contains path for [" + key + "]", this.path2node.containsKey(link
                    .getNode().getPath()));
        }

    }
View Full Code Here

        SiteStructure destSite = sourceDoc.getPublication().getArea(destArea).getSite();

        if (sourceDoc.hasLink()) {
            if (destDoc.hasLink()) {
                Link srcLink = sourceDoc.getLink();
                Link destLink = destDoc.getLink();
                destLink.setLabel(srcLink.getLabel());
                destLink.getNode().setVisible(srcLink.getNode().isVisible());
            } else {
                String label = sourceDoc.getLink().getLabel();
                boolean visible = sourceDoc.getLink().getNode().isVisible();
                if (destSite.contains(sourceDoc.getLink().getNode().getPath())) {
                    addToSiteManager(destPath, destDoc, label, visible);
View Full Code Here

            String targetPath) throws PublicationException {

        SiteNode sourceNode = sourceArea.getSite().getNode(sourcePath);
        String[] languages = sourceNode.getLanguages();
        for (int i = 0; i < languages.length; i++) {
            Link sourceLink = sourceNode.getLink(languages[i]);
            String label = sourceLink.getLabel();
            Document sourceDoc = sourceLink.getDocument();
            sourceLink.delete();

            Document targetDoc;
            if (sourceArea.getName().equals(targetArea.getName())) {
                targetDoc = sourceDoc;
            } else {
                targetDoc = addVersion(sourceDoc, targetArea.getName(), sourceDoc.getLanguage());
                copyRevisions(sourceDoc, targetDoc);
                sourceDoc.delete();
            }

            Link link = targetArea.getSite().add(targetPath, targetDoc);
            link.setLabel(label);
            Assert.isTrue("label set", targetDoc.getLink().getLabel().equals(label));
        }
        SiteNode targetNode = targetArea.getSite().getNode(targetPath);
        targetNode.setVisible(sourceNode.isVisible());
    }
View Full Code Here

    }

    protected Link addLink(String lang, String label) {
        Assert.notNull("language", lang);
        Assert.notNull("label", label);
        Link link = addLinkInternal(lang, label);
        changed();
        return link;
    }
View Full Code Here

        Assert.notNull("label", label);
        if (this.language2link.containsKey(lang)) {
            throw new RuntimeException("The language [" + lang + "] is already contained.");
        }
        DocumentFactory factory = getTree().getPublication().getFactory();
        Link link = new SiteTreeLink(factory, this, label, lang);
        this.language2link.put(lang, link);
        getTree().linkAdded(link);
        return link;
    }
View Full Code Here

    public String getArea() {
        return this.area.getName();
    }

    public Link getByUuid(String uuid, String language) throws SiteException {
        Link delegate = getTree().getByUuid(uuid, language);
        return getLink(delegate);
    }
View Full Code Here

        Link delegate = getTree().getByUuid(uuid, language);
        return getLink(delegate);
    }

    protected Link getLink(Link delegate) {
        Link link = (Link) this.links.get(delegate);
        if (link == null) {
            link = new DelegatingLink(this.area.getPublication().getFactory(), getNode(delegate
                    .getNode()), delegate.getLabel(), delegate.getLanguage());
        }
        return link;
View Full Code Here

TOP

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

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.