AnsweredAssumed Answered

[SOLVED] Third-party review doesn't work well

Question asked by showky on Mar 12, 2009
Latest reply on Nov 18, 2009 by khinendra
Hi everybody :)
I am currently ready Alfresco Developer Guide. I'm ready chapter 7, about the advanced workflows. I made a workflow that works well. Here comes the diagram:
http://www.benichka.fr/images/processimage.jpg
When Operation Review and Marketing Review approve a file, an email is sent to a Third Party. The email sent is like that:
You have been assigned to a task named Third Party Review. Take the appropriate action by clicking one of the links below:

third_reject
http://localhost:8080/alfresco/service/someco/bpm/review?id=jbpm$43-@&action=third_reject&guest=true

third_approve
http://localhost:8080/alfresco/service/someco/bpm/review?id=jbpm$43-@&action=third_approve&guest=true
Good :) but when I click on a link:
The Web Script /alfresco/service/someco/bpm/review has responded with a status of 500 - Erreur Interne de Servlet.

500 Description: Le serveur a recontrer une erreur interne qui l''a empêché de satisfaire la requête.
 
Message: Wrapped Exception (with status template): null
  
Exception: org.alfresco.web.scripts.WebScriptException - Wrapped Exception (with status template): null
  
org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:595)
  
Server: Alfresco Labs v3.0.0 (Stable 1526) schema 1 002
Time: 12 mars 2009 16:46:58
  
Diagnostics: Inspect Web Script (com/someco/bpm/review.get)

Here come my configuration files:
review.get.desc.xml:

<webscript>
   <shortname>BPM Review</shortname>
   <description>Review and approve a BPM task</description>
   <url>/someco/bpm/review?id={idArgument}&amp;action={transArgument}</url>
   <format default="html">extension</format>
   <authentification>guest</authentification>
   <transaction>none</transaction>
</webscript>

review.get.html.ftl:

<html>
   <body>
      <p>Signaled ${args.id} for transition ${args.action}</p>
   </body>
</html>

GetReview.java:

package com.someco.scripts;

import java.util.HashMap;
import java.util.Map;

import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.scripts.Status;
import org.alfresco.web.scripts.WebScriptRequest;
import org.apache.log4j.Logger;

public class GetReview extends org.alfresco.web.scripts.DeclarativeWebScript {
   
   private WorkflowService workflowService;
   private Logger logger;

   @Override
   protected Map<String, Object> executeImpl(WebScriptRequest req, Status status) {
      final String id = req.getParameter("id");
      final String action = req.getParameter("action");
      
      if (id == null || action == null) {
         status.setCode(400);
         status.setMessage("Required data has not been provided");
         status.setRedirect(true);
      }
      
      Map<String, Object> model = new HashMap<String, Object>();
      
      model.put("response", AuthenticationUtil.runAs(new RunAsWork<String>() {
         public String doWork() throws Exception {
            logger.debug("About to signal id:" + id + " with transition:" + action);
            workflowService.signal(id, action);
            logger.debug("Signal sent.");
            return "Success";
         }
      },
      "admin"));
      return model;
   }

   public WorkflowService getWorkflowService() {
      return workflowService;
   }

   public void setWorkflowService(WorkflowService workflowService) {
      this.workflowService = workflowService;
   }
}

I just don't know why this exception is raised, I've spent my day on it :/

Any idea ?

Thanks a lot !

Benoit

Outcomes