Package org.apache.lenya.cms.site

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


     * @throws SiteException
     *
     */
    final public void testAddLabel() throws SiteException {
        this.node.addLabel("it", "Barolo");
        Link label = this.node.getLink("it");
        assertNotNull(label);
        assertEquals(label.getLabel(), "Barolo");
        assertFalse(this.node.hasLink("ch"));
    }
View Full Code Here


                        + " doesn't contain a label for language " + srcDoc.getLanguage());
            }

            String destPath = destDoc.getPath();

            Link link = sourceNode.getLink(srcDoc.getLanguage());
            SiteNode destNode = destinationTree.getNode(destPath);
            if (destNode == null) {
                if (siblingPath == null) {
                    // called for side effect of add, not return result
                    destNode = destinationTree.add(destPath);
                } else {
                    // called for side effect of add, not return result
                    destNode = destinationTree.add(destPath, siblingPath);
                }
                destinationTree.add(destPath, destDoc);
            } else {
                destDoc.getLink().setLabel(link.getLabel());
            }
        } catch (DocumentException e) {
            throw new SiteException(e);
        }
    }
View Full Code Here

                // the node that we're trying to publish
                // doesn't have this language
                throw new SiteException("The node " + sourceDocument.getPath()
                        + " doesn't contain a label for language " + sourceDocument.getLanguage());
            }
            Link link = sourceNode.getLink(sourceDocument.getLanguage());
            SiteTreeNode destinationNode = (SiteTreeNode) destinationTree.getNode(destinationDocument.getPath());
            if (destinationNode == null) {
                if (siblingPath == null) {
                    destinationTree.addNode(destinationDocument.getPath(),
                            destinationDocument.getUUID(),
                            sourceNode.isVisible(),
                            sourceNode.getHref(),
                            sourceNode.getSuffix(),
                            sourceNode.hasLink());
                    destinationTree.addLabel(destinationDocument.getPath(),
                            destinationDocument.getLanguage(),
                            link.getLabel());
                } else {
                    destinationTree.addNode(destinationDocument.getPath(),
                            destinationDocument.getUUID(),
                            sourceNode.isVisible(),
                            sourceNode.getHref(),
                            sourceNode.getSuffix(),
                            sourceNode.hasLink(),
                            siblingPath);
                    destinationTree.addLabel(destinationDocument.getPath(),
                            destinationDocument.getLanguage(),
                            link.getLabel());
                }

            } else {
                // if the node already exists in the live
                // tree simply insert the label in the
                // live tree
                destinationDocument.getLink().setLabel(link.getLabel());
            }
        } catch (DocumentException e) {
            throw new SiteException(e);
        }
View Full Code Here

     * @param document The document.
     * @return A label.
     * @throws SiteException if an error occurs.
     */
    protected Link getLabelObject(Document document) throws SiteException {
        Link label = null;
        SiteTree siteTree = getTree(document);
        if (siteTree != null) {
            SiteTreeNode node = (SiteTreeNode) siteTree.getByUuid(document.getUUID(),
                    document.getLanguage()).getNode();
            if (node == null) {
View Full Code Here

        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));
            }
        } else {
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.