use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class GetDeploymentCmmnModelInstanceCmd method execute.
public CmmnModelInstance execute(CommandContext commandContext) {
ensureNotNull("caseDefinitionId", caseDefinitionId);
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
final DeploymentCache deploymentCache = configuration.getDeploymentCache();
CaseDefinitionEntity caseDefinition = deploymentCache.findDeployedCaseDefinitionById(caseDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadCaseDefinition(caseDefinition);
}
CmmnModelInstance modelInstance = Context.getProcessEngineConfiguration().getDeploymentCache().findCmmnModelInstanceForCaseDefinition(caseDefinitionId);
ensureNotNull(CmmnModelInstanceNotFoundException.class, "No CMMN model instance found for case definition id " + caseDefinitionId, "modelInstance", modelInstance);
return modelInstance;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class DefaultConditionHandler method evaluateConditionStartByProcessDefinitionId.
protected List<ConditionHandlerResult> evaluateConditionStartByProcessDefinitionId(CommandContext commandContext, ConditionSet conditionSet, String processDefinitionId) {
DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
List<ConditionHandlerResult> results = new ArrayList<ConditionHandlerResult>();
if (processDefinition != null && !processDefinition.isSuspended()) {
List<ActivityImpl> activities = findConditionalStartEventActivities(processDefinition);
if (activities.isEmpty()) {
throw LOG.exceptionWhenEvaluatingConditionalStartEventByProcessDefinition(processDefinitionId);
}
for (ActivityImpl activity : activities) {
if (evaluateCondition(conditionSet, activity)) {
results.add(new ConditionHandlerResult(processDefinition, activity));
}
}
}
return results;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class ProcessDefinitionEntity method loadProcessDefinition.
/**
* Returns the cached version if exists; does not update the entity from the database in that case
*/
protected ProcessDefinitionEntity loadProcessDefinition(String processDefinitionId) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = configuration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findProcessDefinitionFromCache(processDefinitionId);
if (processDefinition == null) {
CommandContext commandContext = Context.getCommandContext();
ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);
if (processDefinition != null) {
processDefinition = deploymentCache.resolveProcessDefinition(processDefinition);
}
}
return processDefinition;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class GetDeploymentBpmnModelInstanceCmd method execute.
public BpmnModelInstance execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
final DeploymentCache deploymentCache = configuration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
BpmnModelInstance modelInstance = deploymentCache.findBpmnModelInstanceForProcessDefinition(processDefinitionId);
ensureNotNull("no BPMN model instance found for process definition id " + processDefinitionId, "modelInstance", modelInstance);
return modelInstance;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class DefaultJobRetryCmd method getCurrentActivity.
protected ActivityImpl getCurrentActivity(CommandContext commandContext, JobEntity job) {
String type = job.getJobHandlerType();
ActivityImpl activity = null;
if (SUPPORTED_TYPES.contains(type)) {
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
ProcessDefinitionEntity processDefinitionEntity = deploymentCache.findDeployedProcessDefinitionById(job.getProcessDefinitionId());
activity = processDefinitionEntity.findActivity(job.getActivityId());
} else {
// noop, because activity type is not supported
}
return activity;
}
Aggregations