Package org.apache.lenya.cms.publication

Examples of org.apache.lenya.cms.publication.SiteTreeNode


        SiteTree tree = null;
        Label label = null;
        try {
            tree = getPublication().getTree(area);
            SiteTreeNode node = tree.getNode(documentid);
            // if there is only one label left do not delete it.
            if (node.getLabels().length > 1) {
                // if there are more than one labels in this node
                // try to delete the label specified by the labelName.
                label = new Label(labelName, language);
                tree.removeLabel(documentid, label);
                tree.save();
View Full Code Here


            log("Document ID: [" + documentId + "]");
            log("Area:        [" + area + "]");

            Publication publication = getPublication();
            SiteTree tree = publication.getTree(area);
            SiteTreeNode node = tree.getNode(documentId);

            node.acceptSubtree(this);
        } catch (Exception e) {
            throw new BuildException(e);
        }
    }
View Full Code Here

    try {
      log("area : " + this.getArea());
      Publication publication= getPublication();
      SiteTree tree = publication.getTree(getArea());
          
      SiteTreeNode node = tree.getNode("/");
            node.deleteChildren();      
      tree.save();
      } catch (
        Exception e) {
      throw new BuildException(e);
    }
View Full Code Here

        throws SiteTreeException {
        SiteTree tree = null;

        try {
            tree = getPublication().getTree(area);
            SiteTreeNode node = tree.getNode(documentid);
            node.removeLabel(node.getLabel(language));
            Label[] labels = node.getLabels();
            if (labels.length < 1 ){
                deleteNode(documentid,area);  
            } else {
                tree.save();
            }
View Full Code Here

      log("document-id for the source" + this.getFirstdocumentid());
      log("area for the source" + this.getFirstarea());

      Publication publication= getPublication();
      SiteTree tree = publication.getTree(getFirstarea());
      SiteTreeNode node = tree.getNode(getFirstdocumentid());

      node.acceptSubtree(this);
    } catch (Exception e) {
      throw new BuildException(e);
    }
}
View Full Code Here

        String area)
        throws SiteTreeException, DocumentException {

        SiteTree tree = null;
        tree = getPublication().getTree(area);
        SiteTreeNode node = tree.getNode(documentid);

        if (node == null) {
            throw new DocumentException(
                "Document-id " + documentid + " not found.");
        }
        //if node is visible change to fale and vice versa
        String visibility = "false";
        if (!node.visibleInNav()) visibility = "true";
        node.setNodeAttribute(SiteTreeNodeImpl.VISIBLEINNAV_ATTRIBUTE_NAME, visibility);       

        tree.save();
    }
View Full Code Here

    try {
      tree = publication.getTree(area);
    } catch (SiteTreeException e) {
      throw new BuildException(e);
    }
    SiteTreeNode node = tree.getNode(documentid);
    Label[] labels = node.getLabels();

    DocumentBuilder builder = publication.getDocumentBuilder();

    try {
      if (labels.length < 1) {
        log("no languages found for the node with id : " + node.getId());
        url = builder.buildCanonicalUrl(publication, area, documentid);
        writeDCIdentifier(publication, url);
      } else {
        for (int i = 0; i < labels.length; i++) {
          language = labels[i].getLanguage();
View Full Code Here

      log("document-id for the destination :" + this.getSecdocumentid());
      log("area for the destination :" + this.getSecarea());

      Publication publication = getPublication();
      SiteTree tree = publication.getTree(this.getSecarea());
      SiteTreeNode node = tree.getNode(this.getSecdocumentid());
      node.acceptReverseSubtree(this);
    } catch (Exception e) {
      throw new BuildException(e);
    }
  }
View Full Code Here

      log("document-id for the destination :" + this.getSecdocumentid());
      log("area for the destination :" + this.getSecarea());

      Publication publication = getPublication();
      SiteTree tree = publication.getTree(this.getSecarea());
      SiteTreeNode node = tree.getNode(this.getSecdocumentid());
      node.acceptReverseSubtree(this);
    } catch (Exception e) {
      throw new BuildException(e);
    }
  }
View Full Code Here

        try {
            authoringTree = getPublication().getTree(Publication.AUTHORING_AREA);
            liveTree = getPublication().getTree(Publication.LIVE_AREA);

            SiteTreeNode authoringNode = authoringTree.getNode(documentId);
            SiteTreeNode[] siblings = authoringNode.getNextSiblings();
            String parentId = authoringNode.getAbsoluteParentId();
            SiteTreeNode sibling = null;
            String siblingDocId = null;
            for (int i = 0; i < siblings.length; i++) {
                String docId = parentId + "/" + siblings[i].getId();
                sibling = liveTree.getNode(docId);
                if (sibling != null) {
                    siblingDocId = docId;
                    break;
                }
            }

            if (language == null) {
                // no language was specified. Simply publish the
                // node including all languages.
                try {
                    liveTree.addNode(authoringNode, siblingDocId);
                } catch (SiteTreeException e1) {
                    throw new ParentNodeNotFoundException("Couldn't add document: " + documentId
                            + " to live tree.", e1);
                }
            } else {
                // a language was specified. Let's see if this
                // node even has an entry for the specified
                // language.
                Label label = authoringNode.getLabel(language);
                if (label != null) {
                    // check if this node has already been
                    // published
                    SiteTreeNode liveNode = liveTree.getNode(documentId);
                    if (liveNode != null) {
                        // if the node already exists in the live
                        // tree simply insert the label in the
                        // live tree
                        liveTree.setLabel(documentId, label);
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.publication.SiteTreeNode

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.