use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class GetFormKeyCmd method execute.
public String execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
Expression formKeyExpression = null;
if (taskDefinitionKey == null) {
// TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
FormHandler formHandler = processDefinition.getStartFormHandler();
if (formHandler instanceof DelegateStartFormHandler) {
DelegateStartFormHandler delegateFormHandler = (DelegateStartFormHandler) formHandler;
formHandler = delegateFormHandler.getFormHandler();
}
// form handler (for a startForm) has always to extend the DefaultStartFormHandler!
if (formHandler instanceof DefaultStartFormHandler) {
DefaultStartFormHandler startFormHandler = (DefaultStartFormHandler) formHandler;
formKeyExpression = startFormHandler.getFormKey();
}
} else {
TaskDefinition taskDefinition = processDefinition.getTaskDefinitions().get(taskDefinitionKey);
formKeyExpression = taskDefinition.getFormKey();
}
String formKey = null;
if (formKeyExpression != null) {
formKey = formKeyExpression.getExpressionText();
}
return formKey;
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class GetStartFormCmd method execute.
public StartFormData 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.checkReadProcessDefinition(processDefinition);
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
ensureNotNull("No startFormHandler defined in process '" + processDefinitionId + "'", "startFormHandler", startFormHandler);
return startFormHandler.createStartFormData(processDefinition);
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesBatchCmd method createBatch.
protected BatchEntity createBatch(CommandContext commandContext, Collection<String> processInstanceIds) {
ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
BatchJobHandler<SetRetriesBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);
SetRetriesBatchConfiguration configuration = new SetRetriesBatchConfiguration(new ArrayList<String>(processInstanceIds), builder.getRetries());
BatchEntity batch = new BatchEntity();
batch.setType(batchJobHandler.getType());
batch.setTotalJobs(calculateSize(processEngineConfiguration, configuration));
batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
commandContext.getBatchManager().insert(batch);
return batch;
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class AbstractIDBasedBatchCmd method createBatch.
protected BatchEntity createBatch(CommandContext commandContext, List<String> ids) {
ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
BatchJobHandler batchJobHandler = getBatchJobHandler(processEngineConfiguration);
BatchConfiguration configuration = getAbstractIdsBatchConfiguration(ids);
BatchEntity batch = new BatchEntity();
batch.setType(batchJobHandler.getType());
batch.setTotalJobs(calculateSize(processEngineConfiguration, configuration));
batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
commandContext.getBatchManager().insert(batch);
return batch;
}
use of org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl in project camunda-bpm-platform by camunda.
the class ProcessApplicationContextUtil method getTargetProcessApplication.
public static ProcessApplicationReference getTargetProcessApplication(String deploymentId) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
ProcessApplicationManager processApplicationManager = processEngineConfiguration.getProcessApplicationManager();
ProcessApplicationReference processApplicationForDeployment = processApplicationManager.getProcessApplicationForDeployment(deploymentId);
return processApplicationForDeployment;
}
Aggregations