cancel
Showing results for 
Search instead for 
Did you mean: 

Do service tasks have access to the process engine?

sangv
Champ in-the-making
Champ in-the-making
I wanted to use some of the services like taskService to execute some queries with in a service task (implementing ActivitiBehavior or JavaDelegate). Is there a simple way to get access to the process engine and the various services without having to inject them specifically as a field or using spring beans?

public class CleanupTasksDelegate implements ActivityBehavior {

   @Override
   public void execute(ActivityExecution execution) throws Exception {
      //query all incomplete user tasks in this process instance and delete/complete them
      
   }

}
2 REPLIES 2

chris_joelly
Champ in-the-making
Champ in-the-making
use ProcessEngines.getDefaultProcessEngine() to get the default processEngine and use processEngine.getTaskService() for example to get the task service of Activiti.

hth

sangv
Champ in-the-making
Champ in-the-making
I was not aware of that API. That helps. Thanks.

Sang