Search in sources :

Example 6 with DeploymentCache

use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.

the class DeploymentManager method deleteDecisionDeployment.

protected void deleteDecisionDeployment(String deploymentId, boolean cascade) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    if (processEngineConfiguration.isDmnEnabled()) {
        DecisionDefinitionManager decisionDefinitionManager = getDecisionDefinitionManager();
        List<DecisionDefinition> decisionDefinitions = decisionDefinitionManager.findDecisionDefinitionByDeploymentId(deploymentId);
        if (cascade) {
            // delete historic decision instances
            for (DecisionDefinition decisionDefinition : decisionDefinitions) {
                getHistoricDecisionInstanceManager().deleteHistoricDecisionInstancesByDecisionDefinitionId(decisionDefinition.getId());
            }
        }
        // delete decision definitions from db
        decisionDefinitionManager.deleteDecisionDefinitionsByDeploymentId(deploymentId);
        DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
        for (DecisionDefinition decisionDefinition : decisionDefinitions) {
            String decisionDefinitionId = decisionDefinition.getId();
            // remove decision definitions from cache:
            deploymentCache.removeDecisionDefinition(decisionDefinitionId);
        }
    }
}
Also used : DecisionDefinitionManager(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionManager) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 7 with DeploymentCache

use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache 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();
        }
    };
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) Command(org.camunda.bpm.engine.impl.interceptor.Command) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 8 with DeploymentCache

use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.

the class DeploymentCacheCfgTest method testPlugInOwnCacheImplementation.

@Test
public void testPlugInOwnCacheImplementation() {
    // given
    DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
    // when
    Cache<String, ProcessDefinitionEntity> cache = deploymentCache.getProcessDefinitionCache();
    // then
    assertThat(cache, instanceOf(MyCacheImplementation.class));
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) Test(org.junit.Test)

Example 9 with DeploymentCache

use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.

the class TimerStartEventJobHandler method execute.

public void execute(TimerJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    String definitionKey = configuration.getTimerElementKey();
    ProcessDefinition processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKeyAndTenantId(definitionKey, tenantId);
    try {
        startProcessInstance(commandContext, tenantId, processDefinition);
    } catch (RuntimeException e) {
        throw e;
    }
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition)

Example 10 with DeploymentCache

use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.

the class DefaultCorrelationHandler method correlateStartMessageByEventSubscription.

protected List<CorrelationHandlerResult> correlateStartMessageByEventSubscription(CommandContext commandContext, String messageName, CorrelationSet correlationSet) {
    List<CorrelationHandlerResult> results = new ArrayList<CorrelationHandlerResult>();
    DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
    List<EventSubscriptionEntity> messageEventSubscriptions = findMessageStartEventSubscriptions(commandContext, messageName, correlationSet);
    for (EventSubscriptionEntity messageEventSubscription : messageEventSubscriptions) {
        if (messageEventSubscription.getConfiguration() != null) {
            String processDefinitionId = messageEventSubscription.getConfiguration();
            ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
            // only an active process definition will be returned
            if (processDefinition != null && !processDefinition.isSuspended()) {
                CorrelationHandlerResult result = CorrelationHandlerResult.matchedProcessDefinition(processDefinition, messageEventSubscription.getActivityId());
                results.add(result);
            } else {
                LOG.couldNotFindProcessDefinitionForEventSubscription(messageEventSubscription, processDefinitionId);
            }
        }
    }
    return results;
}
Also used : ArrayList(java.util.ArrayList) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) EventSubscriptionEntity(org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)

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