How to provide service parameters when invoked through EECA

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

How to provide service parameters when invoked through EECA

Vinay Agarwal-2
Hello,

 

I have searched this and had asked this earlier but haven't yet received a
satisfactory answer.

 

How does a service call, invoked through an EECA, get its parameters? Are
they specified in the ECA definition?

 

I can create EECA's and the service does gets called but I can't figure out
how to input parameters for it. Thanks in advance.

 

Regards,

Vinay Agarwal

Reply | Threaded
Open this post in threaded view
|

Re: How to provide service parameters when invoked through EECA

jonwimp
Hi Vinay,

 > How does a service call, invoked through an EECA, get its parameters? Are
 > they specified in the ECA definition?

GenericDelegator.evalEcaRules() is called when performing some kinds of operations, such as create
(GenericDelegator.create()), remove (eg. removeByPrimaryKey() or removeValue()), update (store()),
retrieve (eg findByPrimaryKey()), etc.

Note that all the above operations involve a DB row/record, aka a GenericEntity.

GenericDelegator.evalEcaRules() then calls DelegatorEcaHandler.evalRules() with the GenericEntity.

DelegatorEcaHandler.evalRules() calls EntityEcaRule.eval(), passing along the GenericEntity.

EntityEcaRule.eval() calls EntityEcaAction.runAction(), where the specified service is called with
the GenericEntity in the call context. Try experimenting with the property "value-attr".

Eg.

<eca entity="SomeEntity" operation="create" event="return">
   <action service="myInterceptingService" mode="sync" value-attr="blah"/>
</eca>

Note also that all of the GenericEntity's attributes are already entered as parameters in the call
context. See EntityEcaAction.runAction(), "makeValid(value, ModelService.IN_PARAM)", where "value"
is your GenericEntity.

So, your intercepting service def should be:

<service name="myInterceptingService" engine="whatever"
          location="wherever" invoke="someMethod" auth="true">
   <auto-attributes entity-name="SomeEntity" mode="IN" include="all"/>
</service>

 > I can create EECA's and the service does gets called but I can't figure out
 > how to input parameters for it. Thanks in advance.

Far as I can tell, only the GenericEntity and the userLogin are passed to your service on an EECA.
See EntityEcaAction.runAction().

Therefore, the following definition has an extra attribute "notUsed" that isn't used.

<service name="myInterceptingService" engine="whatever"
          location="wherever" invoke="someMethod" auth="true">
   <auto-attributes entity-name="SomeEntity" mode="IN" include="all"/>
   <attribute name="notUsed" type="String" mode="IN"/>
</service>

Jonathon

Vinay Agarwal wrote:

> Hello,
>
>  
>
> I have searched this and had asked this earlier but haven't yet received a
> satisfactory answer.
>
>  
>
> How does a service call, invoked through an EECA, get its parameters? Are
> they specified in the ECA definition?
>
>  
>
> I can create EECA's and the service does gets called but I can't figure out
> how to input parameters for it. Thanks in advance.
>
>  
>
> Regards,
>
> Vinay Agarwal
>
>
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.484 / Virus Database: 269.12.4/969 - Release Date: 8/23/2007 4:04 PM