Package org.apache.lenya.cms.site

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


    }

    protected String getPath(DocumentFactory factory, Publication pub, String area, String uuid,
            String language) throws SiteException {
        SiteTree tree = getTree(factory, pub, area);
        SiteNode node = tree.getByUuid(uuid, language).getNode();
        if (node == null) {
            throw new SiteException("No node found for [" + pub.getId() + ":" + area + ":" + uuid
                    + ":" + language + "]");
        }
        return node.getPath();
    }
View Full Code Here


    }

    protected String getUUID(DocumentFactory factory, Publication pub, String area, String path)
            throws SiteException {
        SiteTree tree = getTree(factory, pub, area);
        SiteNode node = tree.getNode(path);
        if (node == null) {
            throw new SiteException("No node found for [" + pub.getId() + ":" + area + ":" + path
                    + "]");
        }
        return node.getUuid();
    }
View Full Code Here

        } catch (PublicationException e) {
            throw new SiteException(e);
        }
        SiteTree tree = getTree(factory, pub, locator.getArea());
        if (tree.contains(locator.getPath())) {
            SiteNode node = tree.getNode(locator.getPath());
            return node.hasLink(locator.getLanguage());
        } else {
            return false;
        }
    }
View Full Code Here

    }

    protected Document[] getResourceDocuments() throws DocumentException, SiteException {
        List list = new ArrayList();
        Document[] docs = getSourceDocument().area().getDocuments();
        SiteNode node = getSourceDocument().getLink().getNode();
        for (int i = 0; i < docs.length; i++) {
            if (docs[i].hasLink() && !docs[i].getLink().getNode().isTopLevel()
                    && docs[i].getLink().getNode().getParent().getPath().equals(node.getPath())
                    && docs[i].getResourceType().getName().equals("resource")) {
                list.add(docs[i]);
            }
        }
        return (Document[]) list.toArray(new Document[list.size()]);
View Full Code Here

    protected void prepareUsecase() throws Exception {
        super.prepareUsecase();
        Area authoring = getPublication("test").getArea("authoring");

        SiteStructure authoringSite = authoring.getSite();
        SiteNode node = authoringSite.getNode(SOURCE_PATH);
        Document doc = node.getLink("en").getDocument();

        DocumentManager docMgr = null;
        try {
            docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);

            String pubId = doc.getPublication().getId();
            String area = doc.getArea();
            DocumentLocator loc = DocumentLocator.getLocator(pubId, area, PATH, doc.getLanguage());

            authoringSite.add("/foo");
            authoringSite.add("/foo/bar");

            docMgr.copy(doc, loc);

            // add an ancestor language version to test the method
            // MoveSubSite.getTargetURL()
            DocumentLocator ancestorLoc = DocumentLocator.getLocator(pubId, area, "/foo", "de");
            docMgr.copy(doc, ancestorLoc);

            SiteNode childNode = authoringSite.getNode(PATH);
            this.uuid = childNode.getUuid();
        } finally {
            if (docMgr != null) {
                getManager().release(docMgr);
            }
        }
View Full Code Here

    protected static String getTargetUrl(SiteStructure site, String path) throws SiteException {
        if (path.length() == 0) {
            return "/" + site.getPublication().getId() + "/" + site.getArea() + "/";
        } else if (site.contains(path)) {
            SiteNode node = site.getNode(path);
            if (node.getLanguages().length > 0) {
                Link link;
                String defaultLanguage = site.getPublication().getDefaultLanguage();
                if (node.hasLink(defaultLanguage)) {
                    link = node.getLink(defaultLanguage);
                }
                else {
                    link = node.getLink(node.getLanguages()[0]);
                }
                return link.getDocument().getCanonicalWebappURL();
            }
            else {
                return getTargetUrl(site, getParentPath(path));
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.