Search in sources :

Example 1 with StartFormHandler

use of org.camunda.bpm.engine.impl.form.handler.StartFormHandler 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);
}
Also used : StartFormHandler(org.camunda.bpm.engine.impl.form.handler.StartFormHandler) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 2 with StartFormHandler

use of org.camunda.bpm.engine.impl.form.handler.StartFormHandler in project camunda-bpm-platform by camunda.

the class FormPropertyHelper method initFormPropertiesOnScope.

public static void initFormPropertiesOnScope(VariableMap variables, PvmExecutionImpl execution) {
    ProcessDefinitionEntity pd = (ProcessDefinitionEntity) execution.getProcessDefinition();
    StartFormHandler startFormHandler = pd.getStartFormHandler();
    startFormHandler.submitFormVariables(variables, execution);
}
Also used : StartFormHandler(org.camunda.bpm.engine.impl.form.handler.StartFormHandler) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 3 with StartFormHandler

use of org.camunda.bpm.engine.impl.form.handler.StartFormHandler 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;
}
Also used : StartFormHandler(org.camunda.bpm.engine.impl.form.handler.StartFormHandler) ScriptEvaluationException(org.camunda.bpm.engine.ScriptEvaluationException) StartFormData(org.camunda.bpm.engine.form.StartFormData) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) FormEngine(org.camunda.bpm.engine.impl.form.engine.FormEngine)

Aggregations

StartFormHandler (org.camunda.bpm.engine.impl.form.handler.StartFormHandler)3 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)3 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)2 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)2 ScriptEvaluationException (org.camunda.bpm.engine.ScriptEvaluationException)1 StartFormData (org.camunda.bpm.engine.form.StartFormData)1 FormEngine (org.camunda.bpm.engine.impl.form.engine.FormEngine)1