Search in sources :

Example 1 with ActivityInstanceStartHandler

use of org.activiti.engine.impl.history.handler.ActivityInstanceStartHandler in project Activiti by Activiti.

the class MultiInstanceActivityBehavior method callCustomActivityStartListeners.

/**
   * Since the first loop of the multi instance is not executed as a regular activity,
   * it is needed to call the start listeners yourself.
   */
protected void callCustomActivityStartListeners(ActivityExecution execution) {
    List<ExecutionListener> listeners = activity.getExecutionListeners(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_START);
    List<ExecutionListener> filteredExecutionListeners = new ArrayList<ExecutionListener>(listeners.size());
    if (listeners != null) {
        for (ExecutionListener executionListener : listeners) {
            if (!(executionListener instanceof ActivityInstanceStartHandler)) {
                filteredExecutionListeners.add(executionListener);
            }
        }
        CallActivityListenersOperation atomicOperation = new CallActivityListenersOperation(filteredExecutionListeners);
        Context.getCommandContext().performOperation(atomicOperation, (InterpretableExecution) execution);
    }
}
Also used : ActivityInstanceStartHandler(org.activiti.engine.impl.history.handler.ActivityInstanceStartHandler) ArrayList(java.util.ArrayList) ExecutionListener(org.activiti.engine.delegate.ExecutionListener)

Aggregations

ArrayList (java.util.ArrayList)1 ExecutionListener (org.activiti.engine.delegate.ExecutionListener)1 ActivityInstanceStartHandler (org.activiti.engine.impl.history.handler.ActivityInstanceStartHandler)1