mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-4352 : F99 alien invasion - node service call for selecting children where a property = value
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21855 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2221,4 +2221,47 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChildAssociationRef> getChildAssocsByPropertyValue(NodeRef nodeRef,
|
||||
QName propertyQName,
|
||||
Serializable value)
|
||||
{
|
||||
// Get the node
|
||||
Pair<Long, NodeRef> nodePair = getNodePairNotNull(nodeRef);
|
||||
Long nodeId = nodePair.getFirst();
|
||||
|
||||
final List<ChildAssociationRef> results = new ArrayList<ChildAssociationRef>(10);
|
||||
// We have a callback handler to filter results
|
||||
ChildAssocRefQueryCallback callback = new ChildAssocRefQueryCallback()
|
||||
{
|
||||
public boolean preLoadNodes()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
nodeDAO.getChildAssocsByPropertyValue(nodeId, propertyQName, value, callback);
|
||||
|
||||
// sort the results
|
||||
List<ChildAssociationRef> orderedList = reorderChildAssocs(results);
|
||||
|
||||
// Done
|
||||
return orderedList;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user