Search in sources :

Example 1 with CmmnCaseDefinition

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.

the class CaseCallActivityBehavior method startInstance.

protected void startInstance(ActivityExecution execution, VariableMap variables, String businessKey) {
    CmmnCaseDefinition definition = getCaseDefinitionToCall(execution, getCallableElement());
    CmmnCaseInstance caseInstance = execution.createSubCaseInstance(definition, businessKey);
    caseInstance.create(variables);
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) CmmnCaseInstance(org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance)

Example 2 with CmmnCaseDefinition

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.

the class CmmnTransform method transformCaseDefinitions.

protected void transformCaseDefinitions() {
    Definitions definitions = model.getDefinitions();
    Collection<Case> cases = definitions.getCases();
    for (Case currentCase : cases) {
        context.setCaseDefinition(null);
        context.setParent(null);
        CmmnCaseDefinition caseDefinition = transformCase(currentCase);
        caseDefinitions.add((CaseDefinitionEntity) caseDefinition);
    }
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) Case(org.camunda.bpm.model.cmmn.instance.Case)

Example 3 with CmmnCaseDefinition

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.

the class CallableElementUtil method getCaseDefinitionToCall.

public static CmmnCaseDefinition getCaseDefinitionToCall(VariableScope execution, BaseCallableElement callableElement) {
    String caseDefinitionKey = callableElement.getDefinitionKey(execution);
    String tenantId = callableElement.getDefinitionTenantId(execution);
    DeploymentCache deploymentCache = getDeploymentCache();
    CmmnCaseDefinition caseDefinition = null;
    if (callableElement.isLatestBinding()) {
        caseDefinition = deploymentCache.findDeployedLatestCaseDefinitionByKeyAndTenantId(caseDefinitionKey, tenantId);
    } else if (callableElement.isDeploymentBinding()) {
        String deploymentId = callableElement.getDeploymentId();
        caseDefinition = deploymentCache.findDeployedCaseDefinitionByDeploymentAndKey(deploymentId, caseDefinitionKey);
    } else if (callableElement.isVersionBinding()) {
        Integer version = callableElement.getVersion(execution);
        caseDefinition = deploymentCache.findDeployedCaseDefinitionByKeyVersionAndTenantId(caseDefinitionKey, version, tenantId);
    }
    return caseDefinition;
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)

Example 4 with CmmnCaseDefinition

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.

the class HumanTaskDicretionaryItemHandlerTest method testWithParent.

@Test
public void testWithParent() {
    // given:
    // a new activity as parent
    CmmnCaseDefinition parent = new CmmnCaseDefinition("aParentActivity");
    context.setParent(parent);
    // when
    CmmnActivity activity = handler.handleElement(discretionaryItem, context);
    // then
    assertEquals(parent, activity.getParent());
    assertTrue(parent.getActivities().contains(activity));
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 5 with CmmnCaseDefinition

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.

the class MilestoneDiscretionaryItemHandlerTest method testWithParent.

@Test
public void testWithParent() {
    // given:
    // a new activity as parent
    CmmnCaseDefinition parent = new CmmnCaseDefinition("aParentActivity");
    context.setParent(parent);
    // when
    CmmnActivity activity = handler.handleElement(discretionaryItem, context);
    // then
    assertEquals(parent, activity.getParent());
    assertTrue(parent.getActivities().contains(activity));
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Aggregations

CmmnCaseDefinition (org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition)64 CmmnCaseInstance (org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance)48 CaseDefinitionBuilder (org.camunda.bpm.engine.impl.cmmn.model.CaseDefinitionBuilder)46 CmmnActivityExecution (org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution)38 Test (org.junit.Test)32 StageActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.StageActivityBehavior)22 ArrayList (java.util.ArrayList)18 CaseExecutionImpl (org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl)17 CaseIllegalStateTransitionException (org.camunda.bpm.engine.exception.cmmn.CaseIllegalStateTransitionException)14 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)14 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 CmmnExecution (org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution)2 CmmnActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior)1 MilestoneActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior)1 CmmnOnPartDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration)1 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)1 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)1 Case (org.camunda.bpm.model.cmmn.instance.Case)1 Definitions (org.camunda.bpm.model.cmmn.instance.Definitions)1 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)1