Package org.apache.lenya.cms.publication

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


    assertFalse(firstRcbakFile.exists());
    System.out.println("Backup was deleted: " + firstRcbakFile.getAbsolutePath());
       
        //TODO evaluation of meta, workflow
       
    SiteTree sitetree = PublicationHelper.getPublication().getSiteTree(Publication.AUTHORING_AREA);
    SiteTreeNode node = sitetree.getNode(secdocumentid);
    assertNotNull(node);
    System.out.println("Sitetree node with id "+node.getId()+" was created as child of node with id: " + node.getAbsoluteParentId());
    SiteTreeNode firstnode = sitetree.getNode(FIRST_DOCUMENT_ID);
    assertNull(firstnode);
    System.out.println("Sitetree node for document id "+FIRST_DOCUMENT_ID+" was deleted");
  }
View Full Code Here


        }

        Document liveDocument = getPublication().getAreaVersion(document, Publication.LIVE_AREA);
        Document liveParent = DocumentHelper.getParentDocument(liveDocument);
        if (liveParent != null) {
            SiteTree liveTree = getPublication().getSiteTree(Publication.LIVE_AREA);
            SiteTreeNode liveParentNode = liveTree.getNode(liveParent.getId());
            if (liveParentNode == null) {
                log.error("Cannot execute task: live parent node does not exist.");
                OK = false;
            }
        }
View Full Code Here

        boolean OK = true;

        Document authoringDocument = getPublication().getAreaVersion(liveDocument, Publication.AUTHORING_AREA);
        OK = OK && canWorkflowFire(authoringDocument);

        SiteTree tree = getPublication().getSiteTree(liveDocument.getArea());
        SiteTreeNode node = tree.getNode(liveDocument.getId());

        if (node == null) {
            throw new ExecutionException(
                "Sitetree node for document [" + liveDocument + "] does not exist!");
        }
View Full Code Here

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

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

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

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

      log("rcbak dir" + this.getRcbakdir());
      log("src area dir" + this.getSrcareadir());

      //visit the destination tree
      Publication publication = getPublication();
      SiteTree tree = publication.getSiteTree(this.getSecarea());
      SiteTreeNode node = tree.getNode(this.getSecdocumentid());
      node.acceptReverseSubtree(this);

    } catch (Exception e) {
      throw new BuildException(e);
    }
View Full Code Here

    assertFalse(firstRcbakFile.exists());
    System.out.println("Backup was deleted: " + firstRcbakFile.getAbsolutePath());
       
        //TODO evaluation of meta, workflow
       
    SiteTree sitetree = PublicationHelper.getPublication().getSiteTree(Publication.AUTHORING_AREA);
    SiteTreeNode node = sitetree.getNode(secdocumentid);
    assertNotNull(node);
    System.out.println("Sitetree node with id "+node.getId()+" was created as child of node with id: " + node.getAbsoluteParentId());
    SiteTreeNode firstnode = sitetree.getNode(FIRST_DOCUMENT_ID);
    assertNull(firstnode);
    System.out.println("Sitetree node for document id "+FIRST_DOCUMENT_ID+" was deleted");
  }
View Full Code Here

        System.out.println("Live document: " + liveDocumentFile.getAbsolutePath());
    assertFalse(liveDocumentFile.exists());

        //TODO evaluation of resources, meta, workflow
       
    SiteTree authoringSitetree = PublicationHelper.getPublication().getSiteTree(Publication.AUTHORING_AREA);
    SiteTreeNode node = authoringSitetree.getNode(DOCUMENT_ID);
    assertNotNull(node);
        System.out.println("Sitetree node with id ["+node.getId()+"] is always in authoring");
    SiteTree liveSitetree = PublicationHelper.getPublication().getSiteTree(Publication.LIVE_AREA);
    SiteTreeNode livenode = liveSitetree.getNode(DOCUMENT_ID);
    assertNull(livenode);
        System.out.println("Sitetree node for document id ["+DOCUMENT_ID+"] was deleted from the live tree");
  }
View Full Code Here

    System.out.println("Document was copied: " + documentFile.getAbsolutePath());

        //TODO evaluation of meta, workflow
        File sitetreeFile = new File(authoringDirectory, TREE_FILE);

        SiteTree sitetree = PublicationHelper.getPublication().getSiteTree(Publication.AUTHORING_AREA);
        SiteTreeNode node = sitetree.getNode(secdocumentid);
        assertNotNull(node);
        System.out.println("Sitetree node with id " + node.getId() +
            " was created as child of node with id: " + node.getAbsoluteParentId());
    }
View Full Code Here

     *
     * @throws PublishingException if the publication failed.
     */
    public void publish(String documentId, String language)
        throws PublishingException {
        SiteTree authoringTree = null;
        SiteTree liveTree = null;

        try {
            authoringTree =
                getPublication().getSiteTree(Publication.AUTHORING_AREA);
            liveTree = getPublication().getSiteTree(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 (authoringNode != null) {
                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);
                        } else {
                            // if the node doesn't exist, add it and
                            // add the specified label to it.
                            Label[] labels = { label };
                            try {
                                liveTree.addNode(
                                    documentId,
                                    labels,
                                    authoringNode.getHref(),
                                    authoringNode.getSuffix(),
                                    authoringNode.hasLink(),
                    siblingDocId);
                            } catch (SiteTreeException e1) {
                                throw new ParentNodeNotFoundException(
                                    "Couldn't add document: "
                                        + documentId
                                        + " to live tree.",
                                    e1);
                            }
                        }
                    } else {
                        // the node that we're trying to publish
                        // doesn't have this language
                        throw new PublishingException(
                            "The node "
                                + documentId
                                + " doesn't contain a label for language "
                                + language);
                    }
                }
            } else {
                throw new PublishingException(
                    "No node found for the document " + documentId);
            }

            liveTree.save();
        } catch (PublishingException e) {
            throw e;
        } catch (Exception e) {
            throw new PublishingException("Couldn't publish to live tree :", e);
        }
View Full Code Here

TOP

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

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.