Alfresco 5.1 Model Manager

With the release of Alfresco 5.1 we saw two main functions added to the system, the ability to create Content Models from within Share and Smart Folders.  Smart Folders are driven mainly by the use of metadata and searches so require Content Models (see our blog on Smart Folders).  This blog will look at how you can use Alfresco Share to generate and deploy Content Models through Share.


In previous versions of Alfresco you could create content models through XML.  You could then deploy them either by bootstrapping them via a bean or as a Dynamic content model.  The issue with bootstrapping them was that in order to make any changes to the content model you had to restart the Content Server.  Dynamic Content models addressed this to a certain extent but were not seamless in their operation with limitations on what could and could not be changed once they were made active in the Repository.  Another limitation of both methods was that, in order for users to interact with the content model types and aspects, a Share form was required.  Forms are created independently of the model and deployed into the Share application.  Furthermore, in both cases,  xml is used to create the content model and forms.  This meant that it was rare for a customer Business Analyst or advanced user to create their own content models.   The good news is that both of these limitations have been addressed with the 5.1 release.

Creating a new Model

You can create a new content model from the Admin Tools page.  We are going to create a HR content model that has one type called Position Description.  Users can use this content type to create a bio for themselves, this will aid collaboration in the organisation, and allowing users to be found based on their skill matrix.  We recently implemented this type of functionality for one of our customers who are using Alfresco to promote collaboration and innovation in their Research and Development department.   

The page below shows the Model Manager with two custom models, Claims and ContractsManagement. 

 Alfreso ECM Model Manager Seed IM Australia

To create a new Model for HR, click the Create Model button.  A dialog will open that allows you to create a new model.   I am showing an example where I am creating a new model for Human Resources. 

Note:  There is a new group in Alfresco called Model Administrators.  Users that are in that group can navigate to the Model Manager via Admin tools but they do not need to be an administrator.   

Alfresco ECM BPM Seed IM Australia

From a business user perspective this is where it gets a little confusing.  What is a Namespace and Prefix etc? 

Namespace: You can just consider it as a way to isolate your content model from others.  Therefore it is a unique name for the model.   Alfresco suggests you use your company URL followed by model and then the prefix you intend to use and finally the version.  So in theory, by doing this your model will be unique within your organisation and also the world.  So in Seeds case it is 

Prefix: The next field is the Prefix, this is just a short name for your model.  We have used hr which is also referenced in our Namespace.  However, it can be anything you like.  Other examples might be fin for financial or manu for manufacturing.

Name:  Name the model, we suggest using camel case, ie simply put, no spaces and capitalise the words. There are a few rules for the name, don’t use a dash (-) in the name.

Click Create to create the model.  Once created it is listed as an inactive model.  Click on the Model Name link.  This opens up the model and allows you build your Types and Aspects.  Click the Create Custom Type model.  The Create Custom Type dialog opens.  You can give the type a unique name, once again we recommend using camel case.  Choose a parent type, we chose cm:content which is the standard type for all documents.  Give the Type a Display Label and description and click Create.

 Alfresco ECM BPM Seed IM Australia

Once the type has been created you can add your custom properties:

Click on the type name to see the properties that are part of the type. Initially there are no properties so click Create Property to add one.

Alfresco ECM BPM Seed IM Australia

This opens the Create Property dialog.  From here you create the property.   Once again use camel case for the property name, add a display label and description.  Choose a Data Type based on the type of information you want to store, if it’s just text or alphanumeric then select d:text.  There are also options for Boolean (True, false), numbers (int, long, double, float) and date-time.  Other values you can set for a field include:

·       Required: Whether it is a mandatory field, i.e. user must provide a value,
·       Multiple:  If the metadata field can have more than one value.
·       Constraint:  This will appear as a dropdown of values if you pick a List of Values option.  You can add your options, one per line.  You can also specify other options such as min/max length or a regular expression for more advanced users.
·       Indexing:  This determines how the metadata field will be added to the full text index and thus its use when users search from Share.  The default Free Text ensures it is added to the index.

