BLOG

Adding an evaluation filter to Alfresco’s form config

The Surf based Alfresco Share web application provides a highly customizable framework that allows you to override and customize the user interface via the share-config-custom.xml file. In this file, an evaluator element <config evaluator=”” condition=””> is used to target the elements for customization. These evaluators are managed by the SpringSurf XmlConfigService. This service is extended by the Alfresco web client framework to include the following default evaluators:

In addition to these you can implement your own evaluators. For example a StringRegexEvaluator that uses a regex to match any pattern defined in your share-custom-config.xml to override an element in the Share application. The two items needed for registering a custom evaluator is an evaluator plugin registration, along with the Java class that defines the Evaluator. For example:

 

And in your share-custom-config.xml, register the evaluator in the plug-ins element, as follows

Once this is in place, you can continue to to define your customizations in the share-config-custom.xml file using the string-regex evaluator with a regular expression as the condition. For example:

 

 

And in your pom.xml, you will need the following dependency:

 

To see a working example of this configuration, review the Alfresco Workflow Form Upload project, which uses this evaluator to add the upload functionality to all the activiti forms.

 

Note: This evaluation filter is not a spring wired bean. It will be instantiated when used.

Leave a Reply

Your email address will not be published. Required fields are marked *