[jbpm-commits] JBoss JBPM SVN: r6269 - in jbpm4/trunk: modules/integration/console/src/main/java/org/jbpm/integration/console and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 21 05:23:55 EDT 2010


Author: heiko.braun at jboss.com
Date: 2010-04-21 05:23:55 -0400 (Wed, 21 Apr 2010)
New Revision: 6269

Modified:
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
   jbpm4/trunk/pom.xml
Log:
BPMC-40: re-enable signalling from the bpm console

Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java	2010-04-21 03:07:43 UTC (rev 6268)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java	2010-04-21 09:23:55 UTC (rev 6269)
@@ -46,6 +46,7 @@
 import org.jbpm.api.history.HistoryActivityInstance;
 import org.jbpm.api.history.HistoryProcessInstance;
 import org.jbpm.api.job.Job;
+import org.jbpm.api.model.Transition;
 import org.jbpm.api.task.Participation;
 import org.jbpm.api.task.Task;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -89,10 +90,14 @@
 
     Execution topLevelExecution = execution.getProcessInstance();
     TokenReference tok = execution2TokenReference(topLevelExecution);
+      
 
     Collection<ExecutionImpl> childExecutions = (Collection) topLevelExecution.getExecutions();
     if (childExecutions != null) {
       for (ExecutionImpl childExecution : childExecutions) {
+        // set process definition on child execution from topLevelExecution
+        childExecution.setProcessDefinition(((ExecutionImpl)topLevelExecution).getProcessDefinition());
+        
         TokenReference childTok = execution2TokenReference(childExecution);
         tok.getChildren().add(childTok);
       }
@@ -109,9 +114,14 @@
     TokenReference tok = new TokenReference();
     tok.setName(execution.getName());
     tok.setId(executionId);
+    
+    // mark execution as signalable if it is in wait state and it is active
+    if (((ExecutionImpl) execution).isActive() && "state".equals(((ExecutionImpl) execution).getActivity().getType())) {
+      tok.setCanBeSignaled(true);
+    }
 
 
-    // Only if the set of current activitities has one element, we can
+    // Only if the set of current activities has one element, we can
     // set the current node name (otherwise it's a parent execution)
     Set<String> currentActivities = execution.findActiveActivityNames();
     if (currentActivities.size() == 1) { 
@@ -126,21 +136,26 @@
     } else {
       tok.setCurrentNodeName(executionId);
     }
-            
-    // transitions
-    List<String> availableSignals = new ArrayList<String>();
-    /* TODO: in jBPM4, executions don't have outgoing transitions. verifiy if this is needed.
-    ExecutionImpl openTopLevelExecution = (ExecutionImpl) execution;
-    
-    List<Transition> outTransitions = openTopLevelExecution.getActivity().getOutgoingTransitions();
-    if (outTransitions != null) {
-      for (Transition t : outTransitions) {
-        String transitionName = t.getName() != null ? t.getName() : "to_" + t.getDestination().getName();
-        availableSignals.add(transitionName);
+           
+    if (((ExecutionImpl) execution).getActivity() !=null && "state".equals(((ExecutionImpl) execution).getActivity().getType())) {
+      // transitions
+      List<String> availableSignals = new ArrayList<String>();
+      // fetch outgoing transitions for state activity only, it is required to allow proper
+      // signaling to be made from console - it must send real signal name (outgoing transition)
+      // because there is not signal name check when signaling and if wrong name was given caller will not get any error
+      // and execution will remain in wait state
+      ExecutionImpl openTopLevelExecution = (ExecutionImpl) execution;
+      
+      List<Transition> outTransitions = openTopLevelExecution.getActivity().getOutgoingTransitions();
+      if (outTransitions != null) {
+        for (Transition t : outTransitions) {
+          // if name is not given use 'default transition' as name to be consistent with ProcessFacade check
+          String transitionName = t.getName() != null ? t.getName() : "default transition";
+          availableSignals.add(transitionName);
+        }
       }
+      tok.setAvailableSignals(availableSignals);
     }
-    tok.setAvailableSignals(availableSignals);
-*/
     return tok;
   }
 

Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java	2010-04-21 03:07:43 UTC (rev 6268)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java	2010-04-21 09:23:55 UTC (rev 6269)
@@ -21,15 +21,25 @@
  */
 package org.jbpm.integration.console;
 
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
 import org.jboss.bpm.console.client.model.ProcessInstanceRef;
 import org.jboss.bpm.console.server.integration.ProcessManagement;
-import org.jbpm.api.*;
+import org.jbpm.api.Execution;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessDefinitionQuery;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.RepositoryService;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
 
-import java.io.InputStream;
-import java.util.*;
-
 /**
  * @author Heiko.Braun <heiko.braun at jboss.com>
  * @author jbarrez
@@ -79,13 +89,17 @@
     List<ProcessInstance> processInstances = execService.createProcessInstanceQuery()
                                                         .processDefinitionId(procDefId)
                                                         .list();
+    // must fetch process definition first to be able to get information about activities
+    RepositoryService repositoryService = this.processEngine.getRepositoryService();
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).uniqueResult();
+    
 
-    List<ProcessInstanceRef> results = adoptProcessInstances(processInstances);
-   
+    List<ProcessInstanceRef> results = adoptProcessInstances(processInstances, processDefinition);
+
     return results;
   }
 
-  private List<ProcessInstanceRef> adoptProcessInstances(List<ProcessInstance> processInstances) {
+  private List<ProcessInstanceRef> adoptProcessInstances(List<ProcessInstance> processInstances, ProcessDefinition processDefinition) {
     List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
     for (Execution processInstance : processInstances) {
       if (processInstance.isEnded()) {
@@ -93,6 +107,7 @@
       }
 
       if (processInstance.getIsProcessInstance()) { // parent execution
+        ((ExecutionImpl) processInstance).setProcessDefinition((ProcessDefinitionImpl) processDefinition);
         results.add(ModelAdaptor.adoptExecution((ExecutionImpl) processInstance));
       }
     }

Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml	2010-04-21 03:07:43 UTC (rev 6268)
+++ jbpm4/trunk/pom.xml	2010-04-21 09:23:55 UTC (rev 6269)
@@ -53,7 +53,7 @@
     <drools.version>5.0.1</drools.version>
     <aspectjrt.version>1.5.3</aspectjrt.version>
     <freemarker.version>2.3.15</freemarker.version>
-    <gwt.console.version>2.0.2-SNAPSHOT</gwt.console.version>
+    <gwt.console.version>2.1-SNAPSHOT</gwt.console.version>
     <errai.version>1.1-SNAPSHOT</errai.version>
     <jbpm.gpd.version>4.3</jbpm.gpd.version>
     <hibernate.version>3.3.1.GA</hibernate.version>
@@ -753,6 +753,7 @@
       <url>http://repository.jboss.com/maven2</url>
       <snapshots>
         <enabled>false</enabled>
+        <checksumPolicy>ignore</checksumPolicy>
       </snapshots>
     </repository>
     <repository>
@@ -760,6 +761,7 @@
       <url>http://snapshots.jboss.org/maven2</url>
       <snapshots>
         <enabled>true</enabled>
+        <checksumPolicy>ignore</checksumPolicy>
       </snapshots>
     </repository>
     <repository>



More information about the jbpm-commits mailing list