AnsweredAssumed Answered

Java backed - add a comment

Question asked by konda on Aug 27, 2013
Latest reply on Aug 28, 2013 by konda
Hi all,

I'm trying to write a new Web Script to add comment to a node but using the CommentService (Alfresco Community 4.0.d) I can't see any useful method. I was looking for (http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/repo/forum/CommentService.html#createComment but I can't find it.

Is it missing in my version of Alfresco?

Alternatively how can I achieve this? I tried using the POST /alfresco/service/api/node/{store_type}/{store_id}/{id}/comments but I didn't found a complete example of JSON Entity to use.

Thanks


PS I tried with

{
   "title" : "title",
   "content" : "content"
}

entity but I received an Internal Server Error

{
    "status" :
  {
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "07270010 Wrapped Exception (with status template): 07270348 Errore durante l'elaborazione del modello 'Error executing macro: commentJSON\nrequired parameter: item is not specified.'. Contattare l'amministratore di sistema.", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 07270010 Wrapped Exception (with status template): 07270348 Errore durante l'elaborazione del modello 'Error executing macro: commentJSON\nrequired parameter: item is not specified.'. Contattare l'amministratore di sistema.",
 
  "callstack" :
  [
        ""      ,"freemarker.template.TemplateException: Error executing macro: commentJSON\nrequired parameter: item is not specified."
      ,"freemarker.core.Macro$Context.sanityCheck(Macro.java:211)"
      ,"freemarker.core.Macro$Context.runMacro(Macro.java:169)"
      ,"freemarker.core.Environment.visit(Environment.java:614)"
      ,"freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)"
      ,"freemarker.core.Environment.visit(Environment.java:221)"
      ,"freemarker.core.MixedContent.accept(MixedContent.java:92)"
      ,"freemarker.core.Environment.visit(Environment.java:221)"
      ,"freemarker.core.Environment.process(Environment.java:199)"
      ,"org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)"
      ,"org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:800)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:400)"
      ,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
      ,"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)"
      ,"org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)"
      ,"org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)"
      ,"org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)"
      ,"java.lang.Thread.run(Thread.java:662)"
      ,"org.alfresco.service.cmr.repository.TemplateException: 07270348 Errore durante l'elaborazione del modello 'Error executing macro: commentJSON\nrequired parameter: item is not specified.'. Contattare l'amministratore di sistema."
      ,"org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:206)"
      ,"org.springframework.extensions.webscripts.WebScriptException: 07270010 Wrapped Exception (with status template): 07270348 Errore durante l'elaborazione del modello 'Error executing macro: commentJSON\nrequired parameter: item is not specified.'. Contattare l'amministratore di sistema."
      ,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)"

  ],
 
  "server" : "Community v4.0.0 (4003) schema 5.025",
  "time" : "27-ago-2013 15.21.02"
}

Outcomes