use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class DefaultCorrelationHandler method correlateStartMessageByProcessDefinitionId.
protected CorrelationHandlerResult correlateStartMessageByProcessDefinitionId(CommandContext commandContext, String messageName, String processDefinitionId) {
DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
// only an active process definition will be returned
if (processDefinition != null && !processDefinition.isSuspended()) {
String startActivityId = findStartActivityIdByMessage(processDefinition, messageName);
if (startActivityId != null) {
return CorrelationHandlerResult.matchedProcessDefinition(processDefinition, startActivityId);
}
}
return null;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache 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;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class CallableElementUtil method getProcessDefinitionToCall.
public static ProcessDefinitionImpl getProcessDefinitionToCall(VariableScope execution, BaseCallableElement callableElement) {
String processDefinitionKey = callableElement.getDefinitionKey(execution);
String tenantId = callableElement.getDefinitionTenantId(execution);
DeploymentCache deploymentCache = getDeploymentCache();
ProcessDefinitionImpl processDefinition = null;
if (callableElement.isLatestBinding()) {
processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);
} else if (callableElement.isDeploymentBinding()) {
String deploymentId = callableElement.getDeploymentId();
processDefinition = deploymentCache.findDeployedProcessDefinitionByDeploymentAndKey(deploymentId, processDefinitionKey);
} else if (callableElement.isVersionBinding()) {
Integer version = callableElement.getVersion(execution);
processDefinition = deploymentCache.findDeployedProcessDefinitionByKeyVersionAndTenantId(processDefinitionKey, version, tenantId);
}
return processDefinition;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class RepositoryServiceTest method testDeleteDeploymentClearsCache.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/repository/one.cmmn" })
public void testDeleteDeploymentClearsCache() {
// fetch definition ids
String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// fetch CMMN model to be placed to in the cache
repositoryService.getCmmnModelInstance(caseDefinitionId);
DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
// ensure definitions and models are part of the cache
assertNotNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId));
assertNotNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId));
assertNotNull(deploymentCache.getCaseDefinitionCache().get(caseDefinitionId));
assertNotNull(deploymentCache.getCmmnModelInstanceCache().get(caseDefinitionId));
// when the deployment is deleted
repositoryService.deleteDeployment(deploymentId, true);
// then the definitions and models are removed from the cache
assertNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId));
assertNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId));
assertNull(deploymentCache.getCaseDefinitionCache().get(caseDefinitionId));
assertNull(deploymentCache.getCmmnModelInstanceCache().get(caseDefinitionId));
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class DeleteProcessDefinitionTest method testDeleteProcessDefinitionClearsCache.
@Test
public void testDeleteProcessDefinitionClearsCache() {
// given process definition and a process instance
BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done();
deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", bpmnModel).deploy();
String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process").singleResult().getId();
DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
// ensure definitions and models are part of the cache
assertNotNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId));
assertNotNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId));
repositoryService.deleteProcessDefinition(processDefinitionId, true);
// then the definitions and models are removed from the cache
assertNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId));
assertNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId));
}
Aggregations