Package org.apache.lenya.cms.site

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


        if (hasErrors()) {
            return;
        }

        Document doc = getSourceDocument();
        SiteStructure liveSite = doc.getPublication().getArea(Publication.LIVE_AREA).getSite();
        if (liveSite.contains(doc.getPath())) {
            addErrorMessage(MESSAGE_ISLIVE);
        }

        Publication publication = doc.getPublication();

        ServiceSelector selector = null;
        SiteManager siteManager = null;
        try {
            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(publication.getSiteManagerHint());
            SiteStructure structure = siteManager.getSiteStructure(doc.getFactory(), publication,
                    doc.getArea());
            if (structure instanceof SiteTree) {

                SiteTreeNode node = (SiteTreeNode) doc.getLink().getNode();
                SiteTreeNode[] siblings = null;
View Full Code Here


        ServiceSelector selector = null;
        SiteManager siteManager = null;
        try {
            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(publication.getSiteManagerHint());
            SiteStructure structure = siteManager.getSiteStructure(
                    getSourceDocument().getFactory(), publication, getSourceDocument().getArea());
            if (structure instanceof SiteTree) {

                SiteTree tree = (SiteTree) structure;
                String direction = getParameterAsString(DIRECTION);
View Full Code Here

    public void testIndexUpdater() throws Exception {
        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();
View Full Code Here

            selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
            resourceType = (ResourceType) selector.select(resourceTypeName);

            docManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            Document newDoc;
            SiteStructure site = area.getSite();
            if (!site.contains(path) || site.getNode(path).getLanguages().length == 0) {
                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

        } else {
            preOrder = new ArrayList();
            URLInformation info = new URLInformation(getSourceURL());
            Publication pub = factory.getPublication(info.getPublicationId());
            Area area = pub.getArea(info.getArea());
            SiteStructure site = area.getSite();
            SiteNode[] topLevelNodes = site.getTopLevelNodes();
            for (int i = 0; i < topLevelNodes.length; i++) {
                preOrder.addAll(getPreOrder(topLevelNodes[i]));
            }
        }
        return preOrder;
View Full Code Here

       
        Session lenyaSession = login("lenya");
        DocumentFactory lenyaFactory = DocumentUtil.createDocumentFactory(getManager(), lenyaSession);
        Publication lenyaPub = lenyaFactory.getPublication(pubId);
       
        SiteStructure lenyaSite = lenyaPub.getArea(area).getSite();
        lenyaSite.getRepositoryNode().lock();
       
        Session aliceSession = login("alice");
        DocumentFactory aliceFactory = DocumentUtil.createDocumentFactory(getManager(), aliceSession);
        Publication alicePub = aliceFactory.getPublication(pubId);
       
        SiteStructure aliceSite = alicePub.getArea(area).getSite();
        aliceSite.getRepositoryNode().lock();
       
        SiteNode lenyaNode = lenyaSite.getNodes()[1];
        lenyaNode.setVisible(!lenyaNode.isVisible());
        lenyaSession.commit();
       
        SiteNode aliceNode = aliceSite.getNodes()[2];
        aliceNode.setVisible(!aliceNode.isVisible());
        try {
            aliceSession.commit();
            assertTrue("No exception raised", false);
        }
View Full Code Here

        Document collectionDoc = createCollectionDocument(pub);

        CollectionWrapper collection = new CollectionWrapper(collectionDoc, getLogger());

        SiteStructure structure = pub.getArea("authoring").getSite();
        structure.getRepositoryNode().lock();

        SiteManager siteManager = null;
        ServiceSelector selector = null;
        try {
            selector = (ServiceSelector) getManager().lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(pub.getSiteManagerHint());

            siteManager.add("/collection", collection.getDelegate());
        } finally {
            selector.release(siteManager);
            getManager().release(selector);
        }

        Document doc = map.get(pub, Publication.AUTHORING_AREA, "/index", "en");
        collection.add(doc);
        collection.save();

        collection.getDelegate().getRepositoryNode().unlock();
        structure.getRepositoryNode().unlock();

        CollectionWrapper coll2 = new CollectionWrapper(collectionDoc, getLogger());

        assertSame(collection.getDelegate().getRepositoryNode(), coll2.getDelegate()
                .getRepositoryNode());
View Full Code Here

                // lock the authoring site to avoid having live nodes for which no corresponding
                // authoring node exists
                nodes.add(doc.area().getSite().getRepositoryNode());
               
                // lock the live site to avoid overriding changes made by others
                SiteStructure liveSite = doc.getPublication().getArea(Publication.LIVE_AREA).getSite();
                nodes.add(liveSite.getRepositoryNode());
            }

            return (org.apache.lenya.cms.repository.Node[]) nodes
                    .toArray(new org.apache.lenya.cms.repository.Node[nodes.size()]);
View Full Code Here

        }
       
        Document document = getSourceDocument();
        Publication publication = document.getPublication();
        DocumentFactory map = document.getFactory();
        SiteStructure liveSite = publication.getArea(Publication.LIVE_AREA).getSite();

        List missingDocuments = new ArrayList();

        ServiceSelector selector = null;
        SiteManager siteManager = null;
        try {
            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(publication.getSiteManagerHint());

            if (!liveSite.contains(document.getPath())) {
                DocumentLocator liveLoc = document.getLocator().getAreaVersion(
                        Publication.LIVE_AREA);
                DocumentLocator[] requiredNodes = siteManager
                        .getRequiredResources(map, liveLoc);
                for (int i = 0; i < requiredNodes.length; i++) {
                    String path = requiredNodes[i].getPath();
                    if (!liveSite.contains(path)) {
                        Link link = getExistingLink(path, document);
                        if (link != null) {
                            missingDocuments.add(link.getDocument());
                        }
                    }
View Full Code Here

        return url;
    }

    protected void createAncestorNodes(Document document) throws PublicationException,
            DocumentException, SiteException {
        SiteStructure liveSite = document.getPublication().getArea(Publication.LIVE_AREA).getSite();
        String[] steps = document.getPath().substring(1).split("/");
        int s = 0;
        String path = "";
        while (s < steps.length) {
            if (!liveSite.contains(path)) {
                liveSite.add(path);
            }
            path += "/" + steps[s];
            s++;
        }
    }
View Full Code Here

TOP

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

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.