Externalise calcultions in a Java module

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Externalise calcultions in a Java module

Antoine.DE-TROOSTEMBERGH
Externalise calcultions in a Java module

Hello,

We have a screen in our application where the calculations are done by an external module. (A custom processor is calling a java component).

This means that we do not use calculate attributes in binds.
Here is how we have done this right now, I is working we well but I was just wondering if it is the correct way to do it.

Maybe there is a much easier way to do this that I have overseen.

Thanks for your input !


<xforms:action ev:event="xforms-revalidate">
        <xforms:insert nodeset="instance('proposal-instance')/proposal/cpfData/consortium/participant/costclaim/formc"
                           at="last()"
                           position="after"
                           origin="xxforms:call-xpl('oxf:/apps/common/services/calculate-eligiblecosts.xpl', ('calculate-eligiblecosts'), (instance('proposal-instance')/proposal/cpfData/consortium/participant/costclaim/formc), 'data')"/>

        <xforms:delete nodeset="instance('proposal-instance')/proposal/cpfData/consortium/participant/costclaim/formc" at="1" />

</xforms:action>

Antoine



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Externalise calcultions in a Java module

Alessandro Vernet
Administrator
Antoine,

Antoine dT wrote
We have a screen in our application where the calculations are done by an external module. (A custom processor is calling a java component).
This means that we do not use calculate attributes in binds.
Here is how we have done this right now, I is working we well but I was just wondering if it is the correct way to do it.
Maybe there is a much easier way to do this that I have overseen.

Thanks for your input !


<xforms:action ev:event="xforms-revalidate">
        <xforms:insert nodeset="instance('proposal-instance')/proposal/cpfData/consortium/participant/costclaim/formc"
                           at="last()"
                           position="after"
                           origin="xxforms:call-xpl('oxf:/apps/common/services/calculate-eligiblecosts.xpl', ('calculate-eligiblecosts'), (instance('proposal-instance')/proposal/cpfData/consortium/participant/costclaim/formc), 'data')"/>
        <xforms:delete nodeset="instance('proposal-instance')/proposal/cpfData/consortium/participant/costclaim/formc" at="1" />
</xforms:action>
There are 2 main ways in which you can can an XPL pipeline: through xxforms:call-xpl(), like you did, or with an <xforms:submission> which does a submission to a URL that you mapped to your pipeline in your page-flow.xml. The first way is simpler (no need to declare a service in page-flow.xml) and potentially more efficient (not going through HTTP), but the second way is more standard. Which one you prefer is mainly a matter of taste.

Now, and this is more of a detail, if you have just one formc inside the costclaim, I think the code would be a bit clearer if you first start by deleting it (xforms:delete), and then do an <xforms:insert context="instance('proposal-instance')/proposal/cpfData/consortium/participant/costclaim" origin="..."/>.

Alex