gpt4 book ai didi

java - Activity : Passing variables from called process to calling process in call Activity

转载 作者:太空宇宙 更新时间:2023-11-04 07:02:42 27 4
gpt4 key购买 nike

这是我的调用过程:

<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<callActivity id="callactivity1" name="Call activity" calledElement="mySubProcess">
<extensionElements>
<activiti:out source="outp" target="outpp"></activiti:out>
</extensionElements>
</callActivity>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="callactivity1"></sequenceFlow>
<boundaryEvent id="boundaryerror1" name="Error" attachedToRef="callactivity1">
<errorEventDefinition></errorEventDefinition>
</boundaryEvent>
<scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy" activiti:autoStoreVariables="true">
<script>System.out.println(outpp + " ??")</script>
</scriptTask>
<sequenceFlow id="flow2" sourceRef="boundaryerror1" targetRef="scripttask1"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="callactivity1" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow4" sourceRef="scripttask1" targetRef="endevent1"></sequenceFlow>
</process>
</definitions>

而且,这是我调用的过程:

<process id="mySubProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy" activiti:autoStoreVariables="true">
<script>String outpa = "asd"
outp = outpa
System.out.println(outp)</script>
</scriptTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow2" sourceRef="scripttask1" targetRef="endevent1"></sequenceFlow>
<endEvent id="errorendevent1" name="ErrorEnd">
<errorEventDefinition errorRef="errorEnd"></errorEventDefinition>
</endEvent>
<sequenceFlow id="flow3" sourceRef="scripttask1" targetRef="errorendevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${ outp != ""}]]></conditionExpression>
</sequenceFlow>
</process>
</definitions>

当我部署进程并启动 myProcess 时,出现错误:

problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: outpp for class: Script2

我似乎无法找出问题所在。虽然输入参数毫无问题地传递到子进程,但在尝试使用输出参数时出现此错误

谢谢

最佳答案

我想我找到了答案。如果调用 Activity 中的错误边界事件捕获到错误,则不会在调用过程中设置输出参数。解决方法是不使用错误边界事件和错误结束事件;但只需将变量传递给主进程并根据变量的值处理流程(可以使用独占网关)。

关于java - Activity : Passing variables from called process to calling process in call Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21867528/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com