cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement Auto task in Alfresco for Activiti

kavilash23
Champ on-the-rise
Champ on-the-rise
Hi guys,

I am using activiti to built a workflow and I need to create an automated task so as to access certain custom type model properties in Alfresco from the workflow.  The task has to carry out a number of functions such as transforming a document and applying an md5 hash to the content.  As such we would like to implement the task using a JAVA bean.   And from the alfresco/activiti documentation, It is unclear how to do this.  The two options seem to be:

Extend the BaseJavaDelegate  class
Or
Implement the ActivityBehavior interface.

So can anyone shed some light on how to implement this for an Alfresco Activiti workflow.

Regards,

Kavi
1 REPLY 1

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Hi,

You could do it creating a service task:

In the workflow definition define the service task:

<serviceTask id="socialPublish" name="My task" activiti:delegateExpression="${myTask}">
   <documentation>My task</documentation>
</serviceTask>

In the spring bean define the myTask bean as follows and add it to the activitiBeanRegistry:

<util:map id="activitiBeanRegistry" map-class="java.util.HashMap">
        <entry key="services" value-ref="ServiceRegistry"/>
        <entry key="myTask" value-ref="myTask"/>
    </util:map>
   
   
   <bean id="myTask" class="org.alfresco.poc.wf.delegates.MyTaskDelegate">
      <property name="…">
         <ref bean="…" />
      </property>
   </bean>

The MyTaskDelegate has to extend the JavaDelegate class

More info in here

Adei