use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method initTaskInstanceEvent.
protected void initTaskInstanceEvent(HistoricTaskInstanceEventEntity evt, TaskEntity taskEntity, HistoryEventType eventType) {
String processDefinitionKey = null;
ProcessDefinitionEntity definition = taskEntity.getProcessDefinition();
if (definition != null) {
processDefinitionKey = definition.getKey();
}
String processDefinitionId = taskEntity.getProcessDefinitionId();
String processInstanceId = taskEntity.getProcessInstanceId();
String executionId = taskEntity.getExecutionId();
String caseDefinitionKey = null;
CaseDefinitionEntity caseDefinition = taskEntity.getCaseDefinition();
if (caseDefinition != null) {
caseDefinitionKey = caseDefinition.getKey();
}
String caseDefinitionId = taskEntity.getCaseDefinitionId();
String caseExecutionId = taskEntity.getCaseExecutionId();
String caseInstanceId = taskEntity.getCaseInstanceId();
String tenantId = taskEntity.getTenantId();
evt.setId(taskEntity.getId());
evt.setEventType(eventType.getEventName());
evt.setTaskId(taskEntity.getId());
evt.setProcessDefinitionKey(processDefinitionKey);
evt.setProcessDefinitionId(processDefinitionId);
evt.setProcessInstanceId(processInstanceId);
evt.setExecutionId(executionId);
evt.setCaseDefinitionKey(caseDefinitionKey);
evt.setCaseDefinitionId(caseDefinitionId);
evt.setCaseExecutionId(caseExecutionId);
evt.setCaseInstanceId(caseInstanceId);
evt.setAssignee(taskEntity.getAssignee());
evt.setDescription(taskEntity.getDescription());
evt.setDueDate(taskEntity.getDueDate());
evt.setFollowUpDate(taskEntity.getFollowUpDate());
evt.setName(taskEntity.getName());
evt.setOwner(taskEntity.getOwner());
evt.setParentTaskId(taskEntity.getParentTaskId());
evt.setPriority(taskEntity.getPriority());
evt.setTaskDefinitionKey(taskEntity.getTaskDefinitionKey());
evt.setTenantId(tenantId);
ExecutionEntity execution = taskEntity.getExecution();
if (execution != null) {
evt.setActivityInstanceId(execution.getActivityInstanceId());
}
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class ExecutionEntity method createSubCaseInstance.
@Override
public CaseExecutionEntity createSubCaseInstance(CmmnCaseDefinition caseDefinition, String businessKey) {
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) caseDefinition.createCaseInstance(businessKey);
// inherit the tenant-id from the case definition
String tenantId = ((CaseDefinitionEntity) caseDefinition).getTenantId();
if (tenantId != null) {
subCaseInstance.setTenantId(tenantId);
} else {
// if case definition has no tenant id, inherit this process instance's tenant id
subCaseInstance.setTenantId(this.tenantId);
}
// manage bidirectional super-process-sub-case-instances relation
subCaseInstance.setSuperExecution(this);
setSubCaseInstance(subCaseInstance);
fireHistoricActivityInstanceUpdate();
return subCaseInstance;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CaseDefinitionCache method getCaseDefinitionById.
public CaseDefinitionEntity getCaseDefinitionById(String caseDefinitionId) {
checkInvalidDefinitionId(caseDefinitionId);
CaseDefinitionEntity caseDefinition = getDefinition(caseDefinitionId);
if (caseDefinition == null) {
caseDefinition = findDeployedDefinitionById(caseDefinitionId);
}
return caseDefinition;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method caseDefinitionTestProvider.
protected static TestProvider caseDefinitionTestProvider() {
return new TestProvider() {
@Override
public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) {
return new Command<ProcessApplicationReference>() {
public ProcessApplicationReference execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration();
DeploymentCache deploymentCache = configuration.getDeploymentCache();
CaseDefinitionEntity definition = deploymentCache.findDeployedCaseDefinitionById(definitionId);
return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
}
};
}
@Override
public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
return repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).latestVersion().singleResult().getId();
}
};
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class MultiTenancyRepositoryServiceTest method getPreviousCaseDefinitionWithTenantId.
@Test
public void getPreviousCaseDefinitionWithTenantId() {
testRule.deployForTenant(TENANT_ONE, CMMN);
testRule.deployForTenant(TENANT_ONE, CMMN);
testRule.deployForTenant(TENANT_ONE, CMMN);
testRule.deployForTenant(TENANT_TWO, CMMN);
testRule.deployForTenant(TENANT_TWO, CMMN);
List<CaseDefinition> latestCaseDefinitions = repositoryService.createCaseDefinitionQuery().latestVersion().orderByTenantId().asc().list();
CaseDefinitionEntity previousDefinitionTenantOne = getPreviousDefinition((CaseDefinitionEntity) latestCaseDefinitions.get(0));
CaseDefinitionEntity previousDefinitionTenantTwo = getPreviousDefinition((CaseDefinitionEntity) latestCaseDefinitions.get(1));
assertThat(previousDefinitionTenantOne.getVersion(), is(2));
assertThat(previousDefinitionTenantOne.getTenantId(), is(TENANT_ONE));
assertThat(previousDefinitionTenantTwo.getVersion(), is(1));
assertThat(previousDefinitionTenantTwo.getTenantId(), is(TENANT_TWO));
}
Aggregations