[ 
http://jira.magnolia-cms.com/browse/MAGNOLIA-2071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20511#action_20511
 ] 

Gregory Joseph commented on MAGNOLIA-2071:
------------------------------------------

The accept method would be better implemented by using a comparator (instead of 
"manually" check the node's path) and/or fixing the equals method of 
DefaultContent if needed.

> ContentFilter that will filter content based on an existing collection
> ----------------------------------------------------------------------
>
>                 Key: MAGNOLIA-2071
>                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-2071
>             Project: Magnolia
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 3.5.4
>         Environment: java 1.4 syntax
>            Reporter: Ryan Gardner
>            Assignee: Philipp Bracher
>            Priority: Trivial
>         Attachments: Add_a_content_filter.patch
>
>
> A simple ContentFilter built to satisfy the following use case:
> When building a simpleNavigation, I wanted to only show the parent page of a 
> certain node, and certain children that had a given property set. To retrieve 
> a collection of these pages is trivial using a jcr:query. 
> Originally, I had it using the simple collection.contains(content)  to 
> determine if a page should be returned - but the way Content is implemented 
> at this point doesn't lend itself to this kind of collection operation (it 
> only does the "exact same memory address" comparisson  at this point - and 
> I'm not about to overload that for my simple content filter)
> The filter will first attempt to use that simple operation, since it is cheap 
> - and then it iterates over all of the items in the existing collection. If 
> it finds a match, it returns true (accept)
> If more collection-based filters are required, it would be trivial to 
> abstract the content-based filtering approach and add callback methods for 
> performing the functioning logic and to create simple specialized versions of 
> the filter (such as only accept things that are not in the collection... etc )

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to