cancel
Showing results for 
Search instead for 
Did you mean: 

authorityContainer Properties in Alfresco 3c

mark_smithson
Champ in-the-making
Champ in-the-making
I have found a potential problem with 3c.

I created a new user and group in Alfresco and added the new user to the new group.

Given this webscript:

// locate person for username
var person = people.getPerson(url.extension);
model.groups = people.getContainerGroups(person);

and this template


<?xml version="1.0" encoding="UTF-8"?>
<groups>
      <#list 0..groups?size - 1 as x>
        <group>${groups[x].properties.name}</group>
      </#list>
</groups>


I get this error:

org.alfresco.service.cmr.repository.TemplateException - Error during processing of the template 'get(properties) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.

Stacktrace
java.lang.UnsupportedOperationException
         java.util.AbstractList.set(AbstractList.java:115)
         org.alfresco.repo.template.PropertyConverter.convertProperty(PropertyConverter.java:62)
         org.alfresco.repo.template.TemplateNode$TemplatePropertyConverter.convertProperty(TemplateNode.java:533)
         org.alfresco.repo.template.TemplateNode.getProperties(TemplateNode.java:221)
         sun.reflect.GeneratedMethodAccessor1101.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:835)
         freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:276)
         freemarker.ext.beans.BeanModel.get(BeanModel.java:183)
         freemarker.core.Dot._getAsTemplateModel(Dot.java:76)
         freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
         freemarker.core.Dot._getAsTemplateModel(Dot.java:74)
         freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
         freemarker.core.Expression.getStringValue(Expression.java:93)
         freemarker.core.DollarVariable.accept(DollarVariable.java:76)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.MixedContent.accept(MixedContent.java:92)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
         freemarker.core.Environment.visit(Environment.java:415)
         freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.MixedContent.accept(MixedContent.java:92)
         freemarker.core.Environment.visit(Environment.java:208)
         freemarker.core.Environment.process(Environment.java:188)
         freemarker.template.Template.process(Template.java:237)
         org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:201)
         org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:504)
         org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:252)
         org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:145)
         org.alfresco.repo.web.scripts.RepositoryContainer$1.execute(RepositoryContainer.java:307)
         org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:294)
         org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:209)
         org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:318)
         org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:340)
         org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:262)
         org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:240)
         org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)
         org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
         org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         org.alfresco.web.app.servlet.MTWebScriptAuthenticationFilter.doFilter(MTWebScriptAuthenticationFilter.java:102)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
         org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
         org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
         org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
         org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
         org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
         java.lang.Thread.run(Thread.java:619)
      java.lang.reflect.InvocationTargetException
      sun.reflect.GeneratedMethodAccessor1101.invoke(Unknown Source)
      freemarker.template.TemplateModelException: get(properties) failed on instance of org.alfresco.repo.template.TemplateNode
      freemarker.ext.beans.BeanModel.get(BeanModel.java:223)
      org.alfresco.service.cmr.repository.TemplateException: Error during processing of the template 'get(properties) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.
      org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:205)

It seems to happen when accessing properties. If the user is only a member of the built in EMAIL_CONTRIBUTORS group this error does not occur.

This was not a problem on Labs 3b. Is this a bug, or have I missed something obvious?

Thanks

mark
2 REPLIES 2

mark_smithson
Champ in-the-making
Champ in-the-making
I have managed to work around this issue by accessing the properties I needed in the javascript and putting them into the model.

So it seems there is only a problem when trying to access the properties via Freemarker and seems to be caused by the PropertyConverter trying to update a read only list. There seem to be no changes in the code for these classes in SVN, but perhaps the collection has been made read only in a labs 3c change?

If someone can confirm if this a bug, rather than me being daft, I will log a JIRA case.

cow-cow
Champ in-the-making
Champ in-the-making
I'm sorry for possible missunderstanding. I'm new to Alfresco…
But it seems i have similar problem using Labs 3  (last distrib available)

Me defined a property as follows:
<property name="oid:extLinkList">
               <type>d:text</type>
               <multiple>true</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
And trying to access it in template
<#if space?exists>

   <#if space.properties[oid:extLinkList]?exists>  <table>
       
      <#list space.properties[oid:extLinkList] as links>
              <#assign url=   links?substring( links?index_of("=")  )?trim   >
               <#assign des=   links?substring(0, links?index_of("=")  )?trim   >   
               <tr><td> <a target="new" href=" ${url}l">${des}</a> </td> </tr>
         </#list>
         </table>
   </#if>

<#else> No ext links:
</#if>

That's what i get in Tomcat log
get(properties) failed on instance of org.alfresco.repo.template.TemplateNode

Even an attempt to get a list of properties of space gives the same result.

Is it a bug or something else?