[jbpm-commits] JBoss JBPM SVN: r2904 - in projects/gwt-console/trunk: server/src/main/java/org/jboss/bpm/console/server/dao and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Nov 13 06:47:16 EST 2008


Author: heiko.braun at jboss.com
Date: 2008-11-13 06:47:13 -0500 (Thu, 13 Nov 2008)
New Revision: 2904

Added:
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java
Removed:
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DiagramDAO.java
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DiagramDAO.java
Modified:
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java
   projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java
   projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
   projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
Log:
Start remote signaling implementation

Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -30,7 +30,7 @@
 import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
 import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
 import org.jboss.bpm.console.server.dao.DAOFactory;
-import org.jboss.bpm.console.server.dao.DiagramDAO;
+import org.jboss.bpm.console.server.dao.ExtensionDAO;
 import org.jboss.bpm.console.server.dao.ProcessDAO;
 
 import javax.servlet.http.HttpServletRequest;
@@ -48,7 +48,7 @@
 {
    private static final Log log = LogFactory.getLog(JBPM3Management.class);
 
-   private DiagramDAO diagramDAO = null;
+   private ExtensionDAO extensionDAO = null;
    private ProcessDAO processDAO = null;
 
    private ProcessDAO getProcessDAO()
@@ -64,15 +64,15 @@
 
    }
 
-   private DiagramDAO getDiagramDAO()
+   private ExtensionDAO getExtensionDAO()
    {
-      if(null==this.diagramDAO)
+      if(null==this.extensionDAO)
       {
          DAOFactory factory = DAOFactory.newInstance();
-         this.diagramDAO = factory.createDiagramDAO();
+         this.extensionDAO = factory.createDiagramDAO();
       }
 
-      return this.diagramDAO;
+      return this.extensionDAO;
 
    }
 
@@ -137,7 +137,7 @@
      long id
    )
    {
-      byte[] image = getDiagramDAO().getProcessImage(id);
+      byte[] image = getExtensionDAO().getProcessImage(id);
       if(null==image)
          return Response.serverError().build();
       else
@@ -152,7 +152,7 @@
      long id
    )
    {
-      return getDiagramDAO().getDiagramInfo(id);
+      return getExtensionDAO().getDiagramInfo(id);
    }
 
    @GET
@@ -163,8 +163,34 @@
      long id
    )
    {
-      ActiveNodeInfo activNodeInfo = getDiagramDAO().getActivNodeInfo(id);
+      ActiveNodeInfo activNodeInfo = getExtensionDAO().getActivNodeInfo(id);
       return activNodeInfo;
    }
 