In our example below we have created a property called Bio Owner which is a free text field to hold the name of the user who has created the bio.  This will help users who find this Position Description to identify the person it relates to.

Alfresco ECM BPM Seed IM Australia

You can continue and add more properties to your type and to build out your content model by creating new types and aspects.


Creating the supporting Share Forms

Before users can manage the metadata for your type you need to create the forms that are displayed in Share.  Each type has a set of forms that are configured for it that determines what and how the metadata fields should be displayed.  The new Model Manager allows you to configure this using a drag and drop designer. 

Navigate back to the Type and in the Actions dropdown, select Layout Designer.  This opens the Layout Designer Page for the type.

Alfresco ECM BPM Seed IM Australia

The first thing you need to do is to drag a layout onto the layout manager.  I selected the single column as I only have one field, but there are also options for multiple columns if you want to group your fields.  This is a nice improvement on current form building which makes this more difficult.  Once you have dragged your layout onto the page, update its details to add a label to the layout.  This label shows up on the properties section of the document details and therefore helps your users to quickly navigate to the HR specific fields.

Alfresco ECM BPM Seed IM Australia

Next drag the metadata fields you want to display onto the layout.   I found it easier to click Apply Default Layout, which adds all of the standard metadata fields and then to remove the ones I did not want. 

 Alfresco ECM BPM Seed IM Australia

My next step is to configure my custom field.  If you click on the field itself it brings up the Edit Properties dialog for the field.  The following attributes may be set for the property to influence how it is displayed:

  • Form Control:  It displays the form controls that are available based on the type of content.  So in my example it is a text field so therefore I can use a text field, text area or rich text field.
  • View Mode:  You can choose the display you are configuring for users viewing the metadata (document details page) or editing the metadata (Edit Properties dialog).  There is also an Any option which covers both.
  • Read Only:  You can set the field to only be visible in read only mode.
  • Hidden:  You can hide the property.  For process driven metadata you may want to do this.
  • Force Display:  Select this if you want to show the field even if it has no value in Alfresco.

Once I have created my display I click Save.   

Deploying the Model

Once the model, type and property are configured I can now Activate my model.  A model is not visible to users from Share until it is activated.  Navigate back to the Model list in the Model Manger.  For your model click the Action, Activate. 

Once activated, the type appears in the Specialise Type action so that users can apply it to documents they have created.  You can do this manually or via a rule.   

Once specialised the type now has the Bio Owner field.  This can be seen in the View Document Details Properties display as we configured the form for Any.

Alfresco ECM BPM Seed IM Australia

Clicking the Edit Properties shows that the field is also available for the editing forms :

Alfresco ECM BPM Activiti Seed IM Australia


Some Considerations

Search:  One item that appears to be missing from the Model Manager forms is the ability to create a search form.  This would be a nice feature to add to the tool as users often use search based on the metadata for Content Discovery.  We also noted that you cannot add the properties that are in the model as custom Facets in the search engine.  This may be possible following a restart of the system once solr becomes aware of the new content model.  But, once again this requires a restart of the system or at very least system admin involvement.

Associations:  A key part of any model is building the relationships between content.  In Alfresco terms that means Associations.  Associations are not supported in the Model Management tool.

 Export/Import Models:  It is possible to import and export the model and its form layout.  However, we cannot find any documentation on how to package a model to be imported.  We have created many content models for our customers over the years and it would be nice to be able to import them into the Model manager for simpler management.  Also,  it would be good to be able to export the model and forms and change them manually from the xml.   This would allow us to use the full feature not currently supported by the tool such as associations or custom display controls.


The Model Management tool is a great new feature that Alfresco has added.  It will greatly enhance an organisations ability to create ontologies and manage their content based on the business realm it applies to.  It also supports Case Management through Smart Folders.   We look forward to further releases of the functionality that address some of its missing functionality and the ability to support the full content modelling capability that Alfresco provides.


Alfresco Docs - ECM Model Management

Imort/Export Content Model

Aspects & Models

Tech Talk Live - Model Manager