mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
JSON Encoding: added JSON encoding to data API's (note activities, wiki, forum and blogs have not been done yet to prevent unessesary destabalisation before preview release)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10076 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<#macro personJSON person>
|
||||
{
|
||||
"url" : "${url.serviceContext}/api/person/${person.properties.userName}",
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"url" : "${url.serviceContext + "/api/person/" + person.properties.userName}",
|
||||
"userName" : "${person.properties.userName}",
|
||||
<#if person.assocs["cm:avatar"]??>
|
||||
"avatar" : "api/node/${person.assocs["cm:avatar"][0].nodeRef?string?replace('://','/')}/content/thumbnails/avatar",
|
||||
"avatar" : "${"api/node/" + person.assocs["cm:avatar"][0].nodeRef?string?replace('://','/') + "/content/thumbnails/avatar"}",
|
||||
</#if>
|
||||
<#if person.properties.title??>
|
||||
"title" : "${person.properties.title}",
|
||||
@@ -36,13 +37,16 @@
|
||||
"email" : null
|
||||
</#if>
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
||||
|
||||
<#macro personSummaryJSON person>
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"url" : "${url.serviceContext}/api/person/${person.properties.userName}",
|
||||
"url" : "${url.serviceContext + "/api/person/" + person.properties.userName}",
|
||||
"userName" : "${person.properties.userName}",
|
||||
"firstName" : "${person.properties.firstName}",
|
||||
"lastName" : "${person.properties.lastName}"
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
@@ -0,0 +1 @@
|
||||
{}
|
@@ -0,0 +1 @@
|
||||
{}
|
@@ -1,13 +1,15 @@
|
||||
<#macro membershipJSON site role person>
|
||||
{
|
||||
"role" : "${role}",
|
||||
"person":
|
||||
{
|
||||
"userName" : "${person.properties.userName}",
|
||||
"url" : "${url.serviceContext}/api/people/${person.properties.userName}",
|
||||
"firstName" : "${person.properties.firstName}",
|
||||
"lastName" : "${person.properties.lastName}"
|
||||
},
|
||||
"url" : "${url.serviceContext}/api/sites/${site.shortName}/memberships/${person.properties.userName}"
|
||||
}
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"role" : "${role}",
|
||||
"person":
|
||||
{
|
||||
"userName" : "${person.properties.userName}",
|
||||
"url" : "${url.serviceContext + "/api/people/" + person.properties.userName}",
|
||||
"firstName" : "${person.properties.firstName}",
|
||||
"lastName" : "${person.properties.lastName}"
|
||||
},
|
||||
"url" : "${url.serviceContext + "/api/sites/" + site.shortName + "/memberships/" + person.properties.userName}"
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
@@ -1,14 +1,16 @@
|
||||
<#macro siteJSON site>
|
||||
{
|
||||
"url" : "${url.serviceContext}/api/sites/${site.shortName}",
|
||||
"sitePreset" : "${site.sitePreset}",
|
||||
"shortName" : "${site.shortName}",
|
||||
"title" : "${site.title}",
|
||||
"description" : "${site.description}",
|
||||
<#if site.node?exists>
|
||||
"node" : "${url.serviceContext}/api/node/${site.node.storeType}/${site.node.storeId}/${site.node.id}",
|
||||
"tagScope" : "${url.serviceContext}/api/tagscopes/${site.node.storeType}/${site.node.storeId}/${site.node.id}",
|
||||
</#if>
|
||||
"isPublic" : ${site.isPublic?string("true", "false")}
|
||||
}
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"url" : "${url.serviceContext + "/api/sites/" + site.shortName}",
|
||||
"sitePreset" : "${site.sitePreset}",
|
||||
"shortName" : "${site.shortName}",
|
||||
"title" : "${site.title}",
|
||||
"description" : "${site.description}",
|
||||
<#if site.node?exists>
|
||||
"node" : "${url.serviceContext + "/api/node/" + site.node.storeType + "/" + site.node.storeId + "/" + site.node.id}",
|
||||
"tagScope" : "${url.serviceContext + "/api/tagscopes/" + site.node.storeType + "/" + site.node.storeId + "/" + site.node.id}",
|
||||
</#if>
|
||||
"isPublic" : ${site.isPublic?string("true", "false")}
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
@@ -1,5 +1,5 @@
|
||||
[
|
||||
<#list tags as tag>
|
||||
${tag}<#if tag_has_next>,</#if>
|
||||
${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
@@ -1,5 +1,5 @@
|
||||
[
|
||||
<#list tags as tag>
|
||||
${tag}<#if tag_has_next>,</#if>
|
||||
${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
@@ -1,5 +1,5 @@
|
||||
<#macro tagJSON item>
|
||||
{
|
||||
"name" : "${item.name?j_string}",
|
||||
"name" : "${jsonUtils.encodeJSONString(item.name)}",
|
||||
"count" : ${item.count}
|
||||
}</#macro>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
[
|
||||
<#list tags as tag>
|
||||
${tag}<#if tag_has_next>,</#if>
|
||||
${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
@@ -1,8 +1,10 @@
|
||||
[
|
||||
<#list nodes as node>
|
||||
{
|
||||
"nodeRef" : "${node.storeType}://${node.storeId}/${node.id}",
|
||||
"url" : "${url.serviceContext}/api/node/${node.storeType}/${node.storeId}/${node.id}"
|
||||
}<#if node_has_next>,</#if>
|
||||
</#list>
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
<#list nodes as node>
|
||||
{
|
||||
"nodeRef" : "${node.storeType + "://" + node.storeId + "/" + node.id}",
|
||||
"url" : "${url.serviceContext + "/api/node/" + node.storeType + "/" + node.storeId + "/" + node.id}"
|
||||
}<#if node_has_next>,</#if>
|
||||
</#list>
|
||||
</#escape>
|
||||
]
|
@@ -1,6 +1,8 @@
|
||||
<#macro thumbnailJSON node thumbnailName>
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"thumbnailName" : "${thumbnailName}",
|
||||
"url" : "${url.serviceContext}/api/node/${node.storeType}/${node.storeId}/${node.id}/content/thumbnails/${thumbnailName}"
|
||||
"url" : "${url.serviceContext + "/api/node/" + node.storeType + "/" + node.storeId+ "/" + node.id + "/content/thumbnails/" + thumbnailName}"
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
Reference in New Issue
Block a user