Search in sources :

Example 1 with ExecutionTopDownWalker

use of org.camunda.bpm.engine.impl.tree.ExecutionTopDownWalker in project camunda-bpm-platform by camunda.

the class ExecutionEntity method dispatchEvent.

@Override
public void dispatchEvent(VariableEvent variableEvent) {
    final List<ExecutionEntity> execs = new ArrayList<ExecutionEntity>();
    new ExecutionTopDownWalker(this).addPreVisitor(new TreeVisitor<ExecutionEntity>() {

        @Override
        public void visit(ExecutionEntity obj) {
            if (!obj.getEventSubscriptions().isEmpty() && (obj.isInState(ActivityInstanceState.DEFAULT) || (!obj.getActivity().isScope()))) {
                // state is default or tree is compacted
                execs.add(obj);
            }
        }
    }).walkUntil();
    for (ExecutionEntity execution : execs) {
        execution.handleConditionalEventOnVariableChange(variableEvent);
    }
}
Also used : TreeVisitor(org.camunda.bpm.engine.impl.tree.TreeVisitor) CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) ArrayList(java.util.ArrayList) ExecutionTopDownWalker(org.camunda.bpm.engine.impl.tree.ExecutionTopDownWalker)

Aggregations

ArrayList (java.util.ArrayList)1 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)1 ExecutionTopDownWalker (org.camunda.bpm.engine.impl.tree.ExecutionTopDownWalker)1 TreeVisitor (org.camunda.bpm.engine.impl.tree.TreeVisitor)1