ContentUtil collectAllChildren method is not really recursive
-------------------------------------------------------------
Key: MAGNOLIA-2902
URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-2902
Project: Magnolia
Issue Type: Bug
Components: core
Reporter: Bert Leunis
Assignee: Philipp Bärfuss
I think I spotted a different approach for two of the collecAllChildren methods
in the info.magnolia.cms.util.ContentUtil class. The methods collect nodes
recursively.
1. collectAllChildren(List nodes, Content node, ContentFilter filter)
In this method the first level of children is collected with the filter. For
the next level of children not only the nodes that match the filter are taken
into account, but the children of ALL nodes of the first level. So children
that match the filter, but who's parents do not, are indeed found.
2. collectAllChildren(List nodes, Content node, ItemType[] types)
In this method however, only children that have parents that match one of the
ItemTypes in the array are found. For example: if I am looking for all nodes
of type B and C, but when some of them have a parent of type A, they will not
be found.
This seems inconsistent to me, and I think the first way matches the expected
functionality the best. Maybe this method should be deprecated, saying it does
not work well, and create a new method, for example
collectAllChildrenByItemTypes which does the better job. This way existing code
will still work as expected with the deprecated method, and you are not
suddenly confronted with different behaviour.
--
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]>
----------------------------------------------------------------