10-19-2010 03:56 PM
// Get the list of sites
var sites = siteService.listUserSites(userName);
…
// Problem: sites[index] is a java class that has no attribute "duration"
var jsSites = new Array(sites.length);
for (var index = 0; index < sites.length; index++)
{
var site = {};
// Copy needed site properties from java site object to JavaScript site object
site.shortName = sites[index].shortName;
site.sitePreset = sites[index].sitePreset;
site.title = sites[index].title;
site.description = sites[index].description;
site.node = sites[index].node;
site.isPublic = sites[index].isPublic;
site.visibility = sites[index].visibility;
site.customProperties = sites[index].customProperties;
site.listMembers = sites[index].listMembers;
// Put the property duration (from aspect biddingDuration) into the site.
// Convert it from a "org.mozilla.javascript.NativeDate" to Date so ftl will accept it.
var siteNode = sites[index].getNode();
if (siteNode.hasAspect("hbg:biddingDuration"))
{
site.duration = new Date(siteNode.properties["hbg:duration"]);
}
jsSites[index] = site;
}
model.sites = jsSites;
<#assign managers = site.listMembers(null, "SiteManager", 0)?keys />
Expected method. site.listMembers evaluated instead to freemarker.template.SimpleHash on line 39, column 45 in org/alfresco/repository/site/site.lib.ftl.
The problematic instruction:
———-
==> assignment: managers=site.listMembers(null, "SiteManager", 0)?keys [on line 39, column 25 in org/alfresco/repository/site/site.lib.ftl]
in user-directive siteLib.siteJSON [on line 5, column 17 in org/alfresco/repository/person/person.sites.get.json.ftl]
———-
Java backtrace for programmers:
———-
freemarker.template.TemplateException: Expected method. site.listMembers evaluat
ed instead to freemarker.template.SimpleHash on line 39, column 45 in org/alfres
co/repository/site/site.lib.ftl.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.BuiltIn$keysBI._getAsTemplateModel(BuiltIn.java:589)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Assignment.accept(Assignment.java:90)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.Macro$Context.runMacro(Macro.java:164)
at freemarker.core.Environment.visit(Environment.java:601)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
at freemarker.core.Environment.visit(Environment.java:415)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.Environment.process(Environment.java:188)
at freemarker.template.Template.process(Template.java:237)
…
10-25-2010 10:22 AM
site.listMembers = sites[index].listMembers;
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.