mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged DEV/JASONH to HEAD
12565: JCR - fix ALFCOM-1655 (supercedes part of r12170) 12644: JCR - fix extra testcase for ALFCOM-1655 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12650 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -241,22 +241,48 @@ public class NodeImpl extends ItemImpl implements Node
|
||||
Set<QName> aspects = nodeService.getAspects(nodeRef);
|
||||
ClassDefinition classDef = dictionaryService.getAnonymousType(type, aspects);
|
||||
Map<QName, ChildAssociationDefinition> childAssocs = classDef.getChildAssociations();
|
||||
|
||||
for (ChildAssociationDefinition childAssocDef : childAssocs.values())
|
||||
{
|
||||
QName targetClass = childAssocDef.getTargetClass().getName();
|
||||
if (dictionaryService.isSubClass(nodeType, targetClass))
|
||||
if (nodeType.equals(targetClass))
|
||||
{
|
||||
if (nodeTypeChildAssocDef != null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Cannot determine child association for node type '" + nodeType + " within parent " + nodeRef);
|
||||
}
|
||||
// exact match
|
||||
nodeTypeChildAssocDef = childAssocDef;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeTypeChildAssocDef == null)
|
||||
{
|
||||
for (ChildAssociationDefinition childAssocDef : childAssocs.values())
|
||||
{
|
||||
QName targetClass = childAssocDef.getTargetClass().getName();
|
||||
if (dictionaryService.isSubClass(nodeType, targetClass))
|
||||
{
|
||||
if (childAssocDef.getSourceClass().getName().equals(type))
|
||||
{
|
||||
// matching parent type
|
||||
nodeTypeChildAssocDef = childAssocDef;
|
||||
break;
|
||||
}
|
||||
|
||||
if (nodeTypeChildAssocDef != null)
|
||||
{
|
||||
// more than one match
|
||||
throw new AlfrescoRuntimeException("Cannot determine child association for node type '" + nodeType + " within parent " + nodeRef);
|
||||
}
|
||||
|
||||
nodeTypeChildAssocDef = childAssocDef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeTypeChildAssocDef == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Cannot determine child association for node type '" + nodeType + " within parent " + nodeRef);
|
||||
}
|
||||
|
||||
return nodeTypeChildAssocDef;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user