Package org.apache.lenya.cms.publication

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


  
   * @see org.apache.lenya.cms.publication.SiteTreeNodeVisitor#visitSiteTreeNode(org.apache.lenya.cms.publication.SiteTreeNode)
   */
  public void visitSiteTreeNode(SiteTreeNode node) {
    Publication publication = getPublication();
    DocumentBuilder builder = publication.getDocumentBuilder();

    String destDocumentid = node.getAbsoluteId();
    String srcDocumentid =
      destDocumentid.replaceFirst(
        getSecdocumentid(),
        getFirstdocumentid());

    Label[] labels = node.getLabels();
    for (int i = 0; i < labels.length; i++) {
      String language = labels[i].getLanguage();
      String url =
        builder.buildCanonicalUrl(
          publication,
          getFirstarea(),
          srcDocumentid,
          language);
      Document srcDoc;
      try {
        srcDoc = builder.buildDocument(publication, url);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }

      ResourcesManager resourcesMgr = new ResourcesManager(srcDoc);
View Full Code Here


  /** (non-Javadoc)
   * @see org.apache.lenya.cms.publication.SiteTreeNodeVisitor#visitSiteTreeNode(org.apache.lenya.cms.publication.SiteTreeNode)
   */
  public void visitSiteTreeNode(SiteTreeNode node) {
    Publication publication = getPublication();
    DocumentBuilder builder = publication.getDocumentBuilder();

    String destDocumentid = node.getAbsoluteId();
    String srcDocumentid =
      destDocumentid.replaceFirst(
        getSecdocumentid(),
        getFirstdocumentid());

    Label[] labels = node.getLabels();
    for (int i = 0; i < labels.length; i++) {
      String language = labels[i].getLanguage();
      String url =
        builder.buildCanonicalUrl(
          publication,
          getFirstarea(),
          srcDocumentid,
          language);
      Document doc;
      try {
        doc = builder.buildDocument(publication, url);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      File srcFile = doc.getFile();
      if (!srcFile.exists()) {
View Full Code Here

      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);
        Document doc;
        try {
          doc = builder.buildDocument(publication, url);
        } catch (DocumentBuildException e) {
          throw new BuildException(e);
        }
        ResourcesManager resourcesMgr = new ResourcesManager(doc);
        File[] resources = resourcesMgr.getResources();
View Full Code Here

            addErrorMessage("The relation '" + relation + "' is not supported.");
        }

        Publication pub = getPublication();

        DocumentBuilder builder = pub.getDocumentBuilder();
        boolean provided = getParameterAsBoolean(PATH_PROVIDED, false);

        if (provided) {
            String newPath = getNewDocumentPath();
            if (pub.getArea(getArea()).getSite().contains(newPath)) {
                String[] params = { newPath };
                addErrorMessage("path-already-exists", params);
            }
        } else {
            String nodeName = getNodeName();
            if (nodeName.equals("")) {
                addErrorMessage("missing-node-name");
            } else if (!builder.isValidDocumentName(nodeName)) {
                addErrorMessage("node-name-special-characters");
            }
        }
    }
View Full Code Here

        return getParameterAsString(NODE_NAME).trim();
    }

    protected boolean isPathValid() {
        String nodeName = getNewDocumentName();
        DocumentBuilder builder = getPublication().getDocumentBuilder();
        return !nodeName.trim().equals("") && builder.isValidDocumentName(nodeName);
    }
View Full Code Here

     */
    protected void doCheckExecutionConditions() throws Exception {
        super.doCheckExecutionConditions();

        String nodeId = getParameterAsString(NODE_ID);
        DocumentBuilder builder = getSourceDocument().getPublication().getDocumentBuilder();
        if (!builder.isValidDocumentName(nodeId)) {
            addErrorMessage("The document ID is not valid.");
        } else {
            DocumentLocator target = getTargetLocator();
            Publication pub = getDocumentFactory().getPublication(target.getPublicationId());
            SiteStructure site = pub.getArea(target.getArea()).getSite();
View Full Code Here

     */
    protected void doCheckExecutionConditions() throws Exception {
        super.doCheckExecutionConditions();

        String nodeId = getParameterAsString(NODE_ID);
        DocumentBuilder builder = getSourceDocument().getPublication().getDocumentBuilder();
        if (!builder.isValidDocumentName(nodeId)) {
            addErrorMessage("The document ID is not valid.");
        } else {
            DocumentLocator target = getTargetLocator();
            Publication pub = getDocumentFactory().getPublication(target.getPublicationId());
            SiteStructure site = pub.getArea(target.getArea()).getSite();
View Full Code Here

      // TODO: resources (fix the build file)
      // TODO: rcml (fix the build file)
      // TODO: rcbak (fix the build file)

      //move workflow
      DocumentBuilder builder = publication.getDocumentBuilder();
      String url = builder.buildCanonicalUrl(publication, firstarea, srcDocumentid, language);
      String newurl =
        builder.buildCanonicalUrl(publication, secarea, destDocumentid, language);

      Document document;
      Document newDocument;
      WorkflowFactory factory = WorkflowFactory.newInstance();

      log("move workflow history");
      try {
        document = builder.buildDocument(publication, url);
        newDocument = builder.buildDocument(publication, newurl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      try {
        if (factory.hasWorkflow(document)) {
View Full Code Here

  public void deleteContent(
    String language,
    String documentid,
    String area) {
    Publication publication = getPublication();
    DocumentBuilder builder = publication.getDocumentBuilder();
    String url =
      builder.buildCanonicalUrl(publication, area, documentid, language);
    Document document;
    try {
      document = builder.buildDocument(publication, url);
    } catch (DocumentBuildException e) {
      throw new BuildException(e);
    }
    File file = document.getFile();
View Full Code Here

    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) {
                        url =
                            builder.buildCanonicalUrl(
                                publication,
                                Publication.AUTHORING_AREA,
                                docId,
                                language);
                    } else {
      url =
          builder.buildCanonicalUrl(
                              publication,
                              Publication.AUTHORING_AREA,
                              docId);
        }
                    unpublishedReferences.add(
                        builder.buildDocument(publication, url));
                }
            }
        } catch (SiteTreeException e) {
            throw new ProcessingException(e);
        } catch (IOException e) {
View Full Code Here

TOP

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

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.