Search in sources :

Example 1 with DelegateCaseExecution

use of org.camunda.bpm.engine.delegate.DelegateCaseExecution in project camunda-bpm-platform by camunda.

the class TaskEntity method createAndInsert.

/**
 * creates and initializes a new persistent task.
 */
public static TaskEntity createAndInsert(VariableScope execution) {
    TaskEntity task = create();
    if (execution instanceof ExecutionEntity) {
        ExecutionEntity executionEntity = (ExecutionEntity) execution;
        task.setExecution(executionEntity);
        task.skipCustomListeners = executionEntity.isSkipCustomListeners();
        task.insert(executionEntity);
        return task;
    } else if (execution instanceof CaseExecutionEntity) {
        task.setCaseExecution((DelegateCaseExecution) execution);
    }
    task.insert(null);
    return task;
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) DelegateCaseExecution(org.camunda.bpm.engine.delegate.DelegateCaseExecution)

Example 2 with DelegateCaseExecution

use of org.camunda.bpm.engine.delegate.DelegateCaseExecution in project camunda-bpm-platform by camunda.

the class TenantIdProviderTest method providerCalledWithSuperCaseInstance.

@Test
public void providerCalledWithSuperCaseInstance() {
    ContextLoggingTenantIdProvider tenantIdProvider = new ContextLoggingTenantIdProvider();
    TestTenantIdProvider.delegate = tenantIdProvider;
    testRule.deploy(CMMN_SUBPROCESS_FILE, CMMN_FILE_WITH_MANUAL_ACTIVATION);
    CaseDefinition superCaseDefinition = engineRule.getRepositoryService().createCaseDefinitionQuery().caseDefinitionKey(CASE_DEFINITION_KEY).singleResult();
    // if a case instance is created
    engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create();
    startCaseTask();
    // then the tenant id provider is passed in the case definition
    DelegateCaseExecution superCaseExecution = tenantIdProvider.caseParameters.get(1).getSuperCaseExecution();
    assertThat(superCaseExecution, is(notNullValue()));
    assertThat(superCaseExecution.getCaseDefinitionId(), is(superCaseDefinition.getId()));
}
Also used : CaseDefinition(org.camunda.bpm.engine.repository.CaseDefinition) DelegateCaseExecution(org.camunda.bpm.engine.delegate.DelegateCaseExecution) Test(org.junit.Test)

Aggregations

DelegateCaseExecution (org.camunda.bpm.engine.delegate.DelegateCaseExecution)2 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)1 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)1 Test (org.junit.Test)1