无法读取Java服务任务
中的JSON请求值Input JSON
{
"variables": {
"event":{
"cat" : {"value" : "abc", "type" : "String"},
"reason": {"value":"abc Changes","type":"String"},
"link": {"value":"http://localhost:8080/camunda/app","type":"String"}
}
}
}
Java服务任务
public class ParseRequest implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception
{
// Tried one way as below not working - execution.getVariable("event") is coming null
String jo1 = JSONObject.quote(execution.getVariable("event").toString());
JsonValue event2 = SpinValues.jsonValue((String) jo1).create();
String catValue = event2.getValue().prop("cat").toString();
// Tried as below not working getting Error - org.camunda.bpm.engine.variable.impl.value.NullValueImpl cannot be cast to org.camunda.spin.plugin.variable.value.JsonValue
JsonValue customer = execution.getVariableTyped("event");
String catValue2 = customer .getValue().prop("cat").toString();
}
在我们的项目中首次使用Camunda。任何帮助表示赞赏。 请指导我这里