use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class StageActivityBehavior method performStart.
// start /////////////////////////////////////////////////////////////////////
protected void performStart(CmmnActivityExecution execution) {
CmmnActivity activity = execution.getActivity();
List<CmmnActivity> childActivities = activity.getActivities();
if (childActivities != null && !childActivities.isEmpty()) {
List<CmmnExecution> children = execution.createChildExecutions(childActivities);
execution.createSentryParts();
execution.triggerChildExecutionsLifecycle(children);
if (execution.isActive()) {
execution.fireIfOnlySentryParts();
// then the stage will be completed.
if (execution.isActive()) {
checkAndCompleteCaseExecution(execution);
}
}
} else {
execution.complete();
}
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class AtomicOperationCaseExecutionDisable method preTransitionNotification.
protected void preTransitionNotification(CmmnExecution execution) {
CmmnExecution parent = execution.getParent();
if (parent != null) {
CmmnActivityBehavior behavior = getActivityBehavior(parent);
if (behavior instanceof CmmnCompositeActivityBehavior) {
CmmnCompositeActivityBehavior compositeBehavior = (CmmnCompositeActivityBehavior) behavior;
compositeBehavior.handleChildDisabled(parent, execution);
}
}
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testTerminateSubCaseInstance.
/**
* removed manual start as it is handled by default behaviour
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testTerminateSubCaseInstance() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
// when
terminate(subCaseInstanceId);
// then
CmmnExecution subCaseInstance = (CmmnExecution) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
assertTrue(subCaseInstance.isTerminated());
CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK);
assertNotNull(caseTask);
assertTrue(caseTask.isActive());
// complete ////////////////////////////////////////////////////////
close(subCaseInstanceId);
assertCaseEnded(subCaseInstanceId);
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionStateTransitionCollector method notify.
public void notify(DelegateCaseExecution planItem) throws Exception {
CmmnExecution execution = (CmmnExecution) planItem;
String activityId = execution.getEventSource().getId();
CaseExecutionState previousState = execution.getPreviousState();
String previousStateName = "()";
if (!previousState.equals(CaseExecutionState.NEW)) {
previousStateName = previousState.toString();
}
CaseExecutionState newState = execution.getCurrentState();
String stateTransition = previousStateName + " --" + execution.getEventName() + "(" + activityId + ")--> " + newState;
LOG.debug("collecting state transition: " + stateTransition);
stateTransitions.add(stateTransition);
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution in project camunda-bpm-platform by camunda.
the class CaseInstanceTest method testCaseInstanceWithOneStateWithoutManualStartOfChildren.
@Test
public void testCaseInstanceWithOneStateWithoutManualStartOfChildren() {
CaseExecutionStateTransitionCollector stateTransitionCollector = new CaseExecutionStateTransitionCollector();
CmmnCaseDefinition caseDefinition = new CaseDefinitionBuilder("Case1").listener("create", stateTransitionCollector).createActivity("X").listener("create", stateTransitionCollector).listener("enable", stateTransitionCollector).listener("manualStart", stateTransitionCollector).property(ItemHandler.PROPERTY_MANUAL_ACTIVATION_RULE, defaultManualActivation()).behavior(new StageActivityBehavior()).createActivity("A").listener("create", stateTransitionCollector).listener("start", stateTransitionCollector).behavior(new TaskWaitState()).endActivity().createActivity("B").listener("create", stateTransitionCollector).listener("start", stateTransitionCollector).behavior(new TaskWaitState()).endActivity().endActivity().buildCaseDefinition();
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
List<String> expectedStateTransitions = initAndAssertExpectedTransitions(stateTransitionCollector);
emptyCollector(stateTransitionCollector, expectedStateTransitions);
// clear lists
CaseExecutionImpl planItemX = assertCaseXState(caseInstance);
// manual start of x
planItemX.manualStart();
// X should be active
assertTrue(planItemX.isActive());
// expected state transitions after a manual start of X:
expectedStateTransitions.add("enabled --manualStart(X)--> active");
expectedStateTransitions.add("() --create(A)--> available");
expectedStateTransitions.add("available --start(A)--> active");
expectedStateTransitions.add("() --create(B)--> available");
expectedStateTransitions.add("available --start(B)--> active");
assertEquals(expectedStateTransitions, stateTransitionCollector.stateTransitions);
// clear lists
emptyCollector(stateTransitionCollector, expectedStateTransitions);
// X should have two chil plan items
List<CaseExecutionImpl> childPlanItems;
childPlanItems = planItemX.getCaseExecutions();
assertEquals(2, childPlanItems.size());
for (CmmnExecution childPlanItem : childPlanItems) {
// both children should be active
assertTrue(childPlanItem.isActive());
// X should be the parent of both children
assertEquals(planItemX, childPlanItem.getParent());
}
}
Aggregations