On 2015-08-18 12:27, Sinisa Zec wrote:
Dears,
We are using Apache SCXML2 for the project which is based on FSM logic. I am
trying for some time to achieve the following:
1.Set some variables in (Groovy)context from Java – X set of variables
2.Read those values in from the <script> in Groovy (it might be any other
but we have chosen Groovy - other suggestions are welcomed).
3.Set the NEW set of variables (in GroovyContext) from Groovy script – Y set
of variables (in principle it is simple mapping)
4.Read the new values (Y set) from context in Java.
I didn't find another way for the scenario above, but to initialize Y set of
variables to empty values already in Java, before step 3. from above.
Do you possible have a different suggestion?
What we typically do is providing a predefined POJO (which could be as simple as
a Map) through the SCXMLExecutor.getRootContext() and use that as an external
environment variable.
Then you can simply script your variables via that environment variable, e.g.
env.X and env.Y
Do you think it would be better to try this with Jexl (I did try, but
totally failed to do anything with Context from Jexl script)?
Groovy in general is more powerful (and dangerous :) ).
Are you possible aware of any useful examples of context manipulation from
<script> (Groovy or any other)?
I don't think we really have concrete examples/tests in Commons SCXML, but it
should be trivial to do this yourself.
Thank you very much in advance!
mit freundlichen Grüßen / with best regards / Lijepi pozdrav
Sinisa Zec
___________________________________________________________
Adcon d.o.o.
Josipa Jurja Strossmayera 341
31000 Osijek
Hrvatska – Croatia
fix: +385 31 638 136
mobile: +385 91 509 0903
<http://www.adcon.hr/> www.adcon.hr
Sinisa Zec <mailto:%3csinisa....@adcon.hr%3e> <sinisa....@adcon.hr>
development
___________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org