我们目前正在使用Grails为Activiti编写一个新的前端,在处理任务和填写相关数据时为用户提供自定义UI。
我们可以查询Activiti Engine并返回任务列表;以下代码正如我们所期望的那样工作(和视图一起)给出基本的任务列表 - 名称,描述等:
def index() {
def tasks = activitiService.findAllTasks(["sort": null, "offset": 0, "max": 10])
[tasks: tasks]
}
但是,当我们尝试拉回单个任务的表单数据时(因此我们可以将表单显示给用户完成):
def view(params) {
def taskQuery = taskService.createTaskQuery()
def task = taskQuery.taskId(params.id).singleResult();
def form = formService.getRenderedTaskForm(params.id)
[task: task, form: form]
}
正在抛出错误:
unknown type 'processDefinition' processDefinition
def form =
行上的;完整的痕迹是:
Line | Method
->> 55 | parseFormPropertyType in org.activiti.engine.impl.form.FormTypes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 61 | parseConfiguration in org.activiti.engine.impl.form.DefaultFormHandler
| 34 | parseConfiguration . . . . . . . in org.activiti.engine.impl.form.DefaultStartFormHandler
| 84 | createStartFormHandlers in org.activiti.engine.impl.bpmn.parser.handler.StartEventParseHandler
| 58 | executeParse . . . . . . . . . . in ''
| 38 | executeParse in ''
| 84 | parse . . . . . . . . . . . . . . in org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler
| 27 | parse in org.activiti.engine.impl.bpmn.parser.handler.AbstractFlowNodeBpmnParseHandler
| 36 | parse . . . . . . . . . . . . . . in org.activiti.engine.impl.bpmn.parser.handler.AbstractActivityBpmnParseHandler
| 73 | parseElement in org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers
| 435 | processFlowElements . . . . . . . in org.activiti.engine.impl.bpmn.parser.BpmnParse
| 88 | transformProcess in org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler
| 49 | executeParse . . . . . . . . . . in ''
| 35 | executeParse in ''
| 84 | parse . . . . . . . . . . . . . . in org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler
| 73 | parseElement in org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers
| 395 | transformProcessDefinitions . . . in org.activiti.engine.impl.bpmn.parser.BpmnParse
| 231 | execute in ''
| 107 | deploy . . . . . . . . . . . . . in org.activiti.engine.impl.bpmn.deployer.BpmnDeployer
| 50 | deploy in org.activiti.engine.impl.persistence.deploy.DeploymentManager
| 115 | resolveProcessDefinition . . . . in ''
| 65 | findDeployedProcessDefinitionById in ''
| 751 | getTaskDefinition . . . . . . . . in org.activiti.engine.impl.persistence.entity.TaskEntity
| 54 | execute in org.activiti.engine.impl.cmd.GetRenderedTaskFormCmd
| 24 | execute . . . . . . . . . . . . . in org.activiti.engine.impl.interceptor.CommandInvoker
| 57 | execute in org.activiti.engine.impl.interceptor.CommandContextInterceptor
| 47 | doInTransaction . . . . . . . . . in org.activiti.spring.SpringTransactionInterceptor$1
| 45 | execute in org.activiti.spring.SpringTransactionInterceptor
| 31 | execute . . . . . . . . . . . . . in org.activiti.engine.impl.interceptor.LogInterceptor
| 40 | execute in org.activiti.engine.impl.cfg.CommandExecutorImpl
| 35 | execute . . . . . . . . . . . . . in ''
| 46 | getRenderedTaskForm in org.activiti.engine.impl.FormServiceImpl
| 22 | view . . . . . . . . . . . . . . in TasksController.groovy
| 195 | doFilter in PageFragmentCachingFilter.java
| 63 | doFilter . . . . . . . . . . . . in AbstractFilter.java
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
我们似乎需要在某个时刻将流程定义传递给formService
,或者至少有一个可以创建一个库的库;不幸的是,我们无法确切地知道如何做到这一点。
那么 - 我们错过了什么才能使这个工作?或者,我们是否真的完全走错了路线并且有一个更好的解决方案来满足我们的需求(没有直接查询数据库表,我们试图避免)?
答案 0 :(得分:0)
当您使用未注册的自定义类型定义表单字段时,似乎会出现此类错误。如果您要显示一个公开您的流程定义的表单字段,我发现了一篇可能与之相关的好文章here
基本上您必须定义自定义类型(在本例中为ProcessDefinitionFormType
)并在resources.groovy
中注册:
processDefinitionFormType(org.unnoware.ProcessDefinitionFormType)
processEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) {
// ... many other properties are set here, you may copy them from activiti plugin source
customFormTypes = [ref('processDefinitionFormType')]
}
编辑:
您也可以在'Config.groovy'中注册自定义类型:
beans {
processEngineConfiguration {
customFormTypes = [new org.unnoware.ProcessDefinitionFormType()]
}
}