Search in sources :

Example 1 with StartFormHandler

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

the class StartEventParseHandler method createStartFormHandlers.

protected void createStartFormHandlers(BpmnParse bpmnParse, StartEvent startEvent, ProcessDefinitionEntity processDefinition) {
    if (processDefinition.getInitial() != null) {
        if (startEvent.getId().equals(processDefinition.getInitial().getId())) {
            StartFormHandler startFormHandler = new DefaultStartFormHandler();
            startFormHandler.parseConfiguration(startEvent.getFormProperties(), startEvent.getFormKey(), bpmnParse.getDeployment(), processDefinition);
            processDefinition.setStartFormHandler(startFormHandler);
        }
    }
}
Also used : StartFormHandler(org.activiti.engine.impl.form.StartFormHandler) DefaultStartFormHandler(org.activiti.engine.impl.form.DefaultStartFormHandler) DefaultStartFormHandler(org.activiti.engine.impl.form.DefaultStartFormHandler)

Example 2 with StartFormHandler

use of org.activiti.engine.impl.form.StartFormHandler 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 StartFormHandler

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

the class SubmitStartFormCmd method execute.

protected ProcessInstance execute(CommandContext commandContext, ProcessDefinitionEntity processDefinition) {
    ExecutionEntity processInstance = null;
    if (businessKey != null) {
        processInstance = processDefinition.createProcessInstance(businessKey);
    } else {
        processInstance = processDefinition.createProcessInstance();
    }
    commandContext.getHistoryManager().reportFormPropertiesSubmitted(processInstance, properties, null);
    StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
    startFormHandler.submitFormProperties(properties, processInstance);
    processInstance.start();
    return processInstance;
}
Also used : StartFormHandler(org.activiti.engine.impl.form.StartFormHandler) ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity)

Example 4 with StartFormHandler

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

the class GetStartFormCmd method execute.

public StartFormData execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class);
    }
    StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
    if (startFormHandler == null) {
        throw new ActivitiException("No startFormHandler defined in process '" + processDefinitionId + "'");
    }
    return startFormHandler.createStartFormData(processDefinition);
}
Also used : StartFormHandler(org.activiti.engine.impl.form.StartFormHandler) ActivitiException(org.activiti.engine.ActivitiException) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Aggregations

StartFormHandler (org.activiti.engine.impl.form.StartFormHandler)4 ActivitiException (org.activiti.engine.ActivitiException)2 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)2 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)2 StartFormData (org.activiti.engine.form.StartFormData)1 DefaultStartFormHandler (org.activiti.engine.impl.form.DefaultStartFormHandler)1 FormEngine (org.activiti.engine.impl.form.FormEngine)1 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)1