启动进程时,Camunda 发送列表作为进程变量

Camunda send list as process variable when start process

我的 Springboot 应用程序中有一些进程,想通过 rest 启动它。

http://localhost:8080/rest/process-definition/Kvorum:2:c10196c1-1935-11eb-b60d-7a7bf841afbd/start

与 body:

{
    "variables": {
        "list": {
            "value": "[\"1\",\"2\"]",
            "type": "String"
        }
    },
    "businessKey": "myBusinessKey",
    "withVariablesInReturn": true
}

这里需要写什么:

"list": {
    "value": "[\"1\",\"2\"]",
    "type": "Object"
}

接收 List 而不是 String 并在 JavaDelegate 中使用它,代码如下:

List<String> list = (List) execution.getVariable("list");
    "list": {
        "value": "[\"1\",\"2\"]",
        "type": "Object",
        "valueInfo" : {"objectTypeName": "java.util.ArrayList", "serializationDataFormat":"application/json"}
    }