You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Martin Kreidenweis (JIRA)" <ji...@apache.org> on 2010/07/05 18:22:50 UTC
[jira] Created: (OFBIZ-3847) Entity ECAs not triggered correctly
when using Delegator.storeAll() method
Entity ECAs not triggered correctly when using Delegator.storeAll() method
--------------------------------------------------------------------------
Key: OFBIZ-3847
URL: https://issues.apache.org/jira/browse/OFBIZ-3847
Project: OFBiz
Issue Type: Bug
Components: framework
Affects Versions: Release Branch 10.04
Reporter: Martin Kreidenweis
The conditions don't work when updating (not creating) entities using the Delegator.storeAll() method. E.g. the following condition does not work:
{code}
<eca entity="Product" operation="create-store" event="return">
<condition field-name="autoCreateKeywords" operator="not-equals" value="N"/>
<action service="indexProductKeywords" mode="sync" value-attr="productInstance"/>
</eca>
{code}
The indexProductKeywords service is called anyway when the product is updated and the autoCreateKeywords was "N" and stays "N". It works correctly for newly created products.
The problem is in the method GenericDelegator.storeAll(), where unchanged field values are not passed down to the store() method. The store method calls the ECA engine, which does not receive the unchanged values at all and thus cannot evaluate the EECA conditions correctly.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OFBIZ-3847) Entity ECAs not triggered correctly
when using Delegator.storeAll() method
Posted by "Martin Kreidenweis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OFBIZ-3847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Kreidenweis updated OFBIZ-3847:
--------------------------------------
Attachment: GenericDelegator.java.diff
This should fix the issue in GenericDelegator. We can't see why not all the fields should be passed down to store().
> Entity ECAs not triggered correctly when using Delegator.storeAll() method
> --------------------------------------------------------------------------
>
> Key: OFBIZ-3847
> URL: https://issues.apache.org/jira/browse/OFBIZ-3847
> Project: OFBiz
> Issue Type: Bug
> Components: framework
> Affects Versions: Release Branch 10.04
> Reporter: Martin Kreidenweis
> Attachments: GenericDelegator.java.diff
>
>
> The conditions don't work when updating (not creating) entities using the Delegator.storeAll() method. E.g. the following condition does not work:
> {code}
> <eca entity="Product" operation="create-store" event="return">
> <condition field-name="autoCreateKeywords" operator="not-equals" value="N"/>
> <action service="indexProductKeywords" mode="sync" value-attr="productInstance"/>
> </eca>
> {code}
> The indexProductKeywords service is called anyway when the product is updated and the autoCreateKeywords was "N" and stays "N". It works correctly for newly created products.
> The problem is in the method GenericDelegator.storeAll(), where unchanged field values are not passed down to the store() method. The store method calls the ECA engine, which does not receive the unchanged values at all and thus cannot evaluate the EECA conditions correctly.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OFBIZ-3847) Entity ECAs not triggered correctly
when using Delegator.storeAll() method
Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OFBIZ-3847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889031#action_12889031 ]
Jacques Le Roux commented on OFBIZ-3847:
----------------------------------------
I did not look into code, but I can't find a better idea Scott
> Entity ECAs not triggered correctly when using Delegator.storeAll() method
> --------------------------------------------------------------------------
>
> Key: OFBIZ-3847
> URL: https://issues.apache.org/jira/browse/OFBIZ-3847
> Project: OFBiz
> Issue Type: Bug
> Components: framework
> Affects Versions: Release Branch 10.04
> Reporter: Martin Kreidenweis
> Attachments: GenericDelegator.java.diff
>
>
> The conditions don't work when updating (not creating) entities using the Delegator.storeAll() method. E.g. the following condition does not work:
> {code}
> <eca entity="Product" operation="create-store" event="return">
> <condition field-name="autoCreateKeywords" operator="not-equals" value="N"/>
> <action service="indexProductKeywords" mode="sync" value-attr="productInstance"/>
> </eca>
> {code}
> The indexProductKeywords service is called anyway when the product is updated and the autoCreateKeywords was "N" and stays "N". It works correctly for newly created products.
> The problem is in the method GenericDelegator.storeAll(), where unchanged field values are not passed down to the store() method. The store method calls the ECA engine, which does not receive the unchanged values at all and thus cannot evaluate the EECA conditions correctly.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OFBIZ-3847) Entity ECAs not triggered correctly
when using Delegator.storeAll() method
Posted by "Scott Gray (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OFBIZ-3847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888956#action_12888956 ]
Scott Gray commented on OFBIZ-3847:
-----------------------------------
I think this points to a larger problem whereby there is no guarantee that any entity ECA will receive a complete GenericValue representing the entire record.
For example GenericDelegator.removeByPrimaryKey() only passes the primary key fields to the ECA rule runner and any ECAs that depend on other non-pk fields won't be able to evaluate their condition properly.
I'm not sure what the full solution would look like, it would be good to get some thoughts of others on this.
We could consider having EntityEcaCondition.eval() perform a db lookup if any of the fields it needs to evaluate are missing. If they are missing it could fully populate the entity with the missing fields so that a lookup is only required at most once per delegator operation. If no ECA conditions require any missing fields then the lookup wouldn't be performed, so the performance penalty would only be incurred when necessary.
> Entity ECAs not triggered correctly when using Delegator.storeAll() method
> --------------------------------------------------------------------------
>
> Key: OFBIZ-3847
> URL: https://issues.apache.org/jira/browse/OFBIZ-3847
> Project: OFBiz
> Issue Type: Bug
> Components: framework
> Affects Versions: Release Branch 10.04
> Reporter: Martin Kreidenweis
> Attachments: GenericDelegator.java.diff
>
>
> The conditions don't work when updating (not creating) entities using the Delegator.storeAll() method. E.g. the following condition does not work:
> {code}
> <eca entity="Product" operation="create-store" event="return">
> <condition field-name="autoCreateKeywords" operator="not-equals" value="N"/>
> <action service="indexProductKeywords" mode="sync" value-attr="productInstance"/>
> </eca>
> {code}
> The indexProductKeywords service is called anyway when the product is updated and the autoCreateKeywords was "N" and stays "N". It works correctly for newly created products.
> The problem is in the method GenericDelegator.storeAll(), where unchanged field values are not passed down to the store() method. The store method calls the ECA engine, which does not receive the unchanged values at all and thus cannot evaluate the EECA conditions correctly.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.