Versioning Behaviour

From AlfrescoWiki

Jump to: navigation, search

Back to Server Administration Guide

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

[edit] Making All Content Versionable

Out-of-the-box content in Alfresco DM is not versionable. Content must be specifically marked as being versionable via the JSF client UI before versions can be created.

When content is first marked as Versionable a version history is created containing an initial snap-shot of the content.

If you want all content to be versionable from the moment it is created 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.

[edit] 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.</i>

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

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

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

1. Open the content model definition file /config/alfresco/model/contentModel.xml 2. Search for the versionable aspect definition and change default parameter for 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.