AnsweredAssumed Answered

Freemarker template that dumps all properties for a node

Question asked by pmonks on Jan 28, 2010
Latest reply on Mar 15, 2010 by tommorris
G'day everyone,

I wrote this code some time ago and thought someone might find it useful - it's a Freemarker template that dumps all of the metadata properties for a node.  Currently it's setup to be configured as a Custom View for a document or space (ie. it's an Explorer UI Presentation Template), but it can be readily adapted for use in other Freemarker templates (eg. in a Web Script view) by copying just the macro.

<#macro dumpProperties node>
    <#list as key>
    <#assign value =[key]>
      <#if value?is_date>
      <#elseif value?is_sequence>
        <#list value as valueValue>
    Node doesn't have properties.

<#if space??>
<strong>Properties for 'space':</strong>
<@dumpProperties space/>

<#if person??>
<strong>Properties for 'person':</strong>
<@dumpProperties person/>

<#if document??>
<strong>Properties for 'document':</strong>
<@dumpProperties document/>

<#if companyHome??>
<strong>Properties for 'companyHome':</strong>
<@dumpProperties companyHome/>

Note: currently it doesn't dump associations (either parent-child or peer-to-peer), but that would be a trivial enhancement.

Please reply to this thread if you have any questions / comments / suggestions / improvements / etc.