Monday, September 19, 2011

How to use delegateExpression in activiti

In Activiti if you want to call an existing delegate class form a work flow task use delegate expression option.

We need to add the delegate classes into the spring context (i.e. activiti context) so that it will available to activiti engine

Here is the picture of activiti (please do not confuse, I merged two service tasks properties into one diagram):



Delegate classes:

package com.example.delegate.tasks;

import org.activiti.engine.delegate.DelegateExecution;

public class TomcatDelegate implements JavaDelegate {

@Override
public void execute(DelegateExecution execution) throws Exception {
System.out.println("***TomcatDelegate***");

}

}

package com.example.delegate.tasks;

import org.activiti.engine.delegate.DelegateExecution;

public class ServiceMixDelegate implements JavaDelegate {

@Override
public void execute(DelegateExecution execution) throws Exception {
System.out.println("***ServiceMixDelegate***");

}

}


package com.example.delegate.tasks;

import org.activiti.engine.delegate.DelegateExecution;

public class UpgradeDelegate implements JavaDelegate{

@Override
public void execute(DelegateExecution execution) throws Exception {
System.out.println("***UpgradeDelegate***");

}

}

Here is activiti xml tag where you have to add the delegate classes:

2 comments: