Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-23258

Add new defaultRendition extension point to Rendition service

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.3
    • Component/s: Renditions
    • Release Notes Description:
      Hide

      In the same way we are able to easily customize the download service's permission extension point (described in download-security-policies), a new extension point allows to dynamically evaluate a default rendition to be generated for a given document. This evaluation is based on the JVM Nashorn javascript engine and looks like:

        <extension target="org.nuxeo.ecm.platform.rendition.service.RenditionService"
          point="defaultRendition">
          <defaultRendition name="nxDefaultRendition">
            <script language="JavaScript">
              function run() {
                if (Reason == 'download') {
                  if (Document.getType() == "File") {
                    return 'mainBlob';
                  } else if (Document.getType() == 'Folder') {
                    return '';
                  } else {
                    return 'xmlExport';
                  }
                } else {
                  return '';
                }
              }
            </script>
          </defaultRendition>
        </extension>
      

      This default rendition is now used for bulk downloading documents. This way, users can easily customize how a document type can be rendered within the context of a bulk download. For instance, within a zip resulting from a bulk download, documents without any blob attached can be xml rendered, Picture documents will have their main blob rendered, Note will be rendered as PDF, etc.

      NOTE this new default rendition is downloadable under http://\{host}:{port}/nuxeo/nxfile/default/{docId}/ url

      Show
      In the same way we are able to easily customize the download service's permission extension point (described in download-security-policies ), a new extension point allows to dynamically evaluate a default rendition to be generated for a given document. This evaluation is based on the JVM Nashorn javascript engine and looks like: <extension target= "org.nuxeo.ecm.platform.rendition.service.RenditionService" point= "defaultRendition" > <defaultRendition name= "nxDefaultRendition" > <script language= "JavaScript" > function run() { if (Reason == 'download' ) { if (Document.getType() == "File" ) { return 'mainBlob' ; } else if (Document.getType() == 'Folder' ) { return ''; } else { return 'xmlExport' ; } } else { return ''; } } </script> </defaultRendition> </extension> This default rendition is now used for bulk downloading documents. This way, users can easily customize how a document type can be rendered within the context of a bulk download. For instance, within a zip resulting from a bulk download, documents without any blob attached can be xml rendered, Picture documents will have their main blob rendered, Note will be rendered as PDF, etc. NOTE this new default rendition is downloadable under http://\ {host}:{port}/nuxeo/nxfile/default/{docId}/ url
    • Epic Link:
    • Sprint:
      nxGang Sprint 9.3.7, nxGang Sprint 9.3.8
    • Story Points:
      2

      Description

      In the same way we are able to easily customize the download service's permission extension point (described in https://doc.nuxeo.com/nxdoc/file-download-security-policies/), we'd like an extension point where it would be possible to dynamically evaluate a default rendition to be generated for a given document. This evaluation will be based on the JVM Nashorn javascript engine and look like:

        <extension target="org.nuxeo.ecm.platform.rendition.service.RenditionService"
          point="defaultRendition">
          <defaultRendition name="nxDefaultRendition">
            <script language="JavaScript">
              function run() {
                if (Reason == 'download') {
                  if (Document.getType() == "File") {
                    return 'mainBlob';
                  } else if (Document.getType() == 'Folder') {
                    return '';
                  } else {
                    return 'xmlExport';
                  }
                } else {
                  return '';
                }
              }
            </script>
          </defaultRendition>
        </extension>
      

      This default rendition will then be used for bulk downloading documents. this way, users can easily customize how a document type can be rendered within the context of a bulk download. For instance, within a zip resulting from a bulkd download, documents without any blob attached can be xml rendered, Picture documents will have their main blob rendered, Note will be rendered as PDF, etc.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days
                  2d