Hi Rinke,

Sorry for my confusion. Indeed, DataNode function seems to exist only for 
assign element.

Regarding other possible options, I think you can set a holder object (named 
"treatmentDataHolder" for instance) in the root context before execution, and 
you can invoke the holder's method to set the data object. For example,
  <script>
    treatmentDataHolder.setData(treatementData);
    treatmentDataHolder.setLocation('treatments/treatment[1]/name');
  </script>

After execution, you can invoke treatmentDataHolder#getData() and 
treatmentDataHolder#getLocation() to read what was set during execution.


Regards,

Woonsan



On Wednesday, October 8, 2014 5:31 AM, R.C. Hoekstra 
<r.c.hoeks...@erasmusmc.nl> wrote:
 

>
>
>> 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
>>
>
>Hi Woonsan,
>
>thanks for your answer. But are you sure about that?
>If I use it like that, I get an "unknown, ambiguous or inaccessible method 
>dataNode" error.
>
>I found the dataNode method in Builtin.java. Its javadoc says:
>
>"Manifests within location attribute of <assign> element, for Commons JEXL and 
>Commons EL based documents."
>
>So what I get from it, is that dataNode can only be used to assign something 
>to a dataNode via <assign>.
>
>That is not what I want. I want to pass a dataNode including subElements to 
>some java object via the cond attribute, so I can write a java method which is 
>able to check conditions with use of the passed dataNode.
>
>
>So: is there a way in which I can pass a dataNode to a java object in the 
>context which is used in a cond attribute? Data obviously doesn't work, as I 
>can see in the Builtin code that it always is parsed to Double or String.
>
>best regards, Rinke
>
>
>
>
>
>> On Thursday, October 2, 2014 3:53 AM, R.C. Hoekstra 
>> <r.c.hoeks...@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
>
>
>

Reply via email to