Marketplace Add-Ons

Customizing DAM Compat Bulk Import

Updated: July 31, 2019 Page Information Edit on GitHub

You can contribute your own actions to use in the Bulk Import. Actions that you contribute appear in a drop-down list labeled Import Actions.

To add an import action, you have to contribute an action in the category DAM_IMPORT_ASSETS. Actions in this category must define two properties: an automation chain and a form layout.

Action contribution

<action id="dndDamBulkImportAssets" link=""
      order="10" label="label.smart.import"
      help="desc.smart.import.file">
      <category>DAM_IMPORT_ASSETS</category>
      <properties>
        <property name="chainId">Dam.ImportWithMetaDataInSeam</property>
        <property name="layout">[email protected]</property>
      </properties>
    </action>

When an action is selected, the layout defined in the properties is shown, along with an "Import" button.

The bean attached to the "Import" button creates a Map Object ( DataModelProperties instance). It pushes the metadata from the form in the Map Object (without schema validation) and starts the automation chain id defined in the action. The chain takes the blob list as input, puts the Map Object in the context and names it docMetaData.

Operation chain contribution

    <chain id="Dam.ImportWithMetaDataInSeam">
      <operation id="Dam.Import">
        <param type="boolean" name="overwrite">true</param>
      </operation>
      <operation id="Document.Update">
        <param type="properties" name="properties">expr:Context.get("docMetaData")
        </param>
      </operation>
      <operation id="Seam.AddMessage">
        <param type="string" name="severity">INFO</param>
        <param type="string" name="message">label.dam.assets.imported</param>
      </operation>
      <operation id="Seam.Refresh" />
    </chain>

DataModelProperties is a map object that stores each value set in the form layout with the field name as key and without validation of the schema manager (as we can have in DocumentModel). If you bind a widget to a field foo:bar that doesn't exist, the DataModelProperties object will store it without generating an exception and you can fetch this field as usual (dataModelProperties.get("foo:bar")).

Starting with 5.9.5

It's possible to specify a custom Document Type to use in your import action. This is useful if your application uses custom Document Types and you need to import many rich assets (Pictures, PDFs, Videos, etc.) to store in Nuxeo using a document type you defined.

The definition for the action is the same as outlined above.

The automation chain will be similar - you would add a parameter to the Dam.Import operation which specifies the docType.

Example

<extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent"
  point="chains">
  <chain id="Dam.ImportFile">
    <operation id="Dam.Import">
      <param type="String" name="docType">File</param>
      <param type="boolean" name="overwrite">true</param>
      <param type="boolean" name="importInCurrentDocument">true</param>
    </operation>
    <operation id="Document.Update">
      <param type="properties" name="properties">expr:Context.get("docMetaData")
      </param>
    </operation>
    <operation id="Seam.AddMessage">
      <param type="string" name="severity">INFO</param>
      <param type="string" name="message">label.dam.assets.imported</param>
    </operation>
    <operation id="Seam.Refresh" />
  </chain>
</extension>

22 days ago Andrew Goodricke Syntax error fixed
3 years ago Solen Guitter 12
5 years ago Manon Lumeau 11
5 years ago Thomas Roger 10
5 years ago Solen Guitter 9
5 years ago Solen Guitter 8
5 years ago Harlan Brown 7
6 years ago Solen Guitter 6
6 years ago Solen Guitter 5 | Added screenshot and reorganized steps
6 years ago Alain Escaffre 3
6 years ago Alain Escaffre 4
6 years ago Benjamin Jalon 2
6 years ago Benjamin Jalon 1
History: Created by Benjamin Jalon

We'd love to hear your thoughts!

All fields required