use of org.activiti.engine.impl.pvm.delegate.ActivityExecution in project Activiti by Activiti.
the class EventSubProcessStartEventActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
InterpretableExecution interpretableExecution = (InterpretableExecution) execution;
ActivityImpl activity = interpretableExecution.getProcessDefinition().findActivity(activityId);
ActivityExecution outgoingExecution = execution;
if (isInterrupting) {
execution.destroyScope("Event subprocess triggered using activity " + activityId);
} else {
outgoingExecution = execution.createExecution();
outgoingExecution.setActive(true);
outgoingExecution.setScope(false);
outgoingExecution.setConcurrent(true);
}
// set the outgoing execution to this activity
((InterpretableExecution) outgoingExecution).setActivity(activity);
// continue execution
outgoingExecution.takeAll(activity.getOutgoingTransitions(), Collections.EMPTY_LIST);
}
use of org.activiti.engine.impl.pvm.delegate.ActivityExecution in project Activiti by Activiti.
the class GatewayActivityBehavior method lockConcurrentRoot.
protected void lockConcurrentRoot(ActivityExecution execution) {
ActivityExecution concurrentRoot = null;
if (execution.isConcurrent()) {
concurrentRoot = execution.getParent();
} else {
concurrentRoot = execution;
}
((ExecutionEntity) concurrentRoot).forceUpdate();
}
use of org.activiti.engine.impl.pvm.delegate.ActivityExecution in project Activiti by Activiti.
the class InclusiveGatewayActivityBehavior method getLeaveExecutions.
List<? extends ActivityExecution> getLeaveExecutions(ActivityExecution parent) {
List<ActivityExecution> executionlist = new ArrayList<ActivityExecution>();
List<? extends ActivityExecution> subExecutions = parent.getExecutions();
if (subExecutions.isEmpty()) {
executionlist.add(parent);
} else {
for (ActivityExecution concurrentExecution : subExecutions) {
executionlist.addAll(getLeaveExecutions(concurrentExecution));
}
}
return executionlist;
}
use of org.activiti.engine.impl.pvm.delegate.ActivityExecution in project Activiti by Activiti.
the class InclusiveGatewayActivityBehavior method activeConcurrentExecutionsExist.
public boolean activeConcurrentExecutionsExist(ActivityExecution execution) {
PvmActivity activity = execution.getActivity();
if (execution.isConcurrent()) {
for (ActivityExecution concurrentExecution : getLeaveExecutions(execution.getParent())) {
if (concurrentExecution.isActive() && concurrentExecution.getId().equals(execution.getId()) == false) {
// TODO: when is transitionBeingTaken cleared? Should we clear it?
boolean reachable = false;
PvmTransition pvmTransition = ((ExecutionEntity) concurrentExecution).getTransitionBeingTaken();
if (pvmTransition != null) {
reachable = isReachable(pvmTransition.getDestination(), activity, new HashSet<PvmActivity>());
} else {
reachable = isReachable(concurrentExecution.getActivity(), activity, new HashSet<PvmActivity>());
}
if (reachable) {
if (log.isDebugEnabled()) {
log.debug("an active concurrent execution found: '{}'", concurrentExecution.getActivity());
}
return true;
}
}
}
} else if (execution.isActive()) {
// is this ever true?
if (log.isDebugEnabled()) {
log.debug("an active concurrent execution found: '{}'", execution.getActivity());
}
return true;
}
return false;
}
use of org.activiti.engine.impl.pvm.delegate.ActivityExecution in project Activiti by Activiti.
the class MultiInstanceActivityBehavior method getLoopVariable.
protected Integer getLoopVariable(ActivityExecution execution, String variableName) {
Object value = execution.getVariableLocal(variableName);
ActivityExecution parent = execution.getParent();
while (value == null && parent != null) {
value = parent.getVariableLocal(variableName);
parent = parent.getParent();
}
return (Integer) (value != null ? value : 0);
}
Aggregations