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;
}
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()));
}
Aggregations