Search in sources :

Example 1 with ExecutionContext

use of org.camunda.bpm.engine.impl.context.ExecutionContext in project camunda-bpm-platform by camunda.

the class CdiEventListener method createEvent.

protected BusinessProcessEvent createEvent(DelegateTask task) {
    ExecutionContext executionContext = Context.getExecutionContext();
    ProcessDefinitionEntity processDefinition = null;
    if (executionContext != null) {
        processDefinition = executionContext.getProcessDefinition();
    }
    // map type
    String eventName = task.getEventName();
    BusinessProcessEventType type = null;
    if (TaskListener.EVENTNAME_CREATE.equals(eventName)) {
        type = BusinessProcessEventType.CREATE_TASK;
    } else if (TaskListener.EVENTNAME_ASSIGNMENT.equals(eventName)) {
        type = BusinessProcessEventType.ASSIGN_TASK;
    } else if (TaskListener.EVENTNAME_COMPLETE.equals(eventName)) {
        type = BusinessProcessEventType.COMPLETE_TASK;
    } else if (TaskListener.EVENTNAME_DELETE.equals(eventName)) {
        type = BusinessProcessEventType.DELETE_TASK;
    }
    return new CdiBusinessProcessEvent(task, processDefinition, type, ClockUtil.getCurrentTime());
}
Also used : ExecutionContext(org.camunda.bpm.engine.impl.context.ExecutionContext) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) BusinessProcessEventType(org.camunda.bpm.engine.cdi.BusinessProcessEventType)

Aggregations

BusinessProcessEventType (org.camunda.bpm.engine.cdi.BusinessProcessEventType)1 ExecutionContext (org.camunda.bpm.engine.impl.context.ExecutionContext)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1