当我尝试使用taskService.start(task.getId(), "krisv");
启动任务时,我得到No query defined for that name [getAuditTaskById]
。 bpmn文件与Evaluation.bpmn
文件非常相似。我当前的jbpmn版本是6.2。
代码段如下:
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("krisv", "en-UK");
if (tasks.size() > 0) {
TaskSummary task = tasks.get(0);
System.out.println("Task id: " + task.getId());
System.out.println("'krisv' completing task " + task.getName() + ": " + task.getDescription());
System.out.println("Task status: " + task.getStatus().name());
System.out.println("Potential owners: " + task.getActualOwner().getId());
taskService.start(task.getId(), "krisv");
Map<String, Object> results = new HashMap<String, Object>();
results.put("performance", "exceeding");
taskService.complete(task.getId(), "krisv", results);
System.out.println("Completed task");
} else {
System.out.println("No tasks!");
}
上面的代码几乎是示例文件夹中ProcessTest.java文件的复制品。 ProcessTest.java允许完成任务,但完全相同的代码不在我的自定义java文件中。
此外,当前任务的状态为&#34;保留&#34;如果这有任何帮助。谢谢!
答案 0 :(得分:2)
查询是在jbpm-human-task-audit-audit jar中定义的,您需要在类路径中使用它: https://github.com/droolsjbpm/jbpm/blob/6.2.0.Final/jbpm-human-task/jbpm-human-task-audit/src/main/resources/META-INF/TaskAuditorm.xml#L40
您需要确保在persistence.xml中引用此文件,例如: https://github.com/droolsjbpm/jbpm/blob/6.2.0.Final/jbpm-test/src/main/resources/META-INF/persistence.xml#L15