mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +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>
|
<#macro personJSON 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}",
|
"userName" : "${person.properties.userName}",
|
||||||
<#if person.assocs["cm:avatar"]??>
|
<#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>
|
||||||
<#if person.properties.title??>
|
<#if person.properties.title??>
|
||||||
"title" : "${person.properties.title}",
|
"title" : "${person.properties.title}",
|
||||||
@@ -36,13 +37,16 @@
|
|||||||
"email" : null
|
"email" : null
|
||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
||||||
|
</#escape>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
<#macro personSummaryJSON person>
|
<#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}",
|
"userName" : "${person.properties.userName}",
|
||||||
"firstName" : "${person.properties.firstName}",
|
"firstName" : "${person.properties.firstName}",
|
||||||
"lastName" : "${person.properties.lastName}"
|
"lastName" : "${person.properties.lastName}"
|
||||||
}
|
}
|
||||||
|
</#escape>
|
||||||
</#macro>
|
</#macro>
|
@@ -0,0 +1 @@
|
|||||||
|
{}
|
@@ -0,0 +1 @@
|
|||||||
|
{}
|
@@ -1,13 +1,15 @@
|
|||||||
<#macro membershipJSON site role person>
|
<#macro membershipJSON site role person>
|
||||||
{
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
"role" : "${role}",
|
{
|
||||||
"person":
|
"role" : "${role}",
|
||||||
{
|
"person":
|
||||||
"userName" : "${person.properties.userName}",
|
{
|
||||||
"url" : "${url.serviceContext}/api/people/${person.properties.userName}",
|
"userName" : "${person.properties.userName}",
|
||||||
"firstName" : "${person.properties.firstName}",
|
"url" : "${url.serviceContext + "/api/people/" + person.properties.userName}",
|
||||||
"lastName" : "${person.properties.lastName}"
|
"firstName" : "${person.properties.firstName}",
|
||||||
},
|
"lastName" : "${person.properties.lastName}"
|
||||||
"url" : "${url.serviceContext}/api/sites/${site.shortName}/memberships/${person.properties.userName}"
|
},
|
||||||
}
|
"url" : "${url.serviceContext + "/api/sites/" + site.shortName + "/memberships/" + person.properties.userName}"
|
||||||
|
}
|
||||||
|
</#escape>
|
||||||
</#macro>
|
</#macro>
|
@@ -1,14 +1,16 @@
|
|||||||
<#macro siteJSON site>
|
<#macro siteJSON site>
|
||||||
{
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
"url" : "${url.serviceContext}/api/sites/${site.shortName}",
|
{
|
||||||
"sitePreset" : "${site.sitePreset}",
|
"url" : "${url.serviceContext + "/api/sites/" + site.shortName}",
|
||||||
"shortName" : "${site.shortName}",
|
"sitePreset" : "${site.sitePreset}",
|
||||||
"title" : "${site.title}",
|
"shortName" : "${site.shortName}",
|
||||||
"description" : "${site.description}",
|
"title" : "${site.title}",
|
||||||
<#if site.node?exists>
|
"description" : "${site.description}",
|
||||||
"node" : "${url.serviceContext}/api/node/${site.node.storeType}/${site.node.storeId}/${site.node.id}",
|
<#if site.node?exists>
|
||||||
"tagScope" : "${url.serviceContext}/api/tagscopes/${site.node.storeType}/${site.node.storeId}/${site.node.id}",
|
"node" : "${url.serviceContext + "/api/node/" + site.node.storeType + "/" + site.node.storeId + "/" + site.node.id}",
|
||||||
</#if>
|
"tagScope" : "${url.serviceContext + "/api/tagscopes/" + site.node.storeType + "/" + site.node.storeId + "/" + site.node.id}",
|
||||||
"isPublic" : ${site.isPublic?string("true", "false")}
|
</#if>
|
||||||
}
|
"isPublic" : ${site.isPublic?string("true", "false")}
|
||||||
|
}
|
||||||
|
</#escape>
|
||||||
</#macro>
|
</#macro>
|
@@ -1,5 +1,5 @@
|
|||||||
[
|
[
|
||||||
<#list tags as tag>
|
<#list tags as tag>
|
||||||
${tag}<#if tag_has_next>,</#if>
|
${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
|
||||||
</#list>
|
</#list>
|
||||||
]
|
]
|
@@ -1,5 +1,5 @@
|
|||||||
[
|
[
|
||||||
<#list tags as tag>
|
<#list tags as tag>
|
||||||
${tag}<#if tag_has_next>,</#if>
|
${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
|
||||||
</#list>
|
</#list>
|
||||||
]
|
]
|
@@ -1,5 +1,5 @@
|
|||||||
<#macro tagJSON item>
|
<#macro tagJSON item>
|
||||||
{
|
{
|
||||||
"name" : "${item.name?j_string}",
|
"name" : "${jsonUtils.encodeJSONString(item.name)}",
|
||||||
"count" : ${item.count}
|
"count" : ${item.count}
|
||||||
}</#macro>
|
}</#macro>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
[
|
[
|
||||||
<#list tags as tag>
|
<#list tags as tag>
|
||||||
${tag}<#if tag_has_next>,</#if>
|
${jsonUtils.encodeJSONString(tag)}<#if tag_has_next>,</#if>
|
||||||
</#list>
|
</#list>
|
||||||
]
|
]
|
@@ -1,8 +1,10 @@
|
|||||||
[
|
[
|
||||||
<#list nodes as node>
|
<#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}"
|
"nodeRef" : "${node.storeType + "://" + node.storeId + "/" + node.id}",
|
||||||
}<#if node_has_next>,</#if>
|
"url" : "${url.serviceContext + "/api/node/" + node.storeType + "/" + node.storeId + "/" + node.id}"
|
||||||
</#list>
|
}<#if node_has_next>,</#if>
|
||||||
|
</#list>
|
||||||
|
</#escape>
|
||||||
]
|
]
|
@@ -1,6 +1,8 @@
|
|||||||
<#macro thumbnailJSON node thumbnailName>
|
<#macro thumbnailJSON node thumbnailName>
|
||||||
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
{
|
{
|
||||||
"thumbnailName" : "${thumbnailName}",
|
"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>
|
</#macro>
|
Reference in New Issue
Block a user