To continue our series of posts highlighting common design patterns that we see in many Alfresco implementations (see previous posts on Auto-Filing and Data List-Drive Value Assistance, this post will focus on another Alfresco module package (AMP) that TSG has developed that provides a configurable way to automatically number content with a unique numbering sequence upon creation.
Introduction
Many of our ECM implementations have requirements for labeling content with a unique identifier that is separate from the unique ID that is generated by the content management platform (r_object_id in Documentum and sys:node-uuid in Alfresco). Auto-numbering requirements are particularly prevalent in regulated industries using controlled document systems. Overall, it’s a best practice to implement a unique identifier aside from the system generated unique ID because looking forward, it is likely that at some point in the future, the content will be migrated to a newer version of the ECM platform, or to a different platform altogether. In these cases, it’s often impossible to have the new system generate identifiers in the same way as the old system. See our previous post on Documentum r_object_id – Thoughts and Best Practices for more information.
Generating a unique ID separate from the ECM platform’s unique ID can also allow content to be more easily identified by its ID using prefixes and suffixes along with a sequence number. Different document types can be given different prefixes or suffixes. For example, standard operating procedure documents can be given a prefix of “SOP” followed by a sequence number. That way users will know that the document is a standard operating procedure just by looking at the ID.
To make auto-numbering simple in Alfresco, we’ve developed a configurable AMP module to automatically generate a unique ID for new content at creation time, and set that ID as a property of the content. A single numbering configuration can be created to apply to all document types in the repository, or separate configurations can be defined for different document types. Here’s how it works:
Configuration
In order to avoid code changes for each implementation, the auto-numbering module is configurable. System administrators can simply initiate a web service call from a browser in order to set up the auto-numbering configuration(s) for their Alfresco repository. Behind the scenes, configurations are stored as contentless objects in the repository and can be modified/deleted at any time. Auto-numbering configurations include the following parameters:
- Prefix – optional prefix to be added to the sequence number
- Suffix – optional suffix to be added to the sequence number
- Starting Number – starting number for the auto-numbering scheme. The numbering sequence can have any number of leading zeros (e.g. “00000001”)
- Types – Alfresco content types that the auto-numbering configuration applies to
- Set Properties – the property or properties that auto-number will be applied to. For example, the number can be set as the document name, title, or any other custom metadata field.
Aspects and Behaviors
Similar to the auto-filing functionality described in our previous post, once the auto-number configurations are in place, Alfresco behaviors do the rest of the work. Behaviors allow custom functionality to be to be injected into the repository when certain events occur, such as new content being created. The auto-numbering AMP uses behaviors to watch for new content being created in the repository so that the next number in the sequence can be generated and automatically applied as a property of the new content.
The final piece of the puzzle is telling the repository which content should be auto-numbered. We utilize an Alfresco aspect for this. Any content that should be auto-numbered receives an “Autonumber” aspect. Aspects can be automatically applied to content by making them mandatory aspects in the content model, or by setting up folder rules in the repository to apply the aspect.
Summary
Many ECM implementations have a need for a unique identifier that is different from the unique ID given by the ECM system. In fact, auto-numbering is in the list of TSG best practices for any ECM implementation because it can help make the system more future-proof when considering upgrades and migrations down the road. Auto-numbering requirements can be easily met in a configurable manner using the Alfresco auto-numbering AMP.
Please add comments and feedback below.