01-10-2012 03:47 AM
<userTask id="DataValidator" name="Data Validator">
<extensionElements>
<activiti:taskListener event="create" class="com.xxx.xxx.TaskAssignmentHandler">
<activiti:field name="candidateGroup" stringValue="QA" />
</activiti:taskListener>
</extensionElements>
</userTask>
Corresponding Java Code like following
@Service
public class TaskAssignmentHandler implements TaskListener{
@Autowired
private IdentityService identityService;
@Autowired
private WorkflowHistoryService historyService;
private Expression candidateGroup;
@Override
public void notify(DelegateTask task){
// do something
}
}
<userTask id="DataValidator" name="Data Validator">
<extensionElements>
<activiti:taskListener event="create" class="${taskAssignHandlerBean}">
<activiti:field name="candidateGroup" stringValue="QA" />
</activiti:taskListener>
</extensionElements>
</userTask>
And I add serialiable on to the class definition
@Service
public class TaskAssignmentHandler implements TaskListener, [color=#0000FF]Serializable[/color]{
And add one instance of TaskAssignmentHandler into instance of activiti. It still not work, because it requires any field of TaskAssignmentHandler implements Serializable. 01-10-2012 09:50 AM
01-10-2012 09:58 PM
Hi,Sorry, I have mentioned I didn't want to add Serializable interface to those field of my self extend class.
In the Activiti in Action book you get an example of how to implement this.
When you want to use a Spring bean you should use the expression attribute in stead of the class attribute.
Best regards,
public class TaskAssignmentHandler implements TaskListener{
private IdentityService identityService;
private WorkflowHistoryService historyService;
private Expression candidateGroup;
public TaskAssignmentHandler(){
//Initialize those field here.
identityService = AppContext.getApplicationContext().getBean("xxxx");
// Same like this
WorkflowHistoryService = ………..;
}
@Override
public void notify(DelegateTask task){
// do something
}
}
In the definition xml, I still use the class instead of delegateExpression
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.