Alfresco:在ftl -InvalidReferenceException中显示mltext - 表达式res.getPropertyValueByQueryName('t.cm:title')未定义

时间:2016-08-09 14:31:10

标签: alfresco freemarker alfresco-webscripts

我有一个* .get.js webscript执行cmis查询,结果显示在*.html.ftl中。

到目前为止,它适用于字符串/日期属性,例如cmis:namecmis:creationDate。但是我无法显示标题(cm:title)和描述(cm:description)。我想问题是因为这些属性的类型是mltext而ftl想以某种特殊的方式对待它。请注意,我加入cm:titled方面,因此它应该在结果中。同时按cm:titlecm:description进行过滤(通过添加and cm:title like '%test%' to the end of the query)。

我的例外是

freemarker.core.InvalidReferenceException - Expression res.getPropertyValueByQueryName('t.cm:title') is undefined

myScript.get.js

var query = "select d.*, t.* " +
            "from cmis:document as d join cm:titled as t on d.cmis:objectId = t.cmis:objectId " +
            "where IN_FOLDER(d, 'workspace://SpacesStore/72525f23-5273-11dd-9321-e32454ebec2e') ";

var cmisConnection = cmis.getConnection();
var cmisSession    = cmisConnection.getSession();
var results = cmisSession.query(query, false);

model.results = results.iterator();

myScript.get.html.ftl

<ul>
<#list results as res>
    <#assign title = res.getPropertyValueByQueryName('t.cm:title')>
    <td>${title}</td>
</#list>
</ul>

0 个答案:

没有答案