Modify an ECA

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

Modify an ECA

Jeremy Olmstead
I want to modify an existing ECA by adding a condition that currently
doesn't exist, without modifying the base code.  Is this possible?  What I
attempted didn't work.  First I modified the ofbiz-component.xml file in my
hot-deploy extension of the existing app to include the service-resource
location.  Then I created the definition exactly as it was in the original
xml file with the addition of a new condition.  It's still firing the action
even when my new condition is not true.  See below for relevant code.

Original ECA definition
<eca service="createShipmentReceipt" event="commit">
    <action service="createAcctgTransForShipmentReceipt" mode="sync"/>
</eca>

Custom ECA definition in hot-deploy
<eca service="createShipmentReceipt" event="commit">
    <condition field-name="orderItemTypeId" operator="not-equals"
value="SUPPLIES_ORDER_ITEM"/>
    <action service="createAcctgTransForShipmentReceipt" mode="sync"/>
</eca>

Regards,
Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: Modify an ECA

BJ Freeman
the general rule is only one name can exist within a group.
Since ECA are from the service engine if you load one then another ECA
with both will executed as they are loaded, if I remember correctly.
if you want to modify The ECA I suggest two ways
1) remove the ECA from the core in the ofbiz-component.xml then use the
hot-deploy
2) add a new ECA file with your modes then change the
ofbiz-component.xml to point to that one.

both ways will require to update the ofbiz-component.xml if you do an
update.

=========================
BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man


Jeremy Olmstead sent the following on 11/3/2010 9:21 AM:

> I want to modify an existing ECA by adding a condition that currently
> doesn't exist, without modifying the base code.  Is this possible?  What I
> attempted didn't work.  First I modified the ofbiz-component.xml file in my
> hot-deploy extension of the existing app to include the service-resource
> location.  Then I created the definition exactly as it was in the original
> xml file with the addition of a new condition.  It's still firing the action
> even when my new condition is not true.  See below for relevant code.
>
> Original ECA definition
> <eca service="createShipmentReceipt" event="commit">
>      <action service="createAcctgTransForShipmentReceipt" mode="sync"/>
> </eca>
>
> Custom ECA definition in hot-deploy
> <eca service="createShipmentReceipt" event="commit">
>      <condition field-name="orderItemTypeId" operator="not-equals"
> value="SUPPLIES_ORDER_ITEM"/>
>      <action service="createAcctgTransForShipmentReceipt" mode="sync"/>
> </eca>
>
> Regards,
> Jeremy
>

Reply | Threaded
Open this post in threaded view
|

Re: Modify an ECA

Scott Gray-2
In reply to this post by Jeremy Olmstead
Hi Jeremy,

You can't really override an ECA definition but you could override the service "createAcctgTransForShipmentReceipt" and place the additional condition in a new implementation.
So basically you would:
1. Define a new service called createAcctgTransForShipmentReceipt that points to a new custom implementation
2. Define a service that points to the existing implementation, maybe ofbizCreateAcctgTransForShipmentReceipt
3. Include your condition in the new implementation for #1, if it passes then call #2

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 4/11/2010, at 5:21 AM, Jeremy Olmstead wrote:

> I want to modify an existing ECA by adding a condition that currently
> doesn't exist, without modifying the base code.  Is this possible?  What I
> attempted didn't work.  First I modified the ofbiz-component.xml file in my
> hot-deploy extension of the existing app to include the service-resource
> location.  Then I created the definition exactly as it was in the original
> xml file with the addition of a new condition.  It's still firing the action
> even when my new condition is not true.  See below for relevant code.
>
> Original ECA definition
> <eca service="createShipmentReceipt" event="commit">
>    <action service="createAcctgTransForShipmentReceipt" mode="sync"/>
> </eca>
>
> Custom ECA definition in hot-deploy
> <eca service="createShipmentReceipt" event="commit">
>    <condition field-name="orderItemTypeId" operator="not-equals"
> value="SUPPLIES_ORDER_ITEM"/>
>    <action service="createAcctgTransForShipmentReceipt" mode="sync"/>
> </eca>
>
> Regards,
> Jeremy


smime.p7s (3K) Download Attachment