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);
}
}
}
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();
}
};
}
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));
}
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;
}
}
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;
}
Aggregations