[MAGNOLIA-2071] ContentFilter that will filter content based on an existing collection Created: 22/Feb/08 Updated: 02/Dec/13 Resolved: 02/Dec/13 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core |
| Affects Version/s: | 3.5.4 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Trivial |
| Reporter: | Ryan Gardner | Assignee: | Philipp Bärfuss |
| Resolution: | Outdated | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
java 1.4 syntax |
||
| Attachments: |
|
| Template: |
|
| Acceptance criteria: |
Empty
|
| Date of First Response: |
| Description |
|
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 ) |
| Comments |
| Comment by Magnolia International [ 19/Jan/09 ] |
|
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. |