use of org.camunda.bpm.engine.impl.form.handler.DelegateStartFormHandler 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;
}
Aggregations