cancel
Showing results for 
Search instead for 
Did you mean: 

Children of a link

ehelfrich
Champ on-the-rise
Champ on-the-rise
I am trying to return an xml structure for a folder hierarchy via a freemarker template.  The hierarchy contains linked containers and nodes and I would like those nodes to be returned as well.  I can return everything but the content of a linked container. I am on Alfresco 4.0.2. and can't tell what I am doing incorrectly.  Here is my code:

<?xml version="1.0"?>
<#macro recurse_macro node>
   <#if (node.isContainer || node.isLinkToContainer)>
           <folder name="${node.name}">
              <#list node.children as child>
                      <#if (child.isContainer || child.isLinkToContainer) && node.children?size != 0 >
                         <@recurse_macro node=child />
                       </#if>
            <#if (child.isDocument || child.isLinkToDocument) >
            <file name="${child.name?html}"
                         
                              mimetype="${child.properties.content.mimetype}"
                              size="${child.properties.content.size}"
                      
                      />
            </#if>
                    </#list>
                 </folder>
   </#if>
</#macro>

<rootFolder displayPath="${folder.displayPath}" name="${folder.name}">
<#list folder.children as child>
<@recurse_macro node=child/>
</#list>
</rootFolder>
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
If you go look in the node browser at nodes that are links, you'll see that they don't have any children. But they do have a property called "cm:destination". So you can do something like:


<#if (node.isLinkToContainer)>
    <@recurse_macro node=node.properties.destination />
</#if>


Jeff