commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dario D <darac1...@gmail.com>
Subject Re: [scxml] Creating ad-hoc arrays in JEXL expressions
Date Tue, 10 May 2011 04:14:11 GMT
Thanks a lot Rahul.

2011/5/10 Rahul Akolkar <rahul.akolkar@gmail.com>

>  On Mon, May 9, 2011 at 4:19 PM, Dario D <darac1111@gmail.com> wrote:
> > Hello,
> >
> > I am trying to create an ad-hoc array in my workflow and provide it to a
> > custom action:
> >
> >    <state id="fetchCustomerData">
> >        <onentry>
> >            <log expr="'Customer - Fetching data'"/>
> >            <al:fetchTableData select="['col1', 'col2']" />
> >        </onentry>
> >    </state>
> >
> > In the custom action, I am evaluating this string through JEXL Evaluator:
> >
> >    public void execute(EventDispatcher eventDispatcher, ErrorReporter
> > errorReporter, SCInstance scInstance, Log log, Collection collection)
> throws
> > ModelException, SCXMLExpressionException {
> >        log.info
> (scInstance.getEvaluator().eval(scInstance.getRootContext(),
> > this.getSelect()));
> >    }
> >
> > This throws an error:
> >
> > WARNING: EXPRESSION_ERROR (eval('['col1', 'col2']'):Encountered "[" at
> line
> > 1, column 1.
> > Was expecting one of:
> >    <EOF>
> >    <INTEGER_LITERAL> ...
> >    <FLOAT_LITERAL> ...
> >    "{" ...
> >    "empty" ...
> >    "(" ...
> >    "size" ...
> >    "-" ...
> >    "~" ...
> >    "!" ...
> >    "not" ...
> >    "null" ...
> >    "true" ...
> >    "false" ...
> >    ";" ...
> >    "if" ...
> >    "while" ...
> >    "foreach" ...
> >    <IDENTIFIER> ...
> >    <STRING_LITERAL> ...
> >    ):
> >
> > Is creating arrays (or HashMaps, for that matter) even possible like this
> in
> > SCXML? I was following the guide at:
> > http://commons.apache.org/jexl/reference/syntax.html
> >
> > The executor was created like this:
> >
> >        SCXMLExecutor exec = null;
> >        exec = new SCXMLExecutor(new JexlEvaluator(), new
> > SimpleDispatcher(), new SimpleErrorReporter());
> >        Context ctx = new JexlContext();
> >        exec.setRootContext(ctx);
> >        exec.setStateMachine(scxml);
> >        exec.setSuperStep(true);
> >
> > Thank you!
> >
> <snip/>
>
> JEXL 2.x syntax will require a suitable Evaluator/Context
> implementation (the default in v0.9 supports JEXL 1.x). You can either
> provide one yourself or try the one attached to this ticket [1].
>
> -Rahul
>
> [1] https://issues.apache.org/jira/browse/SCXML-114
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message