Domanda

I'm trying to get all tags (nodeRefs and names) from alfresco using CMIS.

The Alfresco version is 3.4.

Before googling a lot, I don't find any good query to do this? Any advice?

È stato utile?

Soluzione

I can't find a huge amount of detail written up on the Alfresco wiki on how the Tagging Service works, so if someone fancies taking this and updating the wiki that might be helpful!

There are three key parts to tagging:

  • Tag nodes themselves
  • Tagged nodes
  • Tag Scopes

Tag Nodes live under a special node workspace://SpacesStore/tag:tag-root which is in /cm:categoryRoot/cm:taggable. Tag Nodes are of type cm:category and the cm:name is the tag

Next, you'll want to apply a tag to a node. If it's a new tag, it needs creating in the tag root first. If this is the first tag on a node, add the cm:taggable aspect. Get the noderef of the tag node, then add that to the multi-valued cm:taggable property on the node. (The tagging service will do all of this for you if you call addTag(NodeRef,String)

Finally, various nodes up the primary parent hierarchy of the node you just tagged may be defined as a Tag Scope (eg the Site Node). With this, the nodes with the cm:tagscope aspect have the cm:tagScopeSummary property updated. cm:tagScopeSummary holds the list of tags used by the children of the node, along with the number of times the tag is used. This lets you work out what the most popular tags are for that bit of the tree, as well as working out what tags are used, and when a tag is no longer used by the tree. Again, the TaggingService updates all of that for you.

AFAIK, the various tag properties (cm:taggable and cm:tagScopeSummary) are not exposed via CMIS. You'd need to use one of the normal Alfresco APIs, either from the Public API, or something like script/org/alfresco/collaboration/tagQuery.get which will let you get the list of tags applied to a node. I'd suggest you ensure that the node you query from is a tag scope, so it's nice and quick. The Site is always a tag scope, so that's a good place to start.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top