Search in sources :

Example 31 with DeploymentCache

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

the class GetDeploymentDecisionRequirementsDefinitionCmd method execute.

public DecisionRequirementsDefinition execute(CommandContext commandContext) {
    ensureNotNull("decisionRequirementsDefinitionId", decisionRequirementsDefinitionId);
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    DecisionRequirementsDefinitionEntity decisionRequirementsDefinition = deploymentCache.findDeployedDecisionRequirementsDefinitionById(decisionRequirementsDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadDecisionRequirementsDefinition(decisionRequirementsDefinition);
    }
    return decisionRequirementsDefinition;
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity)

Example 32 with DeploymentCache

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

the class GetDeploymentDecisionDefinitionCmd method execute.

public DecisionDefinition execute(CommandContext commandContext) {
    ensureNotNull("decisionDefinitionId", decisionDefinitionId);
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    DecisionDefinitionEntity decisionDefinition = deploymentCache.findDeployedDecisionDefinitionById(decisionDefinitionId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkReadDecisionDefinition(decisionDefinition);
    }
    return decisionDefinition;
}
Also used : DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) DecisionDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)

Example 33 with DeploymentCache

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

the class DecisionDefinitionEntity method loadDecisionDefinition.

/**
 * Returns the cached version if exists; does not update the entity from the database in that case
 */
protected DecisionDefinitionEntity loadDecisionDefinition(String decisionDefinitionId) {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    DeploymentCache deploymentCache = configuration.getDeploymentCache();
    DecisionDefinitionEntity decisionDefinition = deploymentCache.findDecisionDefinitionFromCache(decisionDefinitionId);
    if (decisionDefinition == null) {
        CommandContext commandContext = Context.getCommandContext();
        DecisionDefinitionManager decisionDefinitionManager = commandContext.getDecisionDefinitionManager();
        decisionDefinition = decisionDefinitionManager.findDecisionDefinitionById(decisionDefinitionId);
        if (decisionDefinition != null) {
            decisionDefinition = deploymentCache.resolveDecisionDefinition(decisionDefinition);
        }
    }
    return decisionDefinition;
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 34 with DeploymentCache

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

the class SignalEventHandler method handleStartEvent.

protected void handleStartEvent(EventSubscriptionEntity eventSubscription, Map<String, Object> payload, String businessKey, CommandContext commandContext) {
    String processDefinitionId = eventSubscription.getConfiguration();
    ensureNotNull("Configuration of signal start event subscription '" + eventSubscription.getId() + "' contains no process definition id.", processDefinitionId);
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition == null || processDefinition.isSuspended()) {
        // ignore event subscription
        LOG.debugIgnoringEventSubscription(eventSubscription, processDefinitionId);
    } else {
        ActivityImpl signalStartEvent = processDefinition.findActivity(eventSubscription.getActivityId());
        PvmProcessInstance processInstance = processDefinition.createProcessInstance(businessKey, signalStartEvent);
        processInstance.start(payload);
    }
}
Also used : PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 35 with DeploymentCache

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

the class DeploymentManager method deleteDecisionRequirementDeployment.

protected void deleteDecisionRequirementDeployment(String deploymentId) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    if (processEngineConfiguration.isDmnEnabled()) {
        DecisionRequirementsDefinitionManager manager = getDecisionRequirementsDefinitionManager();
        List<DecisionRequirementsDefinition> decisionRequirementsDefinitions = manager.findDecisionRequirementsDefinitionByDeploymentId(deploymentId);
        // delete decision requirements definitions from db
        manager.deleteDecisionRequirementsDefinitionsByDeploymentId(deploymentId);
        DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
        for (DecisionRequirementsDefinition decisionRequirementsDefinition : decisionRequirementsDefinitions) {
            String decisionDefinitionId = decisionRequirementsDefinition.getId();
            // remove decision requirements definitions from cache:
            deploymentCache.removeDecisionRequirementsDefinition(decisionDefinitionId);
        }
    }
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) DecisionRequirementsDefinitionManager(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionManager) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

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