String notificationEvent = Event.EVENTTYPE_TASK_ASSIGN;
Event event = task.getEvent(notificationEvent);
if (event == null)
{
event = new Event(notificationEvent);
task.addEvent(event);
}
Delegation delegation = createMailDelegation(notificationEvent, null, null, null, null);
Action action = new Action(delegation);
action.setProcessDefinition(processDefinition);
action.setName(task.getName());