11-05-2012 11:46 AM
……….
<property name="fa:customer">
<title>Customer Name</title>
<type>d:text</type>
<mandatory>true</mandatory>
<index enabled="true">
<atomic>false</atomic>
<stored>false</stored>
<tokenised>true</tokenised>
</index>
</property>
……..
Now I need to retrieve the string "Customer Name" between <title></title> tag.<webscript>
<shortname>Document Properties</shortname>
<description>It provides document’s property</description>
<url>/sample/documentprops?nodeRef={nodeRef}</url>
<format default="json">argument</format>
<authentication>user</authentication>
<transaction>none</transaction>
</webscript>
var query = "@sys\\:node-uuid:" + "\"" + args.nodeRef + "\"" + " AND TYPE:\"cm:content\"";
var results = search.luceneSearch(query);
model.document = results[0];
{
"properties" : [
<#assign props = document.properties?keys>
<#list props as t>
{
<#– If the property exists –>
<#if document.properties[t]?exists>
<#– If it is a date, format it accordingly–>
<#if document.properties[t]?is_date>
"${t}": "${document.properties[t]?string("yyyy-MM-dd")}"
<#– If it is a boolean, format it accordingly–>
<#elseif document.properties[t]?is_boolean>
"${t}": "${document.properties[t]?string("yes", "no")}"
<#– Otherwise treat it as a string –>
<#else>
"${t}": "${document.properties[t]}"
</#if>
</#if> }
<#if t_has_next>,</#if>
</#list>
]
}
In this way, I can get the full list pointing to the url http://localhost:8080/alfresco/service/sample/documentprops?nodeRef=beb21716-f5f0-421a-a366-2f0cf85a...…..
"{http://www.kitelabs.it/model/content/1.0}customer": "DELL MAROCCO"
……
11-06-2012 04:03 AM
properties:<#list node.properties?keys as t>
<#– If the property exists –>
<#if (node.properties[t]?exists) )>
<#– If it is a date, format it accordingly–>
<#if node.properties[t]?is_date>
${t}:"${node.properties[t]?string("dd-MM-yyyy")}"
<#– If it is a boolean, format it accordingly–>
<#elseif node.properties[t]?is_boolean>
${t}:"${node.properties[t]?string("yes", "no")}"
<#– If it is a sequence–>
<#elseif node.properties[t]?is_sequence>
${t}:[<#list node.properties[t] as item>
${item}<#if item_has_next>,</#if>
</#list>]
<#– Otherwise treat it as a string –>
<#else>
${t}:"${node.properties[t]?js_string}"
</#if>
<#if t_has_next>,</#if>
</#if>
</#list>
11-06-2012 04:37 AM
var p1 = document.properties.name
var p2 = document.properties["name"];
var p3 = document.properties["my:property"];
var p4 = document.properties["{http://my.domain.org/model/content/1.0}property"];
${t}:"${node.properties[t]?js_string}"
"{http://my.domain.org/model/content/1.0}property": "the quick brown fox jumps over the lazy dog"
11-06-2012 08:51 AM
11-06-2012 12:54 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.