AnsweredAssumed Answered

getFolderTree and recursion

Question asked by nverwer on Mar 20, 2012
Latest reply on Mar 22, 2012 by jpotts
(Alfresco community edition 4.0.0 b)
I am trying to get a complete tree listing of a folder, and it looks like the CMIS api getFolderTree (http://wiki.alfresco.com/wiki/CMIS_Web_Scripts_Reference#Get_Folder_Hierarchy_.28getFolderTree.29) is the right way to go. However, this will only return one level of the tree, regardless of the setting of the depth parameter.

Upon investigation, I found the webscript atomentry.lib.atom.ftl. On line 126 there is a comment saying "recurse for depth greater than 1", and below that there is "[#if maxdepth == -1 || depth < maxdepth]". However, when I print maxdepth and depth, they are always equal to 1, so the condition is never satisfied, and the listing never recurses.
It seems that the depth parameter is not passed on correctly, although this should happen in tree.get.atomfeed.ftl (line 25), if my understanding is correct.

If I change the above condition so that it is always true, I run into another problem. Freemarker complains that "Expression feedLib is undefined" in "user-directive feedLib.feed".
I can solve that by including [#import "/org/alfresco/cmis/lib/atomfeed.lib.atom.ftl" as feedLib/] in atomentry.lib.atom.ftl, but that does not feel like the right thing to do.

After making these changes, I do get a recursive tree listing, but it seems that, beeing an Alfresco newbie, I am missing something. Is there anyone who is willing to shed some light on this?

Outcomes