cancel
Showing results for 
Search instead for 
Did you mean: 

RSS-Feed with versionLabel of the content

schneika
Champ in-the-making
Champ in-the-making
I want to apply the versionLabels of documents to my RSS-Feed.
I use this Freemarker-Template:

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
   <channel>
      <title>QMS-Manual RSS-Feed</title>
      <copyright>Copyright © KGS 2007 </copyright>
      <#assign hostname="http://hostname:8080/alfresco">
      <#assign spaceref="${hostname}/navigate/browse/${space.nodeRef.storeRef.protocol}/${space.nodeRef.storeRef.identifier}/${space.nodeRef.id}">
      <#assign datetimeformat="EEE, dd MMM yyyy HH:mm:ss zzz">
      <link>${spaceref}</link>
      <description>Aktualisierte Inhalte im '${space.name}'</description>
      <language>de-de</language>
      <lastBuildDate>${date?string(datetimeformat)}</lastBuildDate>
      <pubDate>${date?string(datetimeformat)}</pubDate>
      <ttl>120</ttl>
      <generator>Alfresco 2.1.1</generator>
      <image>
         <title>${space.name}</title>
         <width>64</width>
         <height>64</height>
         <link>${spaceref}</link>
         <url>${hostname}${space.icon32}</url>
      </image>
      <#assign weekms=1000*60*60*24*7>
      <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
      <#if (dateCompare(child.properties["cm:modified"], date, weekms) == 1) || (dateCompare(child.properties["cm:created"], date, weekms) == 1)>
      <item>
         <title>${child.properties.name}</title>
         <link>${hostname}${child.url}</link>
         <description>
            ${"<a href='${hostname}${child.url}'>"?xml}${child.properties.name}${"</a>"?xml}
            <#if child.properties["cm:description"]?exists && child.properties["cm:description"] != "">
               ${child.properties["cm:description"]}
            </#if>
          <modifier>geändert von ${child.properties["cm:modifier"]}</modifier>

          <versionLabel>Version ${document.versionHistory.versionLabel}</versionLabel>
       </description>
            <pubDate>${child.properties["cm:modified"]?string(datetimeformat)}</pubDate>
            <guid isPermaLink="false">${hostname}${child.url}</guid>
      </item>
      </#if>
      </#list>
   </channel>
</rss>

But during processing the template with document.versionHistory… i got this error:

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
freemarker.template.TemplateException: Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:264)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet$TemplateContentWork.doWork(GuestTemplateContentServlet.java:191)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:260)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet.service(GuestTemplateContentServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:204)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:177)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:107)
at sun.reflect.GeneratedMethodAccessor1712.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy106.processTemplate(Unknown Source)
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:234)
… 18 more
Caused by: freemarker.template.TemplateException: Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:172)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:200)

Please can you tell me, where is my logical Problem?   :?
10 REPLIES 10

schneika
Champ in-the-making
Champ in-the-making
Thanx for help. You are right. The solution was an corrupt Content-Record with version-apsect but with no versioning-records. I re-installed the versioning-aspect and everything was alright after that.

Thanx a lot  Smiley Happy