Versioning Behaviour

cancel
Showing results for 
Search instead for 
Did you mean: 

Versioning Behaviour

resplin
Intermediate
0 0 9,032

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Versioning3.03.13.2Back to Server Administration Guide


Alfresco DM Versioning


The following applies to versioning behaviour of the ADM store implementation. For versioning behaviour of the AVM store implementation, refer to Versioned Directories.

Alfresco 3.x uses a new stream-lined version store. When upgrading from Alfresco 2.x to Alfresco 3.x, the version store will be migrated.


Making a Content Item Versionable


Out-of-the-box, content in Alfresco DM is not generally marked as 'versionable' by default when new content is added (*).

Content must be specifically marked as being versionable before versions can be created.  For example, using the Alfresco Explorer (JSF client UI) you can select 'View Details' on a content item and then 'Version History -> Allow Versioning' (or you can 'Run Action -> Add aspect to item' and select 'Versionable').

When content is first marked as Versionable,  a version history is created containing an initial snap-shot (V1.0) of the content and related metadata.  As further changes are made then, based on the versioning behaviour, new versions are created of the content and related metadata.

Note (*): one exception is the Alfresco Share client, which will mark the content (within the 'Document Library') as versionable on the first update of the document. When uploading the first update, a new 1.0 version is created (which also adds the versionable aspect) and then the content is checked-out, updated and checked-in as either a minor 1.1 version or major 2.0 version, as selected by the user.


Making Content Versionable in a Space


For example, using the Alfresco Explorer (JSF client UI) you can select 'View Details' on a space, and then add an inbound content rule for all items, which applies the Versionable aspect.


Making All Content Versionable


If you want all content to be versionable from the moment it is created (via any interface, including Alfresco Explorer) then this can be achieved by modifying the dictionary definition of the content type to include the mandatory aspect Versionable.

Please note options for modifying an Alfresco Content Model


  • Search for the content type definition:




     <type name='cm:content'>
        <title>Content</title>
        <parent>cm:cmobject</parent>
        <properties>
           <property name='cm:content'>
              <type>d:content</type>
              <mandatory>false</mandatory>
              <index enabled='true'>
                 <atomic>true</atomic>
                 <stored>false</stored>
                 <tokenised>true</tokenised>
              </index>
           </property>
        </properties>
     </type>




    <type name='cm:content'>
        <title>Content</title>
        <parent>cm:cmobject</parent>
        <properties>
           <property name='cm:content'>
              <type>d:content</type>
              <mandatory>false</mandatory>
              <index enabled='true'>
                 <atomic>true</atomic>
                 <stored>false</stored>
                 <tokenised>true</tokenised>
              </index>
           </property>
        </properties>
        <mandatory-aspects>
           <aspect>cm:versionable</aspect>
        </mandatory-aspects>

     </type>

  • Make the following modification to make the versionable aspect mandatory for the content type:
  • Save the file and re-start the repository.

Now when content is created in the repository the version history will be created.

You can also control which types of content are automatically versionable and which are not by applying the versionable aspect to a custom sub-type of cm:content.


Configuring the Auto-Version Behaviour


By default all versionable content has auto-version on.  With auto-version on a new version is created in the content's version history when the content is updated. 

Auto-Versioning behavior is governed by the following properties


  • initialVersion indicates that when the versionable aspect is applied then an initial snap shot of the node is taken at that point. 
  • autoVersion indicates that when ever a change is made to the content of a node that has the versionable aspect applied a new version will be created.  These can be turned on and off by default by setting the default values on this aspect to get the desired behaviour.

The auto-version capability can be turned off on a per-content basis by setting to the cm:autoVersion property to false, via the UI.

Note: Any content that was made versionable prior to Alfresco 1.1 will have auto-version off.


Content model config


If you want to configure the repository so that new content has auto version off by default then follow these steps:

1. Open the content model definition file /config/alfresco/model/contentModel.xml

2. Search for the cm:versionable aspect definition and change default parameter for cm:autoVersion to false:






     <aspect name='cm:versionable'>
        <title>Versionable</title>
        <properties>
           <property name='cm:versionLabel'>
              <title>Version Label</title>
              <type>d:text</type>
              <protected>true</protected>
           </property>
           <property name='cm:initialVersion'>
              <title>Initial Version</title>
              <type>d:boolean</type>
              <default>true</default>
           </property>
           <property name='cm:autoVersion'>
              <title>Auto Version</title>
              <type>d:boolean</type>
              <default>true</default>
           </property>
         </properties>
     </aspect>

      <aspect name='cm:versionable'>
        <title>Versionable</title>
        <properties>
           <property name='cm:versionLabel'>
              <title>Version Label</title>
              <type>d:text</type>
              <protected>true</protected>
           </property>
           <property name='cm:initialVersion'>
              <title>Initial Version</title>
              <type>d:boolean</type>
              <default>false</default>
           </property>
           <property name='cm:autoVersion'>
              <title>Auto Version</title>
              <type>d:boolean</type>
              <default>false</default>
           </property>
         </properties>
     </aspect>

