You are here

VersionHistoryNode API

The VersionHistoryNode is an extension of the BaseContentNode type. The versionHistory property of the TemplateNode object returns a sequence of VersionHistoryNode objects that represent the version history for the document.


Each VersionHistoryNode objects have the following properties:

Property Description
aspects Returns the list of aspects applied to this node as a set of QNames.
children Returns the children of this node as a list of TemplateProperties objects.
createdDate Created date of the version.
creator Creator of the version.
description Version history description.
id GUID for the node.
isMajorVersion Boolean true if this was a major version.
name Name property of the node version record.
nodeRef NodeRef string for the node.
parent Returns the primary parent of this node.
properties Returns a map of the properties of the object.
title Get the title of the node.
type Fully qualified QName type of the node.
url URL to the content stream for the frozen content state.
versionLabel Version label of the version record.
Note: The property is set to false by default. This means that the version history is not incremented when using Edit Properties in Share. Set this property to in to enable this property.


<#assign versionHistoryNodes = node.versionHistory>

<#list versionHistoryNodes as vhn>

    <#list vhn.aspects as aspect>

 <#if vhn.children?exists>
     <#list vhn.children as child>
   <p>No children</p>

   <p>createDate (and time): ${vhn.createdDate?datetime}</p>
   <p>creator: ${vhn.creator}</p>
   <p>description: <#if vhn.description?exists>${vhn.description}<#else>None</#if></p>
   <p>id: ${}</p>
   <p>isMajorVersion: <#if vhn.isMajorVersion>TRUE<#else>FALSE</#if></p>
   <p>name: ${}</p>
   <p>nodeRef: ${vhn.nodeRef}</p>
   <p>parent: <#if vhn.parent?exists>${}<#else>None</#if></p>
   <p>type: ${vhn.type}</p>
   <p>url: ${vhn.url}</p>
   <p>versionLabel: ${vhn.versionLabel}</p>
   <p>All properties for the VersionHistoryNode object:</p>

   <table border=1>
     <#assign object = vhn>
     <#assign props =>
     <#list props as t>
         <tr><td>${t} = ${[t]?date}</td></tr>
         <tr><td>${t} = ${[t]?string("yes", "no")}</td></tr>
              <#assign items =[t]>
              <#assign i = 0>
                <#list items as item>
                  <p>${i}: ${item}</p>
                  <#assign i = i+1>
        <tr><td>${t} = ${[t]}</td></tr>

   <p>content: ${cropContent(, 150)}</p>

   <p>auditable: <#if vhn.hasAspect("cm:auditable")>TRUE<#else>FALSE</#if></p>
   <p>author: <#if vhn.hasAspect("cm:author")>TRUE<#else>FALSE</#if></p>
   <p>title: <#if vhn.hasAspect("cm:titled")>TRUE<#else>FALSE</#if></p>
   <p>taggable: <#if vhn.hasAspect("cm:taggable")>TRUE<#else>FALSE</#if></p>



The preceding code would generate output similar to the following:



children: No children

createDate (and time): Jan 9, 2012 2:16:43 PM

creator: admin

description: None

id: 7a37ec71-8b40-44be-be1d-5e2123cf0098

isMajorVersion: FALSE

name: TEST

nodeRef: versionStore://version2Store/7a37ec71-8b40-44be-be1d-5e2123cf0098

parent: None

type: {}content

url: /d/d/versionStore/version2Store/7a37ec71-8b40-44be-be1d-5e2123cf0098/TEST

versionLabel: 1.8

All properties for the VersionHistoryNode object:

{}creator = admin
{}author = Tony
{}autoVersion = yes
{}autoVersionOnUpdateProps = yes
{}locale = en_US
{}commentCount = 2
{}store-protocol = workspace
0: workspace://SpacesStore/fd353ba5-bfc3-4b32-b178-02206cf48d19

1: workspace://SpacesStore/e8fc0d83-8127-4015-942d-212303112ef1

2: workspace://SpacesStore/d05e3921-063e-4ced-b2ae-dc918ed3e14c

3: workspace://SpacesStore/43aacfb5-899a-4185-83a1-e88f51861d99

4: workspace://SpacesStore/5f8cebc4-ae48-404f-bdb5-5ed2e73aa180

{}editInline = yes
{}content = org.alfresco.repo.template.BaseContentNode$TemplateContentData@34df2786
{}title = My sample test program
{}node-uuid = eae9d90f-706f-46ba-9cc5-63b31e1e7fcb
{}modifier = admin
{}name = TEST
{}modified = Jan 9, 2012
{}initialVersion = yes
{}store-identifier = SpacesStore
{}created = Jan 5, 2012
{}node-dbid = 1,927
{}versionLabel = 1.8
{}description = A sample test program

content: The first 150 bytes content of the file ...

auditable: TRUE

author: TRUE

title: TRUE

taggable: TRUE


Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.