Search in sources :

Example 11 with DeploymentCache

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;
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 12 with DeploymentCache

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;
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)

Example 13 with DeploymentCache

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;
}
Also used : ProcessDefinitionImpl(org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)

Example 14 with DeploymentCache

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));
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 15 with DeploymentCache

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));
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Aggregations

DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)41 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)18 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)15 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)10 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)8 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)5 Test (org.junit.Test)5 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)4 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Command (org.camunda.bpm.engine.impl.interceptor.Command)4 ArrayList (java.util.ArrayList)3 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)3 DecisionDefinitionEntity (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)3 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)3 DecisionRequirementsDefinitionEntity (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)2 StartFormHandler (org.camunda.bpm.engine.impl.form.handler.StartFormHandler)2 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)2 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)2 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)2 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)2