[jbpm-commits] JBoss JBPM SVN: r3850 - in jbpm4/trunk: modules/enterprise and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Feb 12 08:22:56 EST 2009


Author: heiko.braun at jboss.com
Date: 2009-02-12 08:22:56 -0500 (Thu, 12 Feb 2009)
New Revision: 3850

Modified:
   jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ModelAdaptor.java
   jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java
   jbpm4/trunk/pom.xml
Log:
Migrate console model to string based enitity ID's

Modified: jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml
===================================================================
--- jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml	2009-02-12 13:19:13 UTC (rev 3849)
+++ jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml	2009-02-12 13:22:56 UTC (rev 3850)
@@ -15,6 +15,8 @@
     <orderEntry type="module" module-name="jbpm4-api" exported="" />
     <orderEntry type="module" module-name="gwt-parent" exported="" />
     <orderEntry type="module" module-name="jbpm4-pvm" exported="" />
+    <orderEntry type="module" module-name="gwt-rpc" />
+    <orderEntry type="module" module-name="gwt-server-integration" />
     <orderEntry type="module-library" exported="">
       <library name="M2 Dep: cargo:cargo:jar:0.5:test">
         <CLASSES>

Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ModelAdaptor.java	2009-02-12 13:19:13 UTC (rev 3849)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ModelAdaptor.java	2009-02-12 13:22:56 UTC (rev 3850)
@@ -24,11 +24,8 @@
 import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
 import org.jboss.bpm.console.client.model.ProcessInstanceRef;
 
-import org.jbpm.ProcessDefinition;
-import org.jbpm.Execution;
 import org.jbpm.model.OpenExecution;
 import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.pvm.internal.model.ProcessElementImpl;
 
 import java.util.Date;
 
@@ -40,7 +37,7 @@
   public static ProcessDefinitionRef adoptDefinition(OpenProcessDefinition p0)
   {
     ProcessDefinitionRef def = new ProcessDefinitionRef();
-    def.setProcessId( ((ProcessElementImpl)p0).getDbid() );
+    def.setId( p0.getId() );
     def.setName(p0.getName());
     def.setVersion(p0.getVersion());
 
@@ -55,9 +52,9 @@
   public static ProcessInstanceRef adoptExecution(OpenExecution e0)
   {
     ProcessInstanceRef ref = new ProcessInstanceRef();
-    ref.setInstanceId( e0.getDbid() );
+    ref.setId( e0.getId() );
     ref.setKey(e0.getKey());
-    ref.setDefinitionId(e0.getProcessDefinition().getDbid());
+    ref.setDefinitionId(e0.getProcessDefinition().getId() );
 
 
     ref.setState( ProcessInstanceRef.STATE.RUNNING);  // TODO: FIXME

Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java	2009-02-12 13:19:13 UTC (rev 3849)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java	2009-02-12 13:22:56 UTC (rev 3850)
@@ -67,27 +67,34 @@
 
   }
 
-  public ProcessDefinitionRef getProcessDefinition(long procDefId)
+  public ProcessDefinitionRef getProcessDefinition(String procDefId)
   {
     ProcessService processService = this.processEngine.getProcessService();
-    ProcessDefinition p0 = processService.findProcessDefinitionById(String.valueOf(procDefId));
+    ProcessDefinition p0 = processService.findProcessDefinitionById(procDefId);
     return ModelAdaptor.adoptDefinition((OpenProcessDefinition)p0);
   }
 
-  public List<ProcessDefinitionRef> removeProcessDefinition(long procDefId)
+  public List<ProcessDefinitionRef> removeProcessDefinition(String procDefId)
   {
     ProcessService processService = this.processEngine.getProcessService();
-    processService.deleteProcessDefinitionCascade(String.valueOf(procDefId));
+    processService.deleteProcessDefinitionCascade(procDefId);
     return getProcessDefinitions();
   }
 
-  public List<ProcessInstanceRef> getProcessInstances(long procDefId)
+  public List<ProcessInstanceRef> getProcessInstances(String procDefId)
   {
     ExecutionService execService = this.processEngine.getExecutionService();
     ExecutionQuery query = execService.createExecutionQuery();
     query.processDefinitionId(String.valueOf(procDefId));
     List<Execution> executions = query.execute();
 
+    List<ProcessInstanceRef> results = adoptTopLevelExecutions(executions);
+
+    return results;
+  }
+
+  private List<ProcessInstanceRef> adoptTopLevelExecutions(List<Execution> executions)
+  {
     List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
     for(Execution exec : executions)
     {
@@ -96,21 +103,30 @@
         results.add( ModelAdaptor.adoptExecution((OpenExecution)exec) );
       }
     }
-
     return results;
   }
 
-  public ProcessInstanceRef getProcessInstance(long procId)
+  public ProcessInstanceRef getProcessInstance(String instanceId)
   {
-    throw new RuntimeException("Not implemented");
+    ExecutionService execService = this.processEngine.getExecutionService();
+    ExecutionQuery query = execService.createProcessInstanceQuery();
+    query.processInstanceId(instanceId);
+    List<Execution> executions = query.execute();
+
+    if(executions.size()>1 || executions.isEmpty())
+      throw new IllegalStateException("No precise match for instanceId " + instanceId +". Num results "+executions);
+
+    return ModelAdaptor.adoptExecution( (OpenExecution)executions.get(0));
   }
 
-  public ProcessInstanceRef newInstance(long procDefId)
+  public ProcessInstanceRef newInstance(String definitionId)
   {
-    throw new RuntimeException("Not implemented");
+    ExecutionService execService = this.processEngine.getExecutionService();
+    Execution exec = execService.startExecutionById(definitionId);
+    return ModelAdaptor.adoptExecution((OpenExecution)exec);
   }
 
-  public void setProcessState(long procId, ProcessInstanceRef.STATE nextState)
+  public void setProcessState(String procId, ProcessInstanceRef.STATE nextState)
   {
     throw new RuntimeException("Not implemented");
   }

Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml	2009-02-12 13:19:13 UTC (rev 3849)
+++ jbpm4/trunk/pom.xml	2009-02-12 13:22:56 UTC (rev 3850)
@@ -218,7 +218,7 @@
         <groupId>org.livetribe</groupId>
         <artifactId>livetribe-jsr223</artifactId>
         <version>${jsr233.version}</version>
-      </dependency>      
+      </dependency>
       <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring</artifactId>
@@ -304,17 +304,6 @@
         </configuration>
       </plugin>
       <plugin>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <failIfNoTests>false</failIfNoTests>
@@ -327,17 +316,6 @@
           </systemProperties>
         </configuration>
       </plugin>
-      <plugin>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-javadocs</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
 
     </plugins>
 
@@ -400,6 +378,28 @@
               <skipTests>true</skipTests>
             </configuration>
           </plugin>
+          <plugin>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-javadocs</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <artifactId>maven-source-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-sources</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
         </plugins>
       </build>
     </profile>




More information about the jbpm-commits mailing list