9.1 表单定义
9.2 表单属性
9.3 外部表单渲染(External form rendering)
《Flowable文档大全》
Flowable provides a convenient and flexible way to add forms for the manual steps of your business processes. We support two strategies to work with forms: Built-in form rendering with a form definition (created with the form designer) and external form rendering. For the external form rendering strategy form properties can be used (that was supported in the Explorer web application in version 5), or a form key definition that points to an external form reference that can be resolved with custom coding.
Flowable为向业务流程的手动步骤添加表单提供了一种方便、灵活的方式。我们支持两种处理表单的策略:带有表单定义的内置表单呈现(使用表单设计器创建)和外部表单呈现。对于外部表单呈现策略,可以使用表单属性(在版本5的Explorer web应用程序中支持),也可以使用表单键定义(form key definition),表单键指向可通过自定义编码解析的外部表单引用(external form reference)。
Full information about the form definitions and Flowable form engine can be found in the Form Engine user guide. Form definitions can be created with the Flowable Form Designer that’s part of the Flowable Modeler web application, or created by hand with a JSON editor. The Form Engine user guide describes the structure of the form definition JSON in full length. The following form field types are supported:
有关表单定义和Flowable表单引擎的完整信息可以在表单引擎用户指南(Form Engine user guide)中找到。表单定义可以使用Flowable表单设计器(Flowable Form Designer)创建(Flowable Form Designer 是Flowable Modeler web应用程序的一部分),也可以使用JSON编辑器手工创建。表单引擎用户指南完整地描述了表单定义JSON的结构。支持以下表单字段类型:
The Flowable task application is able to render an html form from the form definition JSON. You can also use the Flowable API to get the form definition JSON yourself.
FormModel RuntimeService.getStartFormModel(String processDefinitionId, String processInstanceId)
or
FormModel TaskService.getTaskFormModel(String taskId)
The FormModel object is a Java object representation of the form definition JSON.
Flowable任务应用程序能够基于表单定义JSON渲染出一个html表单。您也可以使用Flowable API自己获取表单定义JSON。
FormModel RuntimeService.getStartFormModel(String processDefinitionId, String processInstanceId)
或
FormModel TaskService.getTaskFormModel(String taskId)
FormModel对象是表单定义JSON的Java对象表示。
To start a process instance with a start form definition you can use the following API call:
要通过启动表单定义启动流程实例,可以使用以下API调用:
ProcessInstance RuntimeService.startProcessInstanceWithForm(String processDefinitionId, String outcome,
Map<String, Object> variables, String processInstanceName)
When a form definition is defined on (one of) the start event(s) of a process definition, this method can be used to start a process instance with the values filled-in in the start form. The Flowable task application uses this method to start a process instance with a form as well. All form values need to be passed in the variables map and an optional form outcome string and process instance name can be provided.
当在流程定义的启动事件(其中之一)上定义表单定义时,可以使用此方法启动流程实例(包含启动表单中填写的值)。Flowable任务应用程序也使用此方法通过表单来启动流程实例。所有表单值都需要通过变量映射(variables map)传递,并且提供可选的表单结果字符串和流程实例名称。
In a similar way, a user task can be completed with a form using the following API call:
类似地,使用以下API调用,可以通过表单完成用户任务:
void TaskService.completeTaskWithForm(String taskId, String formDefinitionId,
String outcome, Map<String, Object> variables)
Again, for more information about form definitions have a look at the Form Engine user guide.
并且,有关表单定义的更多信息,请参阅表单引擎用户指南(Form Engine user guide.)。