Rework APIs of new getChildAssocs with result count limit

- Use regular pattern of get -> select in the DAO
 - All getChildren* batching done after the query
 - Unit tests
 - In progress: Added option (low level select only) to constrain by assoc ID


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31318 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-10-18 13:48:32 +00:00
parent 00ccf994bd
commit 7e27fbd5d8
7 changed files with 117 additions and 59 deletions

View File

@@ -1707,8 +1707,33 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
{
// Get the node
Pair<Long, NodeRef> nodePair = getNodePairNotNull(nodeRef);
// We have a callback handler to filter results
final List<ChildAssociationRef> results = new ArrayList<ChildAssociationRef>(10);
ChildAssocRefQueryCallback callback = new ChildAssocRefQueryCallback()
{
public boolean preLoadNodes()
{
return preload;
}
public boolean handle(
Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair,
Pair<Long, NodeRef> childNodePair)
{
results.add(childAssocPair.getSecond());
return true;
}
public void done()
{
}
};
// Get the assocs pointing to it
return nodeDAO.getChildAssocs(nodePair.getFirst(), typeQName, qname, maxResults, preload);
nodeDAO.getChildAssocs(nodePair.getFirst(), typeQName, qname, maxResults, callback);
// Done
return results;
}
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, Set<QName> childNodeTypeQNames)