use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class GetRenderedStartFormCmd method execute.
public Object execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
ensureNotNull("Process Definition '" + processDefinitionId + "' not found", "processDefinition", processDefinition);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
if (startFormHandler == null) {
return null;
}
FormEngine formEngine = Context.getProcessEngineConfiguration().getFormEngines().get(formEngineName);
ensureNotNull("No formEngine '" + formEngineName + "' defined process engine configuration", "formEngine", formEngine);
StartFormData startForm = startFormHandler.createStartFormData(processDefinition);
Object renderedStartForm = null;
try {
renderedStartForm = formEngine.renderStartForm(startForm);
} catch (ScriptEvaluationException e) {
LOG.exceptionWhenStartFormScriptEvaluation(processDefinitionId, e);
}
return renderedStartForm;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class SubmitStartFormCmd method execute.
@Override
public ProcessInstance execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
ensureNotNull("No process definition found for id = '" + processDefinitionId + "'", "processDefinition", processDefinition);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkCreateProcessInstance(processDefinition);
}
ExecutionEntity processInstance = null;
if (businessKey != null) {
processInstance = processDefinition.createProcessInstance(businessKey);
} else {
processInstance = processDefinition.createProcessInstance();
}
// see CAM-2828
if (processDefinition.getInitial().isAsyncBefore()) {
// avoid firing history events
processInstance.setStartContext(new ProcessInstanceStartContext(processInstance.getActivity()));
FormPropertyHelper.initFormPropertiesOnScope(variables, processInstance);
processInstance.start();
} else {
processInstance.startWithFormProperties(variables);
}
return processInstance;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class CallableElementUtil method getDecisionDefinitionToCall.
public static DecisionDefinition getDecisionDefinitionToCall(VariableScope execution, BaseCallableElement callableElement) {
String decisionDefinitionKey = callableElement.getDefinitionKey(execution);
String tenantId = callableElement.getDefinitionTenantId(execution);
DeploymentCache deploymentCache = getDeploymentCache();
DecisionDefinition decisionDefinition = null;
if (callableElement.isLatestBinding()) {
decisionDefinition = deploymentCache.findDeployedLatestDecisionDefinitionByKeyAndTenantId(decisionDefinitionKey, tenantId);
} else if (callableElement.isDeploymentBinding()) {
String deploymentId = callableElement.getDeploymentId();
decisionDefinition = deploymentCache.findDeployedDecisionDefinitionByDeploymentAndKey(deploymentId, decisionDefinitionKey);
} else if (callableElement.isVersionBinding()) {
Integer version = callableElement.getVersion(execution);
decisionDefinition = deploymentCache.findDeployedDecisionDefinitionByKeyVersionAndTenantId(decisionDefinitionKey, version, tenantId);
}
return decisionDefinition;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class CaseDefinitionEntity method loadCaseDefinition.
/**
* Returns the cached version if exists; does not update the entity from the database in that case
*/
protected CaseDefinitionEntity loadCaseDefinition(String caseDefinitionId) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = configuration.getDeploymentCache();
CaseDefinitionEntity caseDefinition = deploymentCache.findCaseDefinitionFromCache(caseDefinitionId);
if (caseDefinition == null) {
CommandContext commandContext = Context.getCommandContext();
CaseDefinitionManager caseDefinitionManager = commandContext.getCaseDefinitionManager();
caseDefinition = caseDefinitionManager.findCaseDefinitionById(caseDefinitionId);
if (caseDefinition != null) {
caseDefinition = deploymentCache.resolveCaseDefinition(caseDefinition);
}
}
return caseDefinition;
}
use of org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache in project camunda-bpm-platform by camunda.
the class CreateCaseInstanceCmd method find.
protected CaseDefinitionEntity find(CommandContext commandContext) {
DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
// Find the case definition
CaseDefinitionEntity caseDefinition = null;
if (caseDefinitionId != null) {
caseDefinition = findById(deploymentCache, caseDefinitionId);
ensureNotNull(CaseDefinitionNotFoundException.class, "No case definition found for id = '" + caseDefinitionId + "'", "caseDefinition", caseDefinition);
} else {
caseDefinition = findByKey(deploymentCache, caseDefinitionKey);
ensureNotNull(CaseDefinitionNotFoundException.class, "No case definition found for key '" + caseDefinitionKey + "'", "caseDefinition", caseDefinition);
}
return caseDefinition;
}
Aggregations