Overriding Workflow Descriptions (messages)

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
chrisokelly
Active Member

Overriding Workflow Descriptions (messages)

Hi guys,

Following a few of the topics on this forum, I've tried to override some of the descriptions of the OOTB workflows in Alfresco (specifically in the share client). Essentially my manager has advised me that 99.9% of employees have no idea (or care) what the activiti engine is/does, and having "…using the activiti engine" on the end will do nothing but confuse them.

I've created in the tomcat/share/classes/alfresco/extension folder a messages-extension-context.xml file with the following content:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN'
   'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="webscripts.resources"
         class="org.alfresco.i18n.ResourceBundleBootstrapComponent">

      <property name="resourceBundles">
         <list>
            <value>alfresco.messages.messageOverrides</value>
         </list>
      </property>
   </bean>
</beans>

and added to the custom-slingshot-application-context.xml file in ../web-extension:
   <bean id="webscripts.kb.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>alfresco.messages.companymodel</value>
            <value>alfresco.messages.companymodel_pronto</value>
            <value>alfresco.messages.messageOverrides</value>
         </list>
      </property>
   </bean>
(the other two message files had been previously added and work fine)

in messageOverrides in the tomcat/share/classes/alfresco/messages folder (I saw in quite a few of the other posts people put a messages folder in both extension and web-extension. I did not see a reason to keep two copies of the same file) I have:

activitiAdhoc.workflow.description=Assign arbitrary task to colleague
activitiReview.workflow.description=Review and approval of content
activitiParallelReview.workflow.description=Parallel Review and approval of content
activitiReviewPooled.workflow.description=Pooled review and approval of content
activitiParallelGroupReview.workflow.description=Group review and approval of content
publishWebContent.workflow.description=Publishing of web content
which was copied from /opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/workflow/workflow-messages.properties and changed to suit.

I've restarted the server but still see the same description for all these workflows. Are the OOTB workflows hard coded somewhere to use the original properties files? I also cleared browser caches to be sure.

I also mentioned above I have the file in one 'messages' folder on the same level as the extension and web-extension folders, rather than a folder under each of them, but have also tried copying the file into this location (and changing the path in the context files to match) to no avail.

We use alfresco 4.0.d on ubuntu server 10.04
3 Replies
arnoldschrijve1
Active Member

Re: Overriding Workflow Descriptions (messages)

Workflows have their own resource bundle(s). They are set by the WorkflowDeployer when Alfresco is bootstrapping.
You can see the current configuration by looking in: webapps/alfresco/WEB-INF/classes/alfresco/bootstrap-context.xml and looking for bean with id="workflowBootstrap".

As you can see the full list of Activiti and jBPM workflow definitions is defined, and they are all connected with the workflowModel.xml and workflow-message.properties (among others).

You can create your own bean in alfresco extension directory, and refer to your own message bundle for both custom and the standard workflow definitions, and you can effectively override the individual labels that are defined in workflow-messages.properties (you could also completely override the full workflow-message.properties file).

In webapp/alfresco/WEB-INF/classes/alfresco/extension/MyActivitiWorkflow.context.xml:



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="MyActivitiWorkflow_workflowModel_workflowBootstrap" parent="workflowDeployer">
        <property name="workflowDefinitions">
            <list>
                <props>
                    <prop key="engineId">activiti</prop>
                    <prop key="location">alfresco/extension/workflows/MyActivitiWorkflow.bpmn20.xml</prop>
                    <prop key="mimetype">text/xml</prop>
                   
                    <!– Should normally only be set to true during workflow development. –>
                    <prop key="redeploy">false</prop>
                </props>
            </list>
        </property>
        <property name="models">
            <list>
                <value>alfresco/extension/workflows/MyActivitiWorkflow.model.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/extension/workflows/MyActivitiWorkflow</value>
            </list>
        </property>
    </bean>
</beans>


Create the model and MyActivitiWorkflow.properties file in the extension/workflows dir and restart Alfresco. Your workflow title and description labels should be used.

Hope this helps.
chrisokelly
Active Member

Re: Overriding Workflow Descriptions (messages)

Thanks, this worked fine, I think the difference was the bean parent and class for my override, I was using the same I had used for webscripts.
douglascrp
Advanced II

Re: Overriding Workflow Descriptions (messages)

Your tip worked.

As what I wanted to change was only the message properties files, then my bean ended simpler than yours.


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="MyActivitiWorkflow_workflowModel_workflowBootstrap" parent="workflowDeployer">
        <property name="labels">
            <list>
                <value>alfresco/extension/workflows/MyActivitiWorkflow</value>
            </list>
        </property>
    </bean>
</beans>

Thank you for sharing it.