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

Jukka Zitting commented on OAK-843:
-----------------------------------

Right.

Given the complexities (access control, hidden content, etc.) mentioned in 
OAK-839, there's probably no simple way for us to implement this in terms of an 
extra {{NodeState/Delegate.hasChildNodes()}} method. Thus something like the 
following might be the best solution:

{code}
@Override
public boolean hasNodes() throws RepositoryException {
    return getNodes().hasNext();
}
{code}
                
> Optimization in the Node#hasNodes()
> -----------------------------------
>
>                 Key: OAK-843
>                 URL: https://issues.apache.org/jira/browse/OAK-843
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: jcr
>            Reporter: Antonio Sanso
>
> IMHO  o.a.j.oak.jcr.NodeImpl#hasNodes() has the same "issue" reported for 
> OAK-839. 
> Indeed it makes a call to getChildCount() that can be avoided.
> In order to know if one node has nodes is not necessary to get the full count 
> of the children.
> Should you agree I might provide a patch

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to