Transcript
Page 1: Get All Alfresco Tags With CMIS - Stack

14/2/2014 Get all Alfresco tags with CMIS - Stack Overflow

http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis 1/4

Take the 2-minute tour ×

Pymoo

29 1 7

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?

Thanks in advanced,

Juanjo.

alfresco cmis opencmis taggable

asked Oct 12 '13 at 10:36

Do you want to get the Tags on a given Node, or do you want to get the Nodes which represent specific Tags?

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, noregistration required.

Get all Alfresco tags with CMIS

sign up

log in

tour

help

careers 2.0

Page 2: Get All Alfresco Tags With CMIS - Stack

14/2/2014 Get all Alfresco tags with CMIS - Stack Overflow

http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis 2/4

1 Answer

– Gagravarr Oct 12 '13 at 17:26

Thanks for your answer Gagravarr. I will try to clarify the question. I need to show all the tags on a Node (folder)

recursively, because in my integration I have to make a form for uploading files and the user wants to add

existing tags to the document in this moment. – Pymoo Oct 13 '13 at 7:15

Does it have to just be the tags used by that folder+children, or would the tags used on the Site containing the

folder be OK? (Only Alfresco already maintains the list of the latter for you) – Gagravarr Oct 13 '13 at 9:33

I need all the tags for all the Site (including the current folder). What's the best query to do this? It's possible to

access via opencmis? Thanks a lot Gagravarr. – Pymoo Oct 13 '13 at 16:13

All the tags for a site is an easy query to make, just not one available via CMIS. You'll need to use the normal

Alfresco APIs to get it. (I'll try to make an answer out of it later, if no-one beats me to it) – Gagravarr Oct 13 '13

at 18:28

show 1 more comment

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

There are three key parts to tagging:

Tag nodes themselvesTagged nodesTag 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 isthe first tag on a node, add the cm:taggable aspect. Get the noderef of the tag node, then add that tothe multi-valued cm:taggable property on the node. (The tagging service will do all of this for you ifyou call addTag(NodeRef,String)

Finally, various nodes up the primary parent hierarchy of the node you just tagged may be defined as aTag Scope (eg the Site Node). With this, the nodes with the cm:tagscope aspect have the

Page 3: Get All Alfresco Tags With CMIS - Stack

14/2/2014 Get all Alfresco tags with CMIS - Stack Overflow

http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis 3/4

Gagravarr

11.8k 4 17 47

cm:tagScopeSummary property updated. cm:tagScopeSummary holds the list of tags used by thechildren of the node, along with the number of times the tag is used. This lets you work out what the mostpopular tags are for that bit of the tree, as well as working out what tags are used, and when a tag is nolonger 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 viaCMIS. You'd need to use one of the normal Alfresco APIs, either from the Public API, or something likescript/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.

answered Oct 14 '13 at 11:10

Great answer. Thank you. I think, correct me if I'm wrong, the tagging service addTag begins from 4.0 version

of Liferay. isn't it? So I can't make it works just with alfresco-opencmis-extension and chemistry-opencmis

APIs? Could I use Web Services optionally? Note: WARNING! I'm a newbie with Alfresco. – Pymoo Oct 14

'13 at 14:28

I don't know anything about liferay, sorry. I believe you'll need to make a non-CMIS REST api calls to get the

data you want, calling straight to Alfresco. – Gagravarr Oct 14 '13 at 15:18

Excuse I meant Alfresco 4.0 not Liferay. To many opened wars, sorry :-( – Pymoo Oct 14 '13 at 17:01

1 I wouldn't recommend trying it with WebServices. There's a very simple and easy to use REST api that does

exactly what you need, use that! There's no point wasting huge amounts of time trying to hack something up

badly with ws*, embrace the Alfresco way and go with the simple REST call! – Gagravarr Oct 14 '13 at 18:06

1 The Alfresco wiki has lots of examples. Also, another good thing about simple RESTful APIs is that you can

prototype most of it straight from your web browser! – Gagravarr Oct 15 '13 at 8:57

show 3 more comments

Not the answer you're looking for? Browse other questions tagged alfresco cmis

opencmis taggable or ask your own question.

Page 4: Get All Alfresco Tags With CMIS - Stack

14/2/2014 Get all Alfresco tags with CMIS - Stack Overflow

http://stackoverflow.com/questions/19333232/get-all-alfresco-tags-with-cmis 4/4


Top Related