Unit test for NodeService.getChildAssocsByPropertyValue

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21882 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2010-08-19 17:10:20 +00:00
parent 2d6fd30803
commit 127100a4a1
6 changed files with 150 additions and 7 deletions

View File

@@ -2222,6 +2222,18 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
}
}
private static List<QName> getChildAssocsByPropertyValueBannedProps = new ArrayList<QName>();
static
{
getChildAssocsByPropertyValueBannedProps.add(ContentModel.PROP_NODE_DBID);
getChildAssocsByPropertyValueBannedProps.add(ContentModel.PROP_NODE_UUID);
getChildAssocsByPropertyValueBannedProps.add(ContentModel.PROP_NAME);
getChildAssocsByPropertyValueBannedProps.add(ContentModel.PROP_MODIFIED);
getChildAssocsByPropertyValueBannedProps.add(ContentModel.PROP_MODIFIER);
getChildAssocsByPropertyValueBannedProps.add(ContentModel.PROP_CREATED);
getChildAssocsByPropertyValueBannedProps.add(ContentModel.PROP_CREATOR);
}
@Override
public List<ChildAssociationRef> getChildAssocsByPropertyValue(NodeRef nodeRef,
QName propertyQName,
@@ -2231,6 +2243,13 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
Pair<Long, NodeRef> nodePair = getNodePairNotNull(nodeRef);
Long nodeId = nodePair.getFirst();
// Check the QName is not one of the "special" system maintained ones.
if(getChildAssocsByPropertyValueBannedProps.contains(propertyQName))
{
throw new IllegalArgumentException("getChildAssocsByPropertyValue does not allow search of system maintaied properties: " + propertyQName);
}
final List<ChildAssociationRef> results = new ArrayList<ChildAssociationRef>(10);
// We have a callback handler to filter results
ChildAssocRefQueryCallback callback = new ChildAssocRefQueryCallback()