Package org.camunda.bpm.engine.impl.cmmn.execution

Examples of org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance


        .behavior(new TaskWaitState())
      .endActivity()
      .buildCaseDefinition();

    // create a new case instance
    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // expected state transitions after creation of a case instance:
    // ()        --create(Case1)--> active
    // ()        --create(A)-->     available
    // available --enable(A)-->     enabled
    List<String> expectedStateTransitions = new ArrayList<String>();
    expectedStateTransitions.add("() --create(Case1)--> active");
    expectedStateTransitions.add("() --create(A)--> available");
    expectedStateTransitions.add("available --enable(A)--> enabled");

    assertEquals(expectedStateTransitions, stateTransitionCollector.stateTransitions);

    // clear lists
    expectedStateTransitions.clear();
    stateTransitionCollector.stateTransitions.clear();

    // case instance is active
    assertTrue(caseInstance.isActive());

    CaseExecutionImpl instance = (CaseExecutionImpl) caseInstance;

    // case instance has one child plan item
    List<CaseExecutionImpl> childPlanItems = instance.getCaseExecutions();
View Full Code Here


    } else if (isVersionBinding()) {
      Integer version = getVersion(execution);
      caseDefinition = deploymentCache.findDeployedCaseDefinitionByKeyAndVersion(caseDefinitionKey, version);
    }

    CmmnCaseInstance caseInstance = execution.createSubCaseInstance(caseDefinition, businessKey);
    caseInstance.create(variables);
  }
View Full Code Here

          .behavior(new TaskWaitState())
        .endActivity()
      .endActivity()
      .buildCaseDefinition();

    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // expected state transitions after the creation of a case instance:
    // ()        --create(Case1)--> active
    // ()        --create(X)-->     available
    // available --enable(X)-->     enabled
    List<String> expectedStateTransitions = new ArrayList<String>();
    expectedStateTransitions.add("() --create(Case1)--> active");
    expectedStateTransitions.add("() --create(X)--> available");
    expectedStateTransitions.add("available --enable(X)--> enabled");

    assertEquals(expectedStateTransitions, stateTransitionCollector.stateTransitions);

    // clear lists
    expectedStateTransitions.clear();
    stateTransitionCollector.stateTransitions.clear();

    // case instance is active
    assertTrue(caseInstance.isActive());

    CaseExecutionImpl instance = (CaseExecutionImpl) caseInstance;

    // case instance has one child plan item
    List<CaseExecutionImpl> childPlanItems = instance.getCaseExecutions();
View Full Code Here

          .endActivity()
        .endActivity()
      .endActivity()
      .buildCaseDefinition();

    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // expected state transitions after the creation of a case instance:
    // ()        --create(Case1)--> active
    // ()        --create(A1)-->    available
    // available --enable(A1)-->    enabled
View Full Code Here

        .endActivity()
      .endActivity()
      .buildCaseDefinition();

    // an active case instance
    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // a case execution associated with Stage X
    CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");

    stageX.manualStart();

    // a case execution associated with Task A
    CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");

    taskA.manualStart();

    // a case execution associated with Task B
    CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");

    // when

    taskA.terminate();

    // then
    assertTrue(caseInstance.isActive());
    assertTrue(stageX.isActive());
    assertTrue(taskA.isTerminated());
    assertTrue(taskB.isEnabled());
  }
View Full Code Here

        .endActivity()
      .endActivity()
      .buildCaseDefinition();

    // an active case instance
    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // a case execution associated with Stage X
    CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");

    stageX.manualStart();
    stageX.suspend();

    // a case execution associated with Task A
    CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
    assertTrue(taskA.isSuspended());

    // a case execution associated with Task B
    CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");
    assertTrue(taskB.isSuspended());

    // when
    stageX.resume();

    // then
    assertTrue(caseInstance.isActive());
    assertTrue(stageX.isActive());
    assertTrue(taskA.isEnabled());
    assertTrue(taskB.isEnabled());
  }
View Full Code Here

        .endActivity()
      .endActivity()
      .buildCaseDefinition();

    // an active case instance
    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // a case execution associated with Stage X
    CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");

    stageX.manualStart();

    // a case execution associated with Task A
    CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
    taskA.manualStart();
    taskA.suspend();

    // a case execution associated with Task B
    CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");

    // when
    taskA.resume();

    // then
    assertTrue(caseInstance.isActive());
    assertTrue(stageX.isActive());
    assertTrue(taskA.isActive());
    assertTrue(taskB.isEnabled());
  }
View Full Code Here

    onPartDeclaration.setSource(new CmmnActivity("B", caseDefinition));
    onPartDeclaration.setStandardEvent("complete");
    sentryDeclaration.addOnPart(onPartDeclaration);

    // an active case instance
    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // task A as a child of the case instance
    CmmnActivityExecution milestoneA = caseInstance.findCaseExecution("A");

    // when

    // completing
    milestoneA.occur();

    // then
    // task A is completed ...
    assertTrue(milestoneA.isCompleted());
    // ... and the case instance is also completed
    assertTrue(caseInstance.isCompleted());

    // task A is not part of the case instance anymore
    assertNull(caseInstance.findCaseExecution("A"));
    // the case instance has no children
    assertTrue(((CaseExecutionImpl) caseInstance).getCaseExecutions().isEmpty());
  }
View Full Code Here

        .endActivity()
      .endActivity()
      .buildCaseDefinition();

    // an active case instance
    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // a case execution associated with Stage X
    CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");

    stageX.manualStart();

    // a case execution associated with Task A
    CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");

    // a case execution associated with Task B
    CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");

    // when

    caseInstance.suspend();

    // then
    assertTrue(caseInstance.isSuspended());
    assertTrue(stageX.isSuspended());
    assertTrue(taskA.isSuspended());
    assertTrue(taskB.isSuspended());
  }
View Full Code Here

        .endActivity()
      .endActivity()
      .buildCaseDefinition();

    // an active case instance
    CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
    caseInstance.create();

    // a case execution associated with Stage X
    CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");

    stageX.manualStart();

    // a case execution associated with Task A
    CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");

    // a case execution associated with Task B
    CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");

    // when

    stageX.suspend();

    // then
    assertTrue(caseInstance.isActive());
    assertTrue(stageX.isSuspended());
    assertTrue(taskA.isSuspended());
    assertTrue(taskB.isSuspended());
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.