Package org.apache.lenya.cms.publication

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


        if (language == null) {
            language = getPublication().getDefaultLanguage();
        }
        DocumentBuilder builder = getPublication().getDocumentBuilder();
        String url = builder.buildCanonicalUrl(getPublication(), Publication.AUTHORING_AREA, getDocumentId(), language);
        Document document;
        try {
            document = builder.buildDocument(getPublication(), url);
            log(".execute(): " + document.getLanguage());
        } catch (DocumentBuildException e) {
            throw new BuildException(e);
        }

        try {
View Full Code Here


   */
  public void writeDCIdentifier(Publication publication, String url)
    throws DocumentBuildException, DocumentException {
    assert url != null;

    Document document = null;
    document = publication.getDocumentBuilder().buildDocument(publication, url);
    DublinCore dublincore = document.getDublinCore();
        dublincore.setValue("identifier", documentid);
    dublincore.save();
  }
View Full Code Here

        builder.buildCanonicalUrl(
          publication,
          getFirstarea(),
          srcDocumentid,
          language);
      Document srcDoc;
      try {
        srcDoc = builder.buildDocument(publication, url);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
View Full Code Here

                    value = null;  
                }
            }
           
            if (name.equals(LABEL_HREF)) {
                Document document = envelope.getDocument();
                SiteTree siteTree = publication.getTree(document.getArea());
                value = siteTree.getNode(document.getId()).getLabel(document.getLanguage()).getHref();
                if (value == null) value = "";
            }

        } catch (Exception e) {
            throw new ConfigurationException("Obtaining value for [" + name + "] failed: ", e);
View Full Code Here

            String language = labels[i].getLanguage();
            DocumentBuilder builder = publication.getDocumentBuilder();

            try {
                String url = builder.buildCanonicalUrl(publication, area, documentId, language);
                Document document = builder.buildDocument(publication, url);

                String servletContext = new File(servletContextPath).getCanonicalPath();
                log("Deleting scheduler entry for document [" + document + "]");
                log("Resolving servlet [" + servletContext + "]");
View Full Code Here

    /**
     * @see org.apache.lenya.cms.task.Task#execute(java.lang.String)
     */
    public void execute(String servletContextPath) throws ExecutionException {
       
        Document document = getDocument();
        String area;
        try {
            area = getParameters().getParameter(PARAMETER_DESTINATION_AREA);
            getPublication().copyDocumentToArea(document, area);
        } catch (Exception e) {
View Full Code Here

        builder.buildCanonicalUrl(
          publication,
          getFirstarea(),
          srcDocumentid,
          language);
      Document srcDoc;
      try {
        srcDoc = builder.buildDocument(publication, srcUrl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      File srcFile = srcDoc.getFile();
      if (!srcFile.exists()) {
        log("There are no file " + srcFile.getAbsolutePath());
        return;
      }
      String destUrl =
        builder.buildCanonicalUrl(
          publication,
          getSecarea(),
          destDocumentid,
          language);
      Document destDoc;
      try {
        destDoc = builder.buildDocument(publication, destUrl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      File destFile = destDoc.getFile();

      log(
        "copy file "
          + srcFile.getAbsolutePath()
          + "to file "
View Full Code Here

                }
            }

            Policy policy = policyManager.getPolicy(accreditableManager, canonicalUrl);

            Document doc = builder.buildDocument(publication, canonicalUrl);

            Proxy proxy = doc.getPublication().getProxy(doc, policy.isSSLProtected());

            if (proxy != null) {
                value = proxy.getURL(doc);
            } else {
                // Take server name and port from request.
                Request request = ObjectModelHelper.getRequest(objectModel);
                value = "http://" + request.getServerName() + ":" + request.getServerPort()
                        + request.getContextPath() + doc.getCompleteURL();
            }

        } catch (Exception e) {
            throw new ConfigurationException("Obtaining value for [" + name + "] failed: ", e);
        }
View Full Code Here

            String childNodeId = children[0].getId();
            String childId = id + "/" + childNodeId;
            DocumentBuilder builder = publication.getDocumentBuilder();
            String url = builder.buildCanonicalUrl(publication, area, childId, language);
            Document childDocument = builder.buildDocument(publication, url);

            if (!childDocument.existsInAnyLanguage()) {
                throw new NoChildDocumentExistException("The document " + childId + " does not exist. Check sitetree, it might need to be reloaded.");
            }
            List availableLanguages = Arrays.asList(childDocument.getLanguages());

            if (availableLanguages.contains(language)) {
                return Collections.unmodifiableMap(Collections.EMPTY_MAP);
            }
        } else {
View Full Code Here

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

                        if (targetDocument.equals(document)) {
                            if (log.isDebugEnabled()) {
                                log.debug("found link to " + document + " in " + documents[docIndex]);
                            }
                           
                            targetDocuments.add(documents[docIndex]);
View Full Code Here

TOP

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

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.