You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Adam Heath (JIRA)" <ji...@apache.org> on 2014/06/24 03:46:25 UTC

[jira] [Commented] (OFBIZ-1232) Data filtering in entity views

    [ https://issues.apache.org/jira/browse/OFBIZ-1232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14041585#comment-14041585 ] 

Adam Heath commented on OFBIZ-1232:
-----------------------------------

This set of changes might be much simpler now.  I committed code a while back to allow completely nestable views, to infinite depth.  The bug was that the nested view-link on each nested view was added to the outer WHERE clause, instead of to the inner ON.

My long-running thoughts on this feature, is that you would not ever need to have a separate syntax for date-filtering.  No <filter> tag at all.  Instead, when you specify the <condition> in the model, you'd use a data-filter-condition, at any place.  Then, at runtime, the built up condition would be resolved, and such data-filters would be extracted, and not sent to the database.  The delegator would then store the full, raw list to the cache, but before returning, auto-run the extract set of filters.

This feature would interact with the freeze() method that already exists in the condition objects.  However, instead of running just a single EntityCondition, a new class would be created, that contained the frozen condition as before, and an optional filter.

As each nested level of condition objects return, it would need to check for the optional filter, and if found, it might need to rewrite it, based on various circumstances.

Then, the entity cache system would have to store both the raw list and the filter, so yet another wrapping class would need to be created.

This is a little complex, because the view sql creation logic is underneath the delegator; it wouldn't have access to the split condition/filter results.

Hopefully, others can understand what I've written here.

> Data filtering in entity views
> ------------------------------
>
>                 Key: OFBIZ-1232
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1232
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Oscar Pablo
>            Assignee: Adam Heath
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: filter_views.diff, filter_views.patch, filter_views.patch
>
>
> OfBiz allows the creation of views based on the database model. But the data selection is done only by join. It would be great to select the data also by value. And, in some cases, it avoids workarounds and a cleaner code.
> The proposal is to create a new tag inside view-entity tag from entitymodel.xml with the following syntax:
> <filter entity-alias="<table_alias>" field-name="<field_name>" operator="<operator:equals, not-equals, like...>" value="<value_to_select>"/>
> these tag could appear from 0 to N times. When N times, all filter criteria must match with the data to select it.
> I am attaching the xsd and the code I made...



--
This message was sent by Atlassian JIRA
(v6.2#6252)