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
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...)
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,
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.