Do service tasks have access to the process engine?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2012 10:46 AM
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 }}
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2012 10:32 AM
use ProcessEngines.getDefaultProcessEngine() to get the default processEngine and use processEngine.getTaskService() for example to get the task service of Activiti.
hth
hth

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2012 08:26 PM
I was not aware of that API. That helps. Thanks.
Sang
Sang
