You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Diptendu Dutta <du...@gmail.com> on 2019/03/16 07:10:25 UTC
[SCXML] Problem with setting values in Context using 2.0-SNAPSHOT
(works with 0.9)
I have the following code that is working in 0.9 but failing in 2.0-SNAPSHOT
.
SCXMLExecutor engine;
Context rootContext;
Evaluator evaluator;
.....
rootContext = evaluator.newContext(null);
engine.setRootContext(rootContext);
engine.go();
rootContext.set("intent", "StartBot");
engine.triggerEvent("run", TriggerEvent.SIGNAL_EVENT);
----------------------
<scxml xmlns="http://www.w3.org/2005/07/scxml"
version="1.0"
datamodel="jexl"
initial="Start">
<datamodel>
<data id="intent" expr=""hello"" />
....
</datamodel>
<state id="Start">
<transition event="run" cond="intent eq "startBot""
target="StartBot" />
<transition event="run" target="Default" />
</state>
<state id="Default">
<onentry>
<log expr="intent" />
<assign location="response" expr=""Sorry I do not
understand!"" />
</onentry>
<transition target="Start" />
</state>
<state id="StartBot">
.....
--------------------------------------------------------------------------------------
The StartBot state is not entered, rather the Default state is entered and
the value
of the "intent" datamodel item is printed as 'hello' rather than 'StartBot'
as expected
INFO: transition (event = run, cond = null, from = /Start, to = /Default)
INFO: null: hello
This same code is working with version 0.9.
Do I have to do things differently with 2.0-SNAPHOT for it to work?
Regards,
Diptendu Dutta
Re: [SCXML] Problem with setting values in Context using 2.0-SNAPSHOT
(works with 0.9)
Posted by Woonsan Ko <wo...@apache.org>.
Hi Diptendu,
Please see my comments inline.
On Sat, Mar 16, 2019 at 8:19 AM Diptendu Dutta <du...@gmail.com> wrote:
>
> I have the following code that is working in 0.9 but failing in 2.0-SNAPSHOT
> .
>
> SCXMLExecutor engine;
> Context rootContext;
> Evaluator evaluator;
>
> .....
> rootContext = evaluator.newContext(null);
> engine.setRootContext(rootContext);
> engine.go();
>
> rootContext.set("intent", "StartBot");
> engine.triggerEvent("run", TriggerEvent.SIGNAL_EVENT);
>
>
> ----------------------
> <scxml xmlns="http://www.w3.org/2005/07/scxml"
> version="1.0"
> datamodel="jexl"
> initial="Start">
>
> <datamodel>
> <data id="intent" expr=""hello"" />
> ....
> </datamodel>
>
> <state id="Start">
> <transition event="run" cond="intent eq "startBot""
> target="StartBot" />
> <transition event="run" target="Default" />
> </state>
>
> <state id="Default">
> <onentry>
> <log expr="intent" />
> <assign location="response" expr=""Sorry I do not
> understand!"" />
> </onentry>
> <transition target="Start" />
> </state>
>
> <state id="StartBot">
> .....
> --------------------------------------------------------------------------------------
> The StartBot state is not entered, rather the Default state is entered and
> the value
> of the "intent" datamodel item is printed as 'hello' rather than 'StartBot'
> as expected
>
> INFO: transition (event = run, cond = null, from = /Start, to = /Default)
> INFO: null: hello
>
> This same code is working with version 0.9.
>
> Do I have to do things differently with 2.0-SNAPHOT for it to work?
It looks like the evaluator in v2 is case-sensitive.
I think it would work with: cond="intent eq "StartBot"" -
'StartBot', not 'startBot'.
Regards,
Woonsan
>
> Regards,
>
> Diptendu Dutta
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org