Search in sources :

Example 1 with BusinessProcessEventType

use of org.camunda.bpm.engine.cdi.BusinessProcessEventType in project camunda-bpm-platform by camunda.

the class CdiEventListener method createEvent.

protected BusinessProcessEvent createEvent(DelegateExecution execution) {
    ProcessDefinition processDefinition = Context.getExecutionContext().getProcessDefinition();
    // map type
    String eventName = execution.getEventName();
    BusinessProcessEventType type = null;
    if (ExecutionListener.EVENTNAME_START.equals(eventName)) {
        type = BusinessProcessEventType.START_ACTIVITY;
    } else if (ExecutionListener.EVENTNAME_END.equals(eventName)) {
        type = BusinessProcessEventType.END_ACTIVITY;
    } else if (ExecutionListener.EVENTNAME_TAKE.equals(eventName)) {
        type = BusinessProcessEventType.TAKE;
    }
    return new CdiBusinessProcessEvent(execution.getCurrentActivityId(), execution.getCurrentTransitionId(), processDefinition, execution, type, ClockUtil.getCurrentTime());
}
Also used : ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BusinessProcessEventType(org.camunda.bpm.engine.cdi.BusinessProcessEventType)

Example 2 with BusinessProcessEventType

use of org.camunda.bpm.engine.cdi.BusinessProcessEventType 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)2 ExecutionContext (org.camunda.bpm.engine.impl.context.ExecutionContext)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1