2017-02-16 23 views
0

一個Camunda用戶任務的輸入/輸出參數I具有簡單的工作流:設置/獲取使用Java API

[start_workflow] -> [user_task] -> 
-> [exclusive_gateway] -> (two routes see below) -> [end_workflow] 

的〔exclusive_gateway]具有兩個發佈的路由:

1.) ${if user_task output paramterer == null} -> [NULL_service_task] -> [end_workflow] 

2.) ${if user_task output paramterer != null} -> [NOT_null_service_task] -> [end_workflow] 

在Camunda Modeler中,我已經向[user_task]添加了一個輸出參數(命名爲out)。

問: 如何設置通過Java API 泰德輸出參數之前通過完成任務:

taskService.complete(taskId); 

在[exclusive_gateway]箭,我給自己定的:

Condition type = expression 
Expression = ${out != null} 

但還有更多

如果我刪除了第在完成任務之前的[user_task],並設置一個runtimeService可變電子輸出參數:

runtimeService.setVariable(processInstanceId, "out", name); 

的〔exclusive_gateway]並處理所述參數,和路線如預期的流動。 而不刪除的輸出參數的[user_task]好像: 1.它永遠不會設置(從而== NULL) 2.此空值覆蓋由

runtimeService.setVariable(processInstanceId, "out", name); 

所以可以予設定的設定值通過Java API的任務輸出參數或我只能使用流程變量?

回答

1

我猜你是通過設置在尋找

taskService.complete(<taskId>, Variables.putValue("out", <name>); 

任務和網關(價值的轉發)之間的通信發生的過程變量上完成「出」。

欲瞭解更多信息,請檢查javadoc

+0

非常感謝;) – Kumite