+   @POST
+   @Path("tokens/{id}/signal/{signalName}")
+   @Produces("application/json")
+   public Response signalToken(
+     @PathParam("id")
+     long id,
+     @PathParam("signalName")
+     String signalName)
+   {
+      getExtensionDAO().signalToken(id, signalName);
+      return Response.ok().build();
+   }
+
+   /*@GET
+   @Path("token/{tokenId}/signal")
+   @Produces("application/json")
+   public Response signalTokenDefault(
+     @PathParam("tokenId")
+     long tokenId
+
+   )
+   {
+      // take default transition
+      return signalToken(tokenId, null);
+   } */
+
 }

Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -123,6 +123,7 @@
      @PathParam("next")
      String next)
    {
+      log.debug("Change instance (ID "+instanceId+") to state " +next);
       getProcessDAO().changeState(instanceId, next);
       return Response.ok().build();
    }

Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -30,7 +30,7 @@
 {
    public abstract ProcessDAO createProcessDAO();
 
-   public abstract DiagramDAO createDiagramDAO();
+   public abstract ExtensionDAO createDiagramDAO();
 
    public abstract TaskDAO createTaskDAO();
 

Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DiagramDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DiagramDAO.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DiagramDAO.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao;
-
-import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
-import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
-import org.jboss.bpm.console.server.dao.ProcessDAO;
-
-/**
- * Proprietary to jBPM3, no sure if it will stay.
- * 
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public interface DiagramDAO
-{
-   byte[] getProcessImage(long processId);
-
-   DiagramInfo getDiagramInfo(long processId);
-
-   ActiveNodeInfo getActivNodeInfo(long instanceId);
-}

Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java (from rev 2755, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/DiagramDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java	                        (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.server.dao.ProcessDAO;
+
+/**
+ * Proprietary to jBPM3, no sure if it will stay.
+ * 
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public interface ExtensionDAO
+{
+   byte[] getProcessImage(long processId);
+
+   DiagramInfo getDiagramInfo(long processId);
+
+   ActiveNodeInfo getActivNodeInfo(long instanceId);
+
+   void signalToken(long tokenId, String signal);
+}


Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ExtensionDAO.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -192,4 +192,10 @@
          facade.execute(command);
       }
    }
+
+   public void signalToken(long tokenId, String signalName)
+   {
+      SignalCommand command = new SignalCommand(tokenId, signalName);
+      facade.execute(command);
+   }
 }

Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DAOFactory.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -34,9 +34,9 @@
       return (ProcessDAO) DAOProxy.newInstance(new JBPM3ProcessDAO());              
    }
 
-   public DiagramDAO createDiagramDAO()
+   public ExtensionDAO createDiagramDAO()
    {
-      return (DiagramDAO) DAOProxy.newInstance( new JBPM3DiagramDAO() );  
+      return (ExtensionDAO) DAOProxy.newInstance( new JBPM3ExtensionDAO() );
    }
 
 

Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DiagramDAO.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DiagramDAO.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DiagramDAO.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.dao.internal;
-
-import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
-import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
-import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
-import org.jboss.bpm.console.server.dao.DiagramDAO;
-
-import java.io.InputStream;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class JBPM3DiagramDAO implements DiagramDAO
-{
-   private JBPM3CommandDelegate delegate;
-
-   private static final String PROCESSIMAGE_FILENAME = "processimage.jpg";
-   private static final String GPD_XML_FILENAME = "gpd.xml";
-
-   public JBPM3DiagramDAO()
-   {
-      this.delegate = new JBPM3CommandDelegate();
-   }
-
-   public byte[] getProcessImage(long processId)
-   {
-      org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
-      return p0.getFileDefinition().getBytes(PROCESSIMAGE_FILENAME);
-   }
-
-   public DiagramInfo getDiagramInfo(long processId)
-   {
-      org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
-      InputStream in = p0.getFileDefinition().getInputStream(GPD_XML_FILENAME);
-      return DiagramInfoParser.parse(in);
-   }
-
-   public ActiveNodeInfo getActivNodeInfo(long instanceId)
-   {
-      org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
-      String currentNodeName = instance.getRootToken().getNode().getName();
-      
-      DiagramInfo diagram = getDiagramInfo(instance.getProcessDefinition().getId());
-      List<DiagramNodeInfo> nodes = diagram.getNodeList();
-
-      DiagramNodeInfo activeNode = null;
-      int i = 0;
-      for(DiagramNodeInfo n : nodes)
-      {
-         if(currentNodeName.equals(n.getName()))
-         {
-            activeNode = n;
-            break;
-         }
-      }
-
-      if(null==activeNode)
-         throw new RuntimeException("Failed to retrieve activeNodeInfo for instance " + instanceId);
-
-      return new ActiveNodeInfo(diagram.getWidth(), diagram.getHeight(), activeNode);
-   }
-}

Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java (from rev 2755, projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3DiagramDAO.java)
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java	                        (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server.dao.internal;
+
+import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
+import org.jboss.bpm.console.server.dao.ExtensionDAO;
+
+import java.io.InputStream;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class JBPM3ExtensionDAO implements ExtensionDAO
+{
+   private JBPM3CommandDelegate delegate;
+
+   private static final String PROCESSIMAGE_FILENAME = "processimage.jpg";
+   private static final String GPD_XML_FILENAME = "gpd.xml";
+
+   public JBPM3ExtensionDAO()
+   {
+      this.delegate = new JBPM3CommandDelegate();
+   }
+
+   public byte[] getProcessImage(long processId)
+   {
+      org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+      return p0.getFileDefinition().getBytes(PROCESSIMAGE_FILENAME);
+   }
+
+   public DiagramInfo getDiagramInfo(long processId)
+   {
+      org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+      InputStream in = p0.getFileDefinition().getInputStream(GPD_XML_FILENAME);
+      return DiagramInfoParser.parse(in);
+   }
+
+   public ActiveNodeInfo getActivNodeInfo(long instanceId)
+   {
+      org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
+      String currentNodeName = instance.getRootToken().getNode().getName();
+      
+      DiagramInfo diagram = getDiagramInfo(instance.getProcessDefinition().getId());
+      List<DiagramNodeInfo> nodes = diagram.getNodeList();
+
+      DiagramNodeInfo activeNode = null;
+      int i = 0;
+      for(DiagramNodeInfo n : nodes)
+      {
+         if(currentNodeName.equals(n.getName()))
+         {
+            activeNode = n;
+            break;
+         }
+      }
+
+      if(null==activeNode)
+         throw new RuntimeException("Failed to retrieve activeNodeInfo for instance " + instanceId);
+
+      return new ActiveNodeInfo(diagram.getWidth(), diagram.getHeight(), activeNode);
+   }
+
+
+   public void signalToken(long tokenId, String signal)
+   {
+      delegate.signalToken(tokenId, signal);
+   }
+}


Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ExtensionDAO.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -21,13 +21,11 @@
  */
 package org.jboss.bpm.console.client;
 
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.http.client.URL;
 import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
 
-import java.util.List;
-
-import com.allen_sauer.gwt.log.client.Log;
-
 /**
  * @author Heiko.Braun <heiko.braun at jboss.com>
  */
@@ -74,7 +72,7 @@
       StringBuffer sb = new StringBuffer();
       for(int i=0; i<possibleRoles.length; i++)
       {
-         sb.append(possibleRoles[i]);
+         sb.append(URL.encode(possibleRoles[i]));
          if(i<possibleRoles.length-1)
             sb.append(",");
       }
@@ -119,7 +117,7 @@
 
    public String getTaskListByActorURL(String actor)
    {
-      return getBaseUrl() + "/rs/tasks/actor/"+actor;
+      return getBaseUrl() + "/rs/tasks/actor/"+URL.encode(actor);
    }
 
    public String getTaskFormDefURL(long processId, long taskId)
@@ -130,6 +128,12 @@
    public String getTaskAssignmentURL(long id, String actor)
    {
       String actualActor = actor == null ? "none" : actor;
-      return getBaseUrl() + "/rs/tasks/"+id+"/assignment/"+actualActor;
+      return getBaseUrl() + "/rs/tasks/"+id+"/assignment/"+URL.encode(actualActor);
    }
+
+   public String getTokenSignalUrl(TokenReference tok, String signal)
+   {
+      String encodedSignal = URL.encode(signal);
+      return getBaseUrl() + "/rs/tokens/"+tok.getId()+"/signal/"+encodedSignal;      
+   }
 }

Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java	2008-11-13 11:46:06 UTC (rev 2903)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java	2008-11-13 11:47:13 UTC (rev 2904)
@@ -145,7 +145,6 @@
       final Button suspendButton = new Button("Suspend",
             new ButtonListenerAdapter()
             {
-
                public void onClick(Button button, EventObject eventObject)
                {
                   selectedInstance.setState(ProcessInstance.STATE.SUSPENDED);
@@ -198,6 +197,7 @@
                      public void onSignalToken(TokenReference tok, String signal)
                      {
                         Log.debug("signal -> " +signal );
+                        remoteSignal(tok, signal);
                      }
                   };
 
@@ -228,7 +228,38 @@
       formPanel.setLabelWidth(120);
       return formPanel;
    }
+   
+   private void remoteSignal(TokenReference tok, String signal)
+   {
+      String url = view.getUrlBuilder().getTokenSignalUrl(tok, signal);
+      RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
 
+      try
+      {
+         rb.sendRequest(null,
+               new RequestCallback() {
+
+                  public void onResponseReceived(Request request, Response response)
+                  {
+                     if(response.getStatusCode()!=200)
+                        Log.error("Signaling failed: " +response.getText());
+                     else
+                        resetEditor();
+                  }
+
+                  public void onError(Request request, Throwable t)
+                  {
+                     // Unknown error
+                     Log.error("Unknown error", t);
+                  }
+               });
+      }
+      catch (RequestException e1)
+      {
+         Log.error("Request failed", e1);
+      }
+   }
+
    private void persistStateChange()
    {
       RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, view.getUrlBuilder().getStateChangeURL(
@@ -242,9 +273,10 @@
 
                   public void onResponseReceived(Request request, Response response)
                   {
-                     // testSuccess
-                     instanceList.reloadStore();
-                     selectedInstance = null;
+                     if(response.getStatusCode()!=200)
+                        Log.error("Failed to change state: " +response.getStatusText());
+                     else
+                        resetEditor();
                   }
 
                   public void onError(Request request, Throwable t)
@@ -256,8 +288,7 @@
       }
       catch (RequestException e1)
       {
-         view.setError(e1.getMessage());
-         e1.printStackTrace();
+         Log.error("Request failed", e1);
       }
    }
 
@@ -277,5 +308,11 @@
    {
       return "bpm-instance-icon";
    }
+
+   private void resetEditor()
+   {
+      instanceList.reloadStore();
+      selectedInstance = null;
+   }
 }
 




More information about the jbpm-commits mailing list