use of org.camunda.bpm.engine.impl.form.engine.FormEngine in project camunda-bpm-platform by camunda.
the class GetRenderedTaskFormCmd method execute.
public Object execute(CommandContext commandContext) {
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("Task '" + taskId + "' not found", "task", task);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadTask(task);
}
ensureNotNull("Task form definition for '" + taskId + "' not found", "task.getTaskDefinition()", task.getTaskDefinition());
TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
if (taskFormHandler == null) {
return null;
}
FormEngine formEngine = Context.getProcessEngineConfiguration().getFormEngines().get(formEngineName);
ensureNotNull("No formEngine '" + formEngineName + "' defined process engine configuration", "formEngine", formEngine);
TaskFormData taskForm = taskFormHandler.createTaskForm(task);
return formEngine.renderTaskForm(taskForm);
}
use of org.camunda.bpm.engine.impl.form.engine.FormEngine in project camunda-bpm-platform by camunda.
the class ProcessEngineConfigurationImpl method initFormEngines.
protected void initFormEngines() {
if (formEngines == null) {
formEngines = new HashMap<String, FormEngine>();
// html form engine = default form engine
FormEngine defaultFormEngine = new HtmlFormEngine();
// default form engine is looked up with null
formEngines.put(null, defaultFormEngine);
formEngines.put(defaultFormEngine.getName(), defaultFormEngine);
FormEngine juelFormEngine = new JuelFormEngine();
formEngines.put(juelFormEngine.getName(), juelFormEngine);
}
if (customFormEngines != null) {
for (FormEngine formEngine : customFormEngines) {
formEngines.put(formEngine.getName(), formEngine);
}
}
}
use of org.camunda.bpm.engine.impl.form.engine.FormEngine 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;
}
Aggregations