Updated metadata retrieval webscript for Web Framework

- now writes out child nodes and hasChildren property

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9263 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Michael Uzqu
2008-05-25 16:06:01 +00:00
parent e6797b7cd1
commit 6c5763e8f4
2 changed files with 65 additions and 12 deletions

View File

@@ -1,4 +1,8 @@
{
<@serialize object=object includeChildren=includeChildren includeContent=includeContent/>
}
<#macro serialize object includeChildren includeContent>
"isContainer" : ${object.isContainer?string}
,
"isDocument" : ${object.isDocument?string}
@@ -21,7 +25,7 @@
,
"isLocked" : ${object.isLocked?string}
,
"id" : ${object.id}
"id" : "${object.id}"
,
"nodeRef" : "${object.nodeRef}"
,
@@ -30,24 +34,72 @@
"type" : "${object.type}"
,
"isCategory" : ${object.isCategory?string}
,
<#if properties?exists>
<#if object.children?exists>
<#if object.children?size &gt; 0>
"hasChildren" : true
<#else>
"hasChildren" : false
</#if>
</#if>
<#if object.properties?exists>
,
"properties" :
{
<#assign first = false>
<#list properties?keys as key>
<#assign val = properties[key]>
<#assign first = true>
<#list object.properties?keys as key>
<#assign val = object.properties[key]>
<#if val?exists>
<#if first == true>
<#assign renderable = false>
<#if val?is_string == true>
<#assign renderable = true>
</#if>
<#if val?is_date == true>
<#assign renderable = true>
</#if>
<#if val?is_boolean == true>
<#assign renderable = true>
</#if>
<#if renderable == true>
<#if first == false>
,
</#if>
<#if val?is_string == true>
"${key}" : "${val}"
<#assign first = true>
</#if>
<#if val?is_date == true>
"${key}" : "${val?datetime}"
</#if>
<#if val?is_boolean == true>
"${key}" : "${val}"
</#if>
<#assign first = false>
</#if>
</#if>
</#list>
}
</#if>
<#if includeChildren && object.children?exists>
,
"children" :
[
<#assign first = true>
<#list object.children as child>
<#if first == false>
,
</#if>
{
<@serialize object=child includeChildren=false includeContent=includeContent/>
}
<#assign first = false>
</#list>
]
<#else>
,
"children" : [ ]
</#if>
</#macro>

View File

@@ -30,4 +30,5 @@ if(object == null)
// store onto model
model.object = object;
model.mimetype = object.mimetype;
model.properties = object.properties;
model.includeChildren = true;
model.includeContent = false;