10-06-2021 07:44 AM
I am trying to get the number (count) of associations for an asset/folder by using the reference type in Java.
But, I don't have an idea how to achieve this.
I have written a query to get this, but this is from alfresco tables. Also, this query fetches the associations only for Asset types not for folders.
Here is the query what I have written
SELECT COUNT(*) FROM alf_node aNode
INNER JOIN alf_node_assoc ana ON aNode.id = ana.source_node_id
INNER JOIN alf_qname aqn ON ana.type_qname_id = aqn.id
WHERE aNode.uuid = "897f6e7a-a9bf-46ea-95b8-b9hyyji7hhuu8"
AND aqn.local_name = "imageReference";
I need this result but, from java code and also, the above query works for asset but not for folders.
I don't need the records, I just need the count of associations
Any help will be really appriciated.
Thanks in advance
10-06-2021 07:52 AM
You may try using NodeService.getSourceAssocs() or NodeService.getTargetAssocs() methods.
In order to get every QNamePattern use QNamePattern.MATCH_ALL for the second argument (http://dev.alfresco.com/resource/AlfrescoOne/5.0/PublicAPI/org/alfresco/service/namespace/RegexQName...)
10-15-2021 04:21 AM
Thanks for the reply, but it does not fullfill the requirement.
Please refere the attahed image, I need those associations count .
Also, nodeService.getSourceAssocs and nodeService.getTargetAssocs does not give the result what I need.
Thanks,
Explore our Alfresco products with the links below. Use labels to filter content by product module.