Search in sources :

Example 1 with FormEngine

use of org.activiti.engine.impl.form.FormEngine in project Activiti by Activiti.

the class ProcessEngineConfigurationImpl method initFormEngines.

protected void initFormEngines() {
    if (formEngines == null) {
        formEngines = new HashMap<String, FormEngine>();
        FormEngine defaultFormEngine = new JuelFormEngine();
        // default form engine is looked up with null
        formEngines.put(null, defaultFormEngine);
        formEngines.put(defaultFormEngine.getName(), defaultFormEngine);
    }
    if (customFormEngines != null) {
        for (FormEngine formEngine : customFormEngines) {
            formEngines.put(formEngine.getName(), formEngine);
        }
    }
}
Also used : JuelFormEngine(org.activiti.engine.impl.form.JuelFormEngine) JuelFormEngine(org.activiti.engine.impl.form.JuelFormEngine) FormEngine(org.activiti.engine.impl.form.FormEngine)

Example 2 with FormEngine

use of org.activiti.engine.impl.form.FormEngine in project Activiti by Activiti.

the class GetRenderedStartFormCmd method execute.

public Object execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("Process Definition '" + processDefinitionId + "' not found", ProcessDefinition.class);
    }
    StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
    if (startFormHandler == null) {
        return null;
    }
    FormEngine formEngine = commandContext.getProcessEngineConfiguration().getFormEngines().get(formEngineName);
    if (formEngine == null) {
        throw new ActivitiException("No formEngine '" + formEngineName + "' defined process engine configuration");
    }
    StartFormData startForm = startFormHandler.createStartFormData(processDefinition);
    return formEngine.renderStartForm(startForm);
}
Also used : StartFormHandler(org.activiti.engine.impl.form.StartFormHandler) ActivitiException(org.activiti.engine.ActivitiException) StartFormData(org.activiti.engine.form.StartFormData) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException) FormEngine(org.activiti.engine.impl.form.FormEngine)

Example 3 with FormEngine

use of org.activiti.engine.impl.form.FormEngine in project Activiti by Activiti.

the class GetRenderedTaskFormCmd method execute.

public Object execute(CommandContext commandContext) {
    TaskEntity task = commandContext.getTaskEntityManager().findTaskById(taskId);
    if (task == null) {
        throw new ActivitiObjectNotFoundException("Task '" + taskId + "' not found", Task.class);
    }
    if (task.getTaskDefinition() == null) {
        throw new ActivitiException("Task form definition for '" + taskId + "' not found");
    }
    TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
    if (taskFormHandler == null) {
        return null;
    }
    FormEngine formEngine = commandContext.getProcessEngineConfiguration().getFormEngines().get(formEngineName);
    if (formEngine == null) {
        throw new ActivitiException("No formEngine '" + formEngineName + "' defined process engine configuration");
    }
    TaskFormData taskForm = taskFormHandler.createTaskForm(task);
    return formEngine.renderTaskForm(taskForm);
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) TaskEntity(org.activiti.engine.impl.persistence.entity.TaskEntity) TaskFormHandler(org.activiti.engine.impl.form.TaskFormHandler) TaskFormData(org.activiti.engine.form.TaskFormData) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException) FormEngine(org.activiti.engine.impl.form.FormEngine)

Aggregations

FormEngine (org.activiti.engine.impl.form.FormEngine)3 ActivitiException (org.activiti.engine.ActivitiException)2 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)2 StartFormData (org.activiti.engine.form.StartFormData)1 TaskFormData (org.activiti.engine.form.TaskFormData)1 JuelFormEngine (org.activiti.engine.impl.form.JuelFormEngine)1 StartFormHandler (org.activiti.engine.impl.form.StartFormHandler)1 TaskFormHandler (org.activiti.engine.impl.form.TaskFormHandler)1 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)1 TaskEntity (org.activiti.engine.impl.persistence.entity.TaskEntity)1