Package org.apache.lenya.cms.publication

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


    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

           
            for (int linkIndex = 0; linkIndex < links.length; linkIndex++) {
                if (builder.isDocument(publication, links[linkIndex])) {
                    Document targetDocument = builder.buildDocument(publication, links[linkIndex]);

                    SiteTreeNode documentNode = sitetree.getNode(targetDocument.getId());

                    if (documentNode == null || documentNode.getLabel(targetDocument.getLanguage()) == null) {
                        // the document has not been published for the given language
                        if (log.isDebugEnabled()) {
                            log.debug("found reference to unpublished document: " + targetDocument);
                        }
                        unpublishedReferences.add(targetDocument);
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

    Publication publication = getPublication();
    SiteTree tree = null;

    try {
      tree = publication.getTree(area);
      SiteTreeNode node = tree.getNode(documentid);
      Label[] labels = null;
      if (node != null) {
        labels = node.getLabels();
      }
      if (node == null || (labels != null && labels.length < 1)) {

        DocumentBuilder builder = publication.getDocumentBuilder();
        String url = builder.buildCanonicalUrl(publication, area, documentid, language);
View Full Code Here

        StringBuffer parentId = new StringBuffer(secDocumentId.length());
        for (int i = 0; i < length; i++) {
            parentId.append("/").append(st.nextToken());
        }
        String newid = st.nextToken();
        SiteTreeNode node = firsttree.getNode(firstDocumentId);

        if (node != null) {
            SiteTreeNode parentNode = sectree.getNode(parentId.toString());
            if (parentNode != null) {
                sectree.copy(node, parentNode, newid, null);
            } else {
                throw new SiteTreeException("The parent node " + parentNode
                        + " where the copied node shall be inserted not found");
View Full Code Here

    for (int i = 0; i < length; i++) {
      parentId.append("/").append(st.nextToken());
    }
    String newid = st.nextToken();

    SiteTreeNode node = firsttree.getNode(firstDocumentId);
    if (node != null) {
        SiteTreeNode parentNode = sectree.getNode(parentId.toString());
      if (parentNode != null) {
                sectree.move(node, parentNode, newid, this.getRefdocumentid());
      } else {
        throw new SiteTreeException(
          "The parent node "
View Full Code Here

        String area,
        String href)
        throws SiteTreeException, DocumentException {

        SiteTree tree = getPublication().getTree(area);
        SiteTreeNode node = tree.getNode(documentid);
        if (node == null) {
            throw new DocumentException(
                "Document-id " + documentid + " not found.");
        }
        Label label = node.getLabel(language);
        if (label == null) {
            throw new DocumentException(
                "Label for language " + language + " not found.");
        }
        if (href.equals("")) href = null;
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("src area dir" + this.getSrcareadir());

      //visit the destination tree
      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

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.