Merge pull request #3610 from Alfresco/fix/revert_MNT_24776

Revert "MNT-24776 adding if-else conditionals to avoid null values"
This commit is contained in:
Debjit Chattopadhyay
2025-10-09 18:27:59 +05:30
committed by GitHub

View File

@@ -1,92 +1,83 @@
<#macro renderParent node indent=" "> <#macro renderParent node indent=" ">
<#escape x as jsonUtils.encodeJSONString(x)> <#escape x as jsonUtils.encodeJSONString(x)>
${indent}"parent": ${indent}"parent":
${indent}{ ${indent}{
<#if (node != rootNode) && node.parent??> <#if (node != rootNode) && node.parent??>
<@renderParent node.parent indent+" " /> <@renderParent node.parent indent+" " />
</#if> </#if>
${indent}"type": "${node.typeShort}", ${indent}"type": "${node.typeShort}",
${indent}"isContainer": ${node.isContainer?string}, ${indent}"isContainer": ${node.isContainer?string},
${indent}"name": "${node.properties.name!""}", ${indent}"name": "${node.properties.name!""}",
${indent}"title": "${node.properties.title!""}", ${indent}"title": "${node.properties.title!""}",
${indent}"description": "${node.properties.description!""}", ${indent}"description": "${node.properties.description!""}",
<#if node.properties.modified??>${indent}"modified": "${xmldate(node.properties.modified)}",</#if> <#if node.properties.modified??>${indent}"modified": "${xmldate(node.properties.modified)}",</#if>
<#if node.properties.modifier??>${indent}"modifier": "${node.properties.modifier}",</#if> <#if node.properties.modifier??>${indent}"modifier": "${node.properties.modifier}",</#if>
${indent}"displayPath": "${node.displayPath!""}", ${indent}"displayPath": "${node.displayPath!""}",
${indent}"qnamePath": "${node.qnamePath!""}", ${indent}"qnamePath": "${node.qnamePath!""}",
<#if node.aspects??> <#if node.aspects??>
${indent}"aspects": ${indent}"aspects":
${indent}[ ${indent}[
<#list node.aspects as aspect> <#list node.aspects as aspect>
"${shortQName(aspect)}" "${shortQName(aspect)}"
<#if aspect_has_next>,</#if> <#if aspect_has_next>,</#if>
</#list> </#list>
${indent}], ${indent}],
</#if> </#if>
${indent}"nodeRef": "${node.nodeRef}" ${indent}"nodeRef": "${node.nodeRef}"
${indent}}, ${indent}},
</#escape> </#escape>
</#macro> </#macro>
<#macro pickerResultsJSON results> <#macro pickerResultsJSON results>
<#escape x as jsonUtils.encodeJSONString(x)> <#escape x as jsonUtils.encodeJSONString(x)>
{ {
"data": "data":
{ {
<#if parent??> <#if parent??>
<@renderParent parent /> <@renderParent parent />
</#if> </#if>
"items": "items":
[ [
<#list results as row> <#list results as row>
{ {
"type": "${row.item.typeShort}", "type": "${row.item.typeShort}",
"parentType": "${row.item.parentTypeShort!""}", "parentType": "${row.item.parentTypeShort!""}",
"isContainer": ${row.item.isContainer?string}, "isContainer": ${row.item.isContainer?string},
<#if row.container??>"container": "${row.container!""}",</#if> <#if row.container??>"container": "${row.container!""}",</#if>
<#if row.item.properties?? && row.item.properties.name??> "name": "${row.item.properties.name!""}",
"name": "${row.item.properties.name!""}", <#if row.item.aspects??>
<#else> "aspects": [
"name": "${(row.item.name)!row.item?string!""}", <#list row.item.aspects as aspect>
</#if> "${shortQName(aspect)}"
<#if row.item.aspects??> <#if aspect_has_next>,</#if>
"aspects": [ </#list>
<#list row.item.aspects as aspect> ],
"${shortQName(aspect)}" </#if>
<#if aspect_has_next>,</#if> "title":<#if row.item.properties["lnk:title"]??>"${row.item.properties["lnk:title"]}",
</#list> <#elseif row.item.properties["ia:whatEvent"]??>"${row.item.properties["ia:whatEvent"]}",
], <#else>"${row.item.properties.title!""}",</#if>
</#if> "description": "${row.item.properties.description!""}",
<#if row.item.properties??> <#if row.item.properties.modified??>"modified": "${xmldate(row.item.properties.modified)}",</#if>
"title":<#if row.item.properties["lnk:title"]??>"${row.item.properties["lnk:title"]}", <#if row.item.properties.modifier??>"modifier": "${row.item.properties.modifier}",</#if>
<#elseif row.item.properties["ia:whatEvent"]??>"${row.item.properties["ia:whatEvent"]}", <#if row.item.siteShortName??>"site": "${row.item.siteShortName}",</#if>
<#else>"${row.item.properties.title!""}",</#if> <#if row.item.properties["ia:fromDate"]??>"fromDate": "${xmldate(row.item.properties["ia:fromDate"])}",</#if>
"description": "${row.item.properties.description!""}", "displayPath": "${row.item.displayPath!""}",
<#else> "qnamePath": "${row.item.qnamePath!""}",
"title": "${(row.item.name)!row.item?string!""}", <#if row.item.typeShort != "cm:person" && row.item.typeShort != "cm:authorityContainer">
"description": "", "userAccess":
</#if> {
<#if row.item.properties.modified??>"modified": "${xmldate(row.item.properties.modified)}",</#if> "create": ${row.item.hasPermission("CreateChildren")?string},
<#if row.item.properties.modifier??>"modifier": "${row.item.properties.modifier}",</#if> "edit": ${row.item.hasPermission("Write")?string},
<#if row.item.siteShortName??>"site": "${row.item.siteShortName}",</#if> "delete": ${row.item.hasPermission("Delete")?string}
<#if row.item.properties["ia:fromDate"]??>"fromDate": "${xmldate(row.item.properties["ia:fromDate"])}",</#if> },
"displayPath": "${row.item.displayPath!""}", </#if>
"qnamePath": "${row.item.qnamePath!""}", "nodeRef": "${row.item.nodeRef}"<#if row.selectable?exists>,
<#if row.item.typeShort != "cm:person" && row.item.typeShort != "cm:authorityContainer"> "selectable" : ${row.selectable?string}</#if>
"userAccess": }<#if row_has_next>,</#if>
{ </#list>
"create": ${row.item.hasPermission("CreateChildren")?string}, ]
"edit": ${row.item.hasPermission("Write")?string}, }
"delete": ${row.item.hasPermission("Delete")?string} }
}, </#escape>
</#if>
"nodeRef": "${row.item.nodeRef}"<#if row.selectable?exists>,
"selectable" : ${row.selectable?string}</#if>
}<#if row_has_next>,</#if>
</#list>
]
}
}
</#escape>
</#macro> </#macro>