Version Baselining

cancel
Showing results for 
Search instead for 
Did you mean: 

Version Baselining

pmonks2
Member II
0 33 42.6K
One of the great things about working with Alfresco is the vast number of extension points the system offers to developers.  Some of these stem from the pervasive use of the Spring framework, some of them to a well thought out application architecture, and many of them from a number of guiding principles that are consistently applied even when their potential uses aren't necessarily known with certainty ahead of time.



I recently had the pleasure of being reminded of this latter case when a customer asked for an extension that allowed their content contributors to control the 'baseline' version number of documents in their Alfresco installation.  The idea was to allow their contributors to (optionally) enter a version number along with each document, and have the Alfresco versioning system start with that version number instead of the default of 1.0.



Although I didn't know how this might be achieved, in less than 10 minutes I had my answer and it relied on a slight variation of a mechanism that I'd used in the past.  The customer was also gracious enough to release the IP, so I've made the initial version of the extension available on google code.



Here is a brief overview of its usage:



This extension works by extending Alfresco with a custom content type called 'Version Baselined Content' that includes a single property called 'Base Version'.  This property is where the content contributor can set the base version to be used if/when versioning is enabled on the document.



In order to create content of this type, 'Version Baselined Content' needs to be selected in the 'Type' dropdown of the 'Add Content Dialog':





Provided the 'Modify all properties when this page closes' checkbox is left checked (the default), the contributor will then be presented with the option to specify the base version number for this document (if/when versioning is enabled):





The default value for this field is '0.1' – if the contributor elects to skip modification of the new content's properties, this is the base version number it will be assigned automatically.



The base version number must be a valid non-negative decimal number (ie. it must be a number greater than or equal to 0.0).  If an invalid value is entered, an error will be displayed when the user clicks the 'OK' button.



Once the version number is populated, it may be edited via the document's properties as many times as are necessary, up until the time versioning is enabled for the document:





Once versioning is enabled for the document, the initial version number will be set to the value of the 'Base Version Number' property at that time:





From this point on, any modifications to the 'Base Version Number' property will be ignored as it is not possible to renumber an existing Alfresco version history.



Other than allowing explicit control over the initial version number for a document, this extension does not change any other versioning behavior in the system.  For example creating a new minor revision of a document (via checkout and checkin) will increment the version number by 0.1.  Similarly, creating a new major revision of a document (via checkout and checkin) will increment the major component of the version number by 1, and set the minor component to 0:

 







While the extension is quite neat and (due to the generosity of the customer) available for anyone to use, refine and extend, what really grabbed me as I developed it was how, despite having no prior experience with this particular extension point, it was familiar enough that I was able to understand it almost immediately and leverage it to achieve the desired goal.
33 Comments