Marketplace Add-Ons

Nuxeo File System Exporter

Updated: July 17, 2023

Functional Overview

The File System Exporter package is an add-on for the Nuxeo platform to enable users exporting one chosen root structure of documents from their Nuxeo Platform to a specified File System repository.

The installation of the plugin will add a new operation in "Services" called "ExportStructureToFS". This operation must be added to the registries in Studio and then can be used in an automation chain.

In the user interface, users will now see an new action button that will enable them to export the structure with the following parameters defined in Studio:

  • Root Path = default-domain
  • File System target = /tmp

After clicking on the export action, connected user has now access to the entire structure directly on his tmp folder.

The following rules are implemented by default:

  • All the document are exported 
  • When a document exported already exists in your File System directory, it will be prefixed with a timestamp. In this way, no document will be deleted 
  • The attached files to a document are exported in the same directory than the document. They are prefixed with the name of the document parent.

Installation

This addon requires no specific installation steps. It can be installed like any other package from the Update Center or using nuxeoctl command line.

Technical Overview

Enabling the New Operation

In Studio go to Settings > Registries, to create a new Automation Operations with the following JSON path:   

{
  "operations": [
    {
  "id" : "ExportStructureToFS",
  "label" : "ExportStructureToFS",
  "category" : "Services",
  "requires" : null,
  "description" : "This operation enables to export the structure contained in the Root name path to the File System Target path. You can declare your own query to choose the document being exported.",
  "url" : "ExportStructureToFS",
  "signature" : [ "void", "void" ],
  "params" : [ {
    "name" : "File System Target",
    "description" : "",
    "type" : "string",
    "required" : true,
    "widget" : null,
    "order" : 0,
    "values" : [ ]
  }, {
    "name" : "Root Path",
    "description" : "",
    "type" : "string",
    "required" : true,
    "widget" : null,
    "order" : 0,
    "values" : [ ]
  }, {
    "name" : "Query",
    "description" : "",
    "type" : "string",
    "required" : false,
    "widget" : null,
    "order" : 0,
    "values" : [ ]
  } ]
}
]
}

If you don't know how to add an external operation, you will find all the information that you need on the page Referencing an Externally Defined Type.

Creating the Automation Chain

This operation can be called in an automation chain called ExportFS in our example, and linked to a user action.

This operation has the following parameters:

  • File System Target: Where the export will be done on the File System
  • Root  Path: The root name of the structure of Nuxeo Platform that will be exported.
  • Query: Optional parameter. By default the query called by the exporter is:

    SELECT * FROM Document ecm:mixinType !='HiddenInNavigation' AND ecm:isVersion = 0 AND ecm:currentLifeCycleState !='deleted'
    

    You can define your own query and put it the in the Query parameter.

For example if you want to export all the documents even the ones in “deleted” state you can define this query in the field of the query parameter.

SELECT * FROM Document WHERE ecm:mixinType !='HiddenInNavigation' AND ecm:isVersion = 0

Customization

If you want to go further you can decide to contribute to the extension point exportLogic with a custom class to have a new way of export:

  • Export only documents of type “File”
  • Override existing documents (not using the timestamp prefix anymore)
  • Create an XML export of each document (done as an example) 

The following contribution has already been written: CustomExporterPlugin. It launches the default export (export all the documents under root path) and in addition, for each document exported, creates the XML version.

You can use it with using the following XML extension in Studio:  

<extension
target="org.nuxeo.io.fsexporter.FSExporter"
point="exportLogic">

        <exportLogic
class="org.nuxeo.io.fsexporter.CustomExporterPlugin" />

</extension>