3. Save the file and re-start the repository.

When content is now made versionable, auto version will be off by default.


Configuring the Auto-Version Behaviour for Property-Only Updates (3.2)


Alfresco 3.2 also adds the ability to auto-version on metadata-only (property) updates, even if the content has not been updated.

For 3.2, Auto-Versioning behavior is governed by the following properties:


  • initialVersion as before, see previous section
  • autoVersion as before, see previous section
  • autoVersionOnUpdateProps indicates that when ever a change is made to the properties of a node that has the versionable aspect applied a new version will be created.  These can be turned on and off by default by setting the default values on this aspect to get the desired behaviour.

This feature is enabled by default in the model and can be demonstrated using Alfresco Explorer with versionable content, although it should be noted that Alfresco Share currently disables this feature (by explicitly setting autoVersionOnUpdateProps=false for upload and checkout).


Content model config


If you want to configure the repository so that new content has auto version of property updates off by default (as pre-3.2) then follow these steps:

1. Open the content model definition file /config/alfresco/model/contentModel.xml

2. Search for the cm:versionable aspect definition and change default parameter for cm:autoVersionOnUpdateProperties to false:






     <aspect name='cm:versionable'>
        <title>Versionable</title>
        <properties>
           <property name='cm:versionLabel'>
              <title>Version Label</title>
              <type>d:text</type>
              <protected>true</protected>
           </property>
           <property name='cm:initialVersion'>
              <title>Initial Version</title>
              <type>d:boolean</type>
              <default>true</default>
           </property>
           <property name='cm:autoVersion'>
              <title>Auto Version</title>
              <type>d:boolean</type>
              <default>true</default>
           </property>
           <property name='cm:autoVersionOnUpdateProps'>
              <title>Auto Version - on update properties only</title>
              <type>d:boolean</type>
              <default>true</default>
           </property>
         </properties>
     </aspect>

      <aspect name='cm:versionable'>
        <title>Versionable</title>
        <properties>
           <property name='cm:versionLabel'>
              <title>Version Label</title>
              <type>d:text</type>
              <protected>true</protected>
           </property>
           <property name='cm:initialVersion'>
              <title>Initial Version</title>
              <type>d:boolean</type>
              <default>false</default>
           </property>
           <property name='cm:autoVersion'>
              <title>Auto Version</title>
              <type>d:boolean</type>
              <default>true</default>
           </property>
           <property name='cm:autoVersionOnUpdateProps'>
              <title>Auto Version - on update properties only</title>
              <type>d:boolean</type>
              <default>false</default>
           </property>
         </properties>
     </aspect>

3. Save the file and re-start the repository.

When content is now made versionable, auto version will be off by default.


Versionable aspect config


If you want to configure auto-versioning on property-only updates (as above) but you also want to configure the repository so that certain property updates are excluded then the versionable aspect can be overridden with a list of excluded properties (in prefix:localname format).

For example, using a custom extension context file:






   <bean id='versionableAspect' class='org.alfresco.repo.version.VersionableAspect' init-method='init'>
       <property name='policyComponent'>
           <ref bean='policyComponent' />
       </property>
       <property name='versionService'>
           <ref bean='versionService'/>
       </property>
       <property name='nodeService'>
           <ref bean='nodeService'/>
       </property>
       <property name='dictionaryDAO'>
           <ref bean='dictionaryDAO'/>
       </property>
       <property name='namespacePrefixResolver'>
           <ref bean='namespaceService'/>
       </property>
       <property name='excludedOnUpdateProps'>
           <list>
               <value>webdav:opaquelocktoken</value>
               <value>webdav:sharedLockTokens</value>
               <value>webdav:lockDepth</value>
               <value>webdav:lockScope</value>
           </list>
       </property>
   </bean>


   <bean id='versionableAspect' class='org.alfresco.repo.version.VersionableAspect' init-method='init'>
       <property name='policyComponent'>
           <ref bean='policyComponent' />
       </property>
       <property name='versionService'>
           <ref bean='versionService'/>
       </property>
       <property name='nodeService'>
           <ref bean='nodeService'/>
       </property>
       <property name='dictionaryDAO'>
           <ref bean='dictionaryDAO'/>
       </property>
       <property name='namespacePrefixResolver'>
           <ref bean='namespaceService'/>
       </property>
       <property name='excludedOnUpdateProps'>
           <list>
               <value>webdav:opaquelocktoken</value>
               <value>webdav:sharedLockTokens</value>
               <value>webdav:lockDepth</value>
               <value>webdav:lockScope</value>
               <value>wfl:status</value>
           </list>
       </property>
   </bean>

In this case, if one or more updated properties match the one of the props in the excluded list then the auto-version will not occur (note: even if there are other properties are also updated).