You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "R.C. Hoekstra" <r....@erasmusmc.nl> on 2014/10/02 09:53:25 UTC

[scxml] passing datamodel elements into method call

Hi list, Hi people @ scxml commons,

Can I pass datamodel nodes to a rootContext var, in order to process it in java?

like this:
<target event="bla" cond="agent.check(datamodelNodeRef)" .../>,
where:
* agent is an object of a java class made available to the RootContext, having a check method returning Boolean. I want this check method to evaluate the datamodelNode, in order to return true or false depending on elements.
* datamodelNodeRef is a reference to some node in the datamodel.

I managed to pass final nodes as string here, like this:

<cs:var name="treatment1Name"  expr="Data(treatmentData,'treatments/treatment[1]/name')" />,
<transition ... cond="agent.check(treament1Name)"...

where the treatments/treatment[1]/name is a final node.


However, I would like to pass non final nodes of the datamodel, but everything seems to be evaluated as strings first, before it is passed into the method of the context var.

Hope you can give me a clue.

And, if these kind of constructions are possible, how would they do in terms of performance?

thanks, Rinke



Re: [scxml] passing datamodel elements into method call

Posted by Woonsan Ko <wo...@yahoo.com.INVALID>.
Hi Rinke,

I think you would get a node if you used DataNode function instead:

<cs:var name="treatment1Name"  expr="DataNode(treatmentData,'treatments/treatment[1]/name')" />

Could you try that?

Regards,

Woonsan



On Thursday, October 2, 2014 3:53 AM, R.C. Hoekstra <r....@erasmusmc.nl> wrote:
 

>
>
>Hi list, Hi people @ scxml commons,
>
>Can I pass datamodel nodes to a rootContext var, in order to process it in java?
>
>like this:
><target event="bla" cond="agent.check(datamodelNodeRef)" .../>,
>where:
>* agent is an object of a java class made available to the RootContext, having a check method returning Boolean. I want this check method to evaluate the datamodelNode, in order to return true or false depending on elements.
>* datamodelNodeRef is a reference to some node in the datamodel.
>
>I managed to pass final nodes as string here, like this:
>
><cs:var name="treatment1Name"  expr="Data(treatmentData,'treatments/treatment[1]/name')" />,
><transition ... cond="agent.check(treament1Name)"...
>
>where the treatments/treatment[1]/name is a final node.
>
>
>However, I would like to pass non final nodes of the datamodel, but everything seems to be evaluated as strings first, before it is passed into the method of the context var.
>
>Hope you can give me a clue.
>
>And, if these kind of constructions are possible, how would they do in terms of performance?
>
>thanks, Rinke
>
>
>
>