Package org.apache.lenya.cms.publication

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


   *             if an error occurs
   */
  public void deactivateResources(String language, String documentid, String area)
    throws SiteTreeException {
    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)) {
View Full Code Here


        String labelName,
        String language,
        String area)
        throws SiteTreeException {

        SiteTree tree = null;
        Label label = null;
        try {
            tree = getPublication().getTree(area);
            label = new Label(labelName, language);
            tree.addLabel(documentid, label);
            tree.save();
        } catch (Exception e) {
            throw new SiteTreeException(
                "Cannot insert label "
                    + label
                    + " into tree "
View Full Code Here

    String firstarea,
    String secarea)
    throws SiteTreeException {

    Publication publication = getPublication();
    SiteTree firsttree = publication.getTree(firstarea);
    SiteTree sectree = publication.getTree(secarea);

    String parentid = "";
    StringTokenizer st = new StringTokenizer(secdocumentid, "/");
    int length = st.countTokens();

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

    SiteTreeNode node = firsttree.getNode(firstdocumentid);
    if (node != null) {
        SiteTreeNode parentNode = sectree.getNode(parentid);
      if (parentNode != null) {
                sectree.move(node, parentNode, newid, this.getRefdocumentid());
      } else {
        throw new SiteTreeException(
          "The parent node "
            + parentNode
            + " where the removed node shall be inserted not found");
      }
    } else {
      throw new SiteTreeException(
        "Node " + node + " couldn't be removed");
    }

    if (firstarea.equals(secarea)) {
      firsttree.save();
    } else {
      firsttree.save();
      sectree.save();
    }
  }
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(getFirstarea());
      SiteTreeNode node = tree.getNode(getFirstdocumentid());

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

     *
     * @throws ProcessingException if the current document cannot be opened.
     */
    public Document[] getInternalReferences() throws ProcessingException {
        ArrayList unpublishedReferences = new ArrayList();
        SiteTree sitetree;
        Pattern internalLinkPattern = getInternalLinkPattern();
        Publication publication = pageEnvelope.getPublication();
        DocumentBuilder builder = publication.getDocumentBuilder();
        try {
            sitetree = publication.getSiteTree(Publication.LIVE_AREA);
            String[] internalLinks =
                Grep.findPattern(
                    pageEnvelope.getDocument().getFile(),
                    internalLinkPattern,
                    1);
            String[] internalLinksLanguages =
                Grep.findPattern(
                    pageEnvelope.getDocument().getFile(),
                    internalLinkPattern,
                    2);

            for (int i = 0; i < internalLinks.length; i++) {
                String docId = internalLinks[i];
    String language = null;
               
    if (internalLinksLanguages[i] != null) {
        // trim the leading '_'
        language = internalLinksLanguages[i].substring(1);
    }
                SiteTreeNode documentNode = sitetree.getNode(docId);
                if (documentNode == null
                    || documentNode.getLabel(language) == null) {
                    // the docId has not been published for the given language
                    String url = null;
                    if (language != null) {
View Full Code Here

       
        publication.copyDocument(sourceDocument, destinationDocument);
       
        assertTrue(destinationDocument.exists());
       
        SiteTree destinationTree = publication.getSiteTree(destinationArea);
        SiteTreeNode destinationNode = destinationTree.getNode(destinationDocumentId);
        assertNotNull(destinationNode);
        Label destinationLabel = destinationNode.getLabel(destinationLanguage);
        assertNotNull(destinationLabel);
       
        SiteTree sourceTree = publication.getSiteTree(sourceArea);
        SiteTreeNode sourceNode = destinationTree.getNode(sourceDocumentId);
        Label sourceLabel = sourceNode.getLabel(sourceLanguage);
       
        assertTrue(destinationLabel.getLabel().equals(sourceLabel.getLabel()));
       
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

        }

        Document liveDocument = getPublication().getAreaVersion(document, Publication.LIVE_AREA);
        Document liveParent = DocumentHelper.getParentDocument(liveDocument);
        if (liveParent != null) {
            SiteTree liveTree = getPublication().getTree(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().getTree(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

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.