how to get associative child nodeRef from parent nodeRef in Alfresco

StackOverflow https://stackoverflow.com/questions/22730909

  •  23-06-2023
  •  | 
  •  

سؤال

i refer this link but it does not work for me...

following code does not work :

String query = "PATH:\"/app:company_home/cm:Customer_Relationship_Management/cm:Business_Documents/cm:Orders/*\"+@crm\\:uniqueDocId:\"" + orderId + "\"";
            List<NodeRef> nodeRefs = CRMUtils.executeLuceneQuery(query);

NodeRef parentRef = nodeRefs.get(0);

List<ChildAssociationRef> childRef = AlfrescoServiceRegistry.getServiceRegistry().getNodeService().getChildAssocs(parentRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);

when i debugged this code i got parentRef and its correct but then following line i got empty childRef...

if you have any another solution then plz help me...

هل كانت مفيدة؟

المحلول

Try the following methods of NodeService:

getSourceAssocs(NodeRef nodeRef, QNamePattern qnamePattern) or 
getTargetAssocs(NodeRef nodeRef, QNamePattern qnamePattern) 

This may solve your problem.

نصائح أخرى

What is the name of your child association? The second parameter in getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) reflects association qname. Maybe your child association qname is not ContentModel.ASSOC_CONTAINS?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top