List of Inbound Rules
From AlfrescoWiki
Contents |
[edit] Description
This template can be called from a space. (No error handling when called from a document details page.) It traverses the space structure from the current space to all leaves. For each space, the inbound rules are displayed.
[edit] Screenshot
[edit] Template
Full version (too much noise, but you will see what's happening)
<#macro dir node depth>
<#if node.isContainer>
<!-- create dots before the space name, number of dots is depth in space structure -->
<tr><td align='left'>
<#if (depth>0) >
<#list 1..depth as i>
.
</#list>
</#if>
${node.properties.name} </td>
<td align='center'>
<#if node.hasAspect("rule:rules")>
<table>
<!-- traverse systemfolders met Rules from ruleModel.xml-->
<#list node.childAssocs["rule:ruleFolder"] as r>
<tr><th colspan="2">rule:ruleFolder</th></tr>
<tr><td>CmTitle </td><td> ${r.properties["cm:title"]!"no title"}</td></tr>
<tr><td>CmName </td><td> ${r.properties["cm:name"]!"no name"}</td></tr>
<!-- traverse childs in ruleFolder (type name="rule:rule" from ruleModel.xml) -->
<#list r.children as t>
<tr><th colspan="2">rule:rule</th></tr>
<tr><td>CmTitle</td><td> ${t.properties["cm:title"]!"no title"}</td></tr>
<tr><td>CmName</td><td> ${t.properties["cm:name"]!"no name"}</td></tr>
<tr><td>RuleType:</td><td>
<#list t.properties["rule:ruleType"] as rt>
${rt}
</#list>
</td></tr>
<tr><td>Asynchronously: </td><td> ${t.properties["rule:executeAsynchronously"]?string("yes","no")}</td></tr>
<tr><td>ApplyToChildren </td><td> ${t.properties["rule:applyToChildren"]?string("yes","no")}</td></tr>
<tr><td>Disabled: </td><td> ${t.properties["rule:disabled"]?string("yes","no")}</td></tr>
<!-- traverse child-assocs type name="act:compositeaction" from actionModel.xml -->
<#list t.childAssocs["rule:action"] as action>
<tr><th colspan="2">rule:action</th></tr>
<tr><td>CmTitle</td><td> ${action.properties["cm:title"]!"no title"}</td></tr>
<tr><td>CmName</td><td> ${action.properties["cm:name"]!"no name"}</td></tr>
<tr><td>Name </td><td>${action.name!"no name"} </td></tr>
<tr><td>Type</td><td> ${action.type!"no type"}</td></tr>
<tr><td>aTitle</td><td> ${action.properties["act:actionTitle"]!"no title"}</td></tr>
<tr><td>aDescr</td><td> ${action.properties["act:actionDescription"]!"no desc"}</td></tr>
<tr><td>aExecuteAsynchronously </td><td>${action.properties["act:executeAsynchronously"]?string("yes","no")}</td></tr>
<#list action.childAssocs["act:conditions"] as cond>
<tr><th colspan="2">act:conditions</th></tr>
<tr><td>CmTitle</td><td> ${cond.properties["cm:title"]!"no title"}</td></tr>
<tr><td>CmName</td><td> ${cond.properties["cm:name"]!"no name"}</td></tr>
<tr><td>CmName</td><td> ${cond.properties["act:definitionName"]!"no name"}</td></tr>
<#if cond.childAssocs["act:parameters"]?exists>
<#list cond.childAssocs["act:parameters"] as param>
<tr><th colspan="2">act:parameters</th></tr>
<tr><td>CmTitle</td><td> ${param.properties["cm:title"]!"no title"}</td></tr>
<tr><td>CmName</td><td> ${param.properties["cm:name"]!"no name"}</td></tr>
<tr><td>NAME</td><td> ${param.properties["act:parameterName"]!"no name"}</td></tr>
<tr><td>VALUE</td><td> ${param.properties["act:parameterValue"]!"no value"}</td></tr>
<tr><td>TITLE</td><td> ${param.properties["cm:title"]!"no title"}</td></tr>
<tr><td>NAME</td><td> ${param.properties["cm:name"]!"no name"}</td></tr>
<#list param.properties?keys as kkk>
<#if param.properties[kkk]?exists>
<tr><td> ${kkk}</td><td>
<#if param.properties[kkk]?is_date>
${param.properties[kkk]?date }
<#elseif param.properties[kkk]?is_boolean>
${param.properties[kkk]?string("y","n")}
<#else> ${param.properties[kkk]!"-"}
</#if>
</td></tr>
</#if>
</#list>
</#list>
</#if>
</#list>
<!-- traverse type name="act:action" from actionModel.xml -->
<tr><th colspan="2">act:action</th></tr>
<#list action.childAssocs["act:actions"] as actions>
<tr><td>aTitle</td><td> ${actions.properties["act:actionTitle"]!"no title"}</td></tr>
<tr><td>aDescr</td><td> ${actions.properties["act:actionDescription"]!"no desc"}</td></tr>
<tr><td>aExecuteAsynchronously </td><td>${actions.properties["act:executeAsynchronously"]?string("y","n")}</td></tr>
<tr><td>CmTitle</td><td> ${actions.properties["cm:title"]!"no title"}</td></tr>
<tr><td>CmName</td><td> ${actions.properties["cm:name"]!"no title"}</td></tr>
<tr><th colspan="2">act:parameters</th></tr>
<#list actions.childAssocs["act:parameters"] as param>
<tr><td>CmTitle</td><td> ${param.properties["cm:title"]!"no title"}</td></tr>
<tr><td>CmName</td><td> ${param.properties["cm:name"]!"no name"}</td></tr>
<tr><td>NAME</td><td> ${param.properties["act:parameterName"]!"no name"}</td></tr>
<tr><td>VALUE</td><td> ${param.properties["act:parameterValue"]!"no value"}</td></tr>
<tr><td>TITLE</td><td> ${param.properties["cm:title"]!"no title"}</td></tr>
<tr><td>NAME</td><td> ${param.properties["cm:name"]!"no name"}</td></tr>
<#list param.properties?keys as kkk>
<#if param.properties[kkk]?exists> <tr><td> ${kkk}</td><td>
<#if param.properties[kkk]?is_date>
${param.properties[kkk]?date }
<#elseif param.properties[kkk]?is_boolean>
${param.properties[kkk]?string("y","n")}
<#else> ${param.properties[kkk]!"-"}
</#if>
</td></tr>
</#if>
</#list>
</#list>
</#list>
</#list>
</#list>
</#list>
</table>
<#else>
no
</#if>
</td></tr>
<!-- find out if there are more child-spaces, and display rules as well -->
<#list node.children as child>
<#if child.isContainer && node.children?size != 0>
<@dir node=child depth=depth+1/>
</#if>
</#list>
</#if>
</#macro>
<!-- create a table and start traversing the space structure -->
<table border="1">
<tr><th> Name of space </th><th>details</th></tr>
<@dir node=space depth=0/>
</table>
ToDo:
- Strip down to the properties you need
- The relation between all classes is very hard-coded in the current template, it can be more robust to be more generic
[edit] Requirements
Alfresco Version 2.1.x It uses standard functionality provided in this version of Alfresco.
[edit] Source
This template was used in a project of mine.

