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

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


  // resume ////////////////////////////////////////////////////////////////

  public void onResume(CmmnActivityExecution execution) {
    ensureTransitionAllowed(execution, SUSPENDED, AVAILABLE, "resume");

    CmmnActivityExecution parent = execution.getParent();
    if (parent != null) {
      if (!parent.isActive()) {
        String id = execution.getId();
        String message = "It is not possible to resume case execution '"+id+"' which parent is not active.";
        throw createIllegalStateTransitionException("resume", message, execution);
      }
    }
View Full Code Here


    }
  }

  protected boolean isSentrySatisified(List<CmmnSentryDeclaration> sentryDeclarations, CmmnActivityExecution execution) {
    String id = execution.getId();
    CmmnActivityExecution parent = execution.getParent();
    EnsureUtil.ensureNotNull(PvmException.class, "Case execution '"+id+"': has no parent.", "parent", parent);

    for (CmmnSentryDeclaration sentryDeclaration : sentryDeclarations) {

      String sentryId = sentryDeclaration.getId();
      if (parent.isSentrySatisfied(sentryId)) {
        return true;
      }

    }
View Full Code Here

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

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

    // start task A manually
    taskA.manualStart();

    // when

    // completing task A
    taskA.complete();

    // then
    List<String> expectedStateTransitions = new ArrayList<String>();

    // expected state transition:
    // active --complete(A)--> completed
    // active --complete(Case1)--> completed
    expectedStateTransitions.add("active --complete(A)--> completed");
    expectedStateTransitions.add("active --complete(Case1)--> completed");

    assertEquals(expectedStateTransitions, stateTransitionCollector.stateTransitions);

    // task A is completed ...
    assertTrue(taskA.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"));
View Full Code Here

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

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

    // start task A manually
    taskA.manualStart();

    // when

    // completing task A
    taskA.manualComplete();

    // then
    List<String> expectedStateTransitions = new ArrayList<String>();

    // expected state transition:
    // active --complete(A)--> completed
    // active --complete(Case1)--> completed
    expectedStateTransitions.add("active --complete(A)--> completed");
    expectedStateTransitions.add("active --complete(Case1)--> completed");

    assertEquals(expectedStateTransitions, stateTransitionCollector.stateTransitions);

    // task A is completed ...
    assertTrue(taskA.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"));
View Full Code Here

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

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

    // task A is enabled
    assertTrue(taskA.isEnabled());

    try {
      // when
      // completing task A
      taskA.complete();
      fail("It should not be possible to complete an enabled task.");
    } catch (CaseIllegalStateTransitionException e) {
      // then

      // task A is still enabled
      assertTrue(taskA.isEnabled());
    }

  }
View Full Code Here

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

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

    // task A is enabled
    assertTrue(taskA.isEnabled());

    try {
      // when
      // completing task A
      taskA.manualComplete();
      fail("It should not be possible to complete an enabled task.");
    } catch (CaseIllegalStateTransitionException e) {
      // then

      // task A is still enabled
      assertTrue(taskA.isEnabled());
    }

  }
View Full Code Here

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

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

    taskA.manualStart();
    taskA.complete();

    // task A is completed
    assertTrue(taskA.isCompleted());

    try {
      // when
      // complete A
      taskA.complete();
      fail("It should not be possible to complete an already completed task.");
    } catch (CaseIllegalStateTransitionException e) {
      // then

      // task A is still completed
      assertTrue(taskA.isCompleted());
    }

  }
View Full Code Here

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

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

    taskA.manualStart();
    taskA.complete();

    // task A is completed
    assertTrue(taskA.isCompleted());

    try {
      // when
      // complete A
      taskA.manualComplete();
      fail("It should not be possible to complete an already completed task.");
    } catch (CaseIllegalStateTransitionException e) {
      // then

      // task A is still completed
      assertTrue(taskA.isCompleted());
    }

  }
View Full Code Here

  public void onResume(CmmnActivityExecution execution) {
    ensureNotCaseInstance(execution, "resume");
    ensureTransitionAllowed(execution, SUSPENDED, ACTIVE, "resume");

    CmmnActivityExecution parent = execution.getParent();
    if (parent != null) {
      if (!parent.isActive()) {
        String id = execution.getId();
        String message = "It is not possible to resume case execution '"+id+"' which parent is not active.";
        throw createIllegalStateTransitionException("resume", message, execution);
      }
    }
View Full Code Here

    if (!execution.isSuspended()) {
      String message = "Case execution '"+id+"' must be suspended to resume it, but was "+execution.getCurrentState()+".";
      throw createIllegalStateTransitionException("parentResume", message, execution);
    }

    CmmnActivityExecution parent = execution.getParent();
    if (parent != null) {
      if (!parent.isActive()) {
        String message = "It is not possible to resume case execution '"+id+"' which parent is not active.";
        throw createIllegalStateTransitionException("parentResume", message, execution);
      }
    }
View Full Code Here

TOP

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

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.