Desktop and Mobile

How to Customize Nuxeo Drive Versioning Policy

Updated: March 18, 2024

How to Configure the Versioning Delay or Version Increment

You can contribute a new versioning policy and filter thanks to the extension points policies and filters to configure the last edit delay until a new version is created and which version increment will occur (minor or major).

For example, to create a major version if the document is modified 30 minutes after the last change, use this contribution:

<require>org.nuxeo.ecm.core.versioning.default-policies</require>

<extension target="org.nuxeo.ecm.core.versioning.VersioningService" point="policies">
    <policy id="versioning-delay" increment="MAJOR" order="40">
        <filter-id>versioning-delay</filter-id>
        <filter-id>drive-filter</filter-id>
    </policy>
</extension>

<extension target="org.nuxeo.ecm.core.versioning.VersioningService" point="filters">
    <filter id="versioning-delay">
        <condition>#{currentDocument.dc.modified.time - previousDocument.dc.modified.time >= 1800000}</condition>
    </filter>
    <filter id="drive-filter">
        <condition>#{currentDocument.contextData.source == "drive"}</condition>
    </filter>
</extension>

How to Change Nuxeo Drive Versioning Policy

If you need to make more changes on the versioning mechanism in Nuxeo Drive, you can write your own implementation of the VersioningPolicyFilter interface, and contribute it to the filters extension point.

<extension target="org.nuxeo.ecm.core.versioning.VersioningService" point="policies">
    <policy id="custom-versioning-policy" increment="MAJOR" order="40">
        <filter-id>custom-versioning-filter</filter-id>
    </policy>
</extension>

<extension target="org.nuxeo.ecm.core.versioning.VersioningService" point="filters">
    <filter id="custom-versioning-filter" class="foo.bar.CustomVersioningFilter">
</extension>