Package org.apache.lenya.cms.site

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


                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 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) {
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

            assertTrue(structure.contains(PATH));
            Document linkDoc = structure.getNode(PATH).getLink("en").getDocument();
            assertSame(linkDoc, doc);

            if (!(structure instanceof DocumentStore)) {
                Link link = doc.getLink();
                checkSetLabel(link);
            }

            SiteNode[] nodes = structure.getNodes();
            assertTrue(nodes.length > 0);
View Full Code Here

    }

    protected void checkLinks(SiteManager siteManager, SiteNode node) throws SiteException {
        String[] languages = node.getLanguages();
        for (int i = 0; i < languages.length; i++) {
            Link link = node.getLink(languages[i]);
            assertEquals(link.getLanguage(), languages[i]);
            assertNotNull(link.getLabel());
           
            if (node.getUuid() != null) {
                Document doc = link.getDocument();
                assertNotNull(doc);
   
                String docUuid = doc.getUUID();
                String nodeUuid = node.getUuid();
   
                assertNotNull(doc.getUUID());
                assertEquals(docUuid, nodeUuid);
                assertEquals(doc.getLanguage(), link.getLanguage());
   
                // it may not be allowed to insert the doc twice
                try {
                    siteManager.add("/sidebar", doc);
                    assertTrue("No exception thrown", false);
View Full Code Here

                    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 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) {
View Full Code Here

            Publication pub = factory.getPublication(pubId);
            this.site = pub.getArea(area).getSite();

            if (this.path == null) {
                if (site.containsByUuid(uuid, language)) {
                    Link link = site.getByUuid(uuid, language);
                    this.path = link.getNode().getPath();
                } else {
                    throw new ProcessingException(
                            "Path parameter not provided, no node for UUID and language found.");
                }
            }
View Full Code Here

     */
    protected void addLabels(SiteNode node) throws SAXException {
        String[] languages = node.getLanguages();

        for (int i = 0; i < languages.length; i++) {
            Link link;
            try {
                link = node.getLink(languages[i]);
            } catch (SiteException e) {
                throw new RuntimeException(e);
            }
            addLabel(link.getLabel(), languages[i]);
        }
    }
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.