Package org.apache.lenya.cms.publication

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


    String firstarea,
    String secarea)
    throws SiteTreeException {

    Publication publication = getPublication();
    SiteTree firsttree = publication.getSiteTree(firstarea);
    SiteTree sectree = publication.getSiteTree(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.removeNode(firstdocumentid);
    if (node != null) {
      SiteTreeNode parentNode = sectree.getNode(parentid);
      if (parentNode != null) {
        sectree.importSubtree(parentNode, node, 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


        }

        PageEnvelope pageEnvelope =
            PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);

        SiteTree siteTree =
            pageEnvelope.getPublication().getSiteTree(
                Publication.AUTHORING_AREA);

        if (siteTree.getNode(documentId) == null) {
            return Collections.EMPTY_MAP;
        }
        return null;
    }
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

      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

    String firstarea,
    String secarea)
    throws SiteTreeException {

    Publication publication = getPublication();
    SiteTree firsttree = publication.getSiteTree(firstarea);
    SiteTree sectree = publication.getSiteTree(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.importSubtree(parentNode, node, newid, null);
      } else {
        throw new SiteTreeException(
          "The parent node "
            + parentNode
            + " where the copied node shall be inserted not found");
      }
    } else {
      throw new SiteTreeException("Node " + node + " couldn't be found");
    }
    if (firstarea.equals(secarea)) {
      firsttree.save();
    } else {
      firsttree.save();
      sectree.save();
    }
  }
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

        File documentFile = new File(authoringDirectory, CREATED_FILE);
        assertTrue(documentFile.exists());
        System.out.println("File was created: " + documentFile.getAbsolutePath());

        SiteTree sitetree = publication.getSiteTree(AREA);
        SiteTreeNode node = sitetree.getNode(PARENT_ID + "/" + CHILD_ID);
        assertNotNull(node);
        System.out.println("Sitetree node was created: " + node.getId() + " (label: " +
            node.getLabel(DOCUMENT_LANGUAGE) + ")");
    }
View Full Code Here

    System.out.println("Backup was deleted: " + firstRcbakFile.getAbsolutePath());

    //TODO evaluation of meta, workflow
       
        //evaluate the node
    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

      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

       
        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);
       
        SiteTreeNode sourceNode = destinationTree.getNode(sourceDocumentId);
        Label sourceLabel = sourceNode.getLabel(sourceLanguage);
       
        assertTrue(destinationLabel.getLabel().equals(sourceLabel.getLabel()));
       
    }
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.