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

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 2 15:44:42 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-07-02 15:44:41 -0400 (Thu, 02 Jul 2009)
New Revision: 5194

Removed:
   jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/Runner.java
Modified:
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
   jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/FormDispatcherComposite.java
   jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java
   jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java
Log:
Cleanup FormDispatcher API

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	2009-07-02 19:32:12 UTC (rev 5193)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java	2009-07-02 19:44:41 UTC (rev 5194)
@@ -254,6 +254,23 @@
   }
 
 
+  public ProcessInstanceRef newInstance(String definitionId, Map<String, Object> processVars)
+  {
+    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+    try
+    {
+      ExecutionService execService = this.processEngine.getExecutionService();
+      Execution exec = execService.startProcessInstanceById(definitionId);
+      execService.setVariables(exec.getId(), processVars);
+      
+      return ModelAdaptor.adoptExecution((ExecutionImpl)exec);
+    }
+    finally{
+      env.close();
+    }
+  }
+
   public void endInstance(String instanceId, ProcessInstanceRef.RESULT result)
   {
     Environment env = ((EnvironmentFactory)processEngine).openEnvironment();

Modified: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/FormDispatcherComposite.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/FormDispatcherComposite.java	2009-07-02 19:32:12 UTC (rev 5193)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/FormDispatcherComposite.java	2009-07-02 19:44:41 UTC (rev 5194)
@@ -69,19 +69,4 @@
         throw new IllegalArgumentException("Unknown authority type:"+ref.getType());
     }
   }
-
-  public void processCompletion(FormAuthorityRef ref, Map<String, Object> payload, String performingUser, String outcome)
-  {
-    switch(ref.getType())
-    {
-      case TASK:
-        taskDispatcher.processCompletion(ref, payload, performingUser, outcome);
-        break;
-      case PROCESS:
-        processDispatcher.processCompletion(ref, payload, performingUser, outcome);
-        break;
-      default:
-        throw new IllegalArgumentException("Unknown authority type:"+ref.getType());
-    }
-  }
 }

Modified: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java	2009-07-02 19:32:12 UTC (rev 5193)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/ProcessFormDispatcher.java	2009-07-02 19:44:41 UTC (rev 5194)
@@ -23,7 +23,6 @@
 
 import org.jboss.bpm.console.server.plugin.FormAuthorityRef;
 import org.jboss.bpm.console.server.plugin.FormDispatcherPlugin;
-import org.jbpm.api.ExecutionService;
 import org.jbpm.api.ProcessDefinition;
 import org.jbpm.api.RepositoryService;
 import org.jbpm.pvm.internal.env.Environment;
@@ -34,8 +33,8 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
-import java.util.Map;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Processes form data to start processes.
@@ -153,28 +152,4 @@
       env.close();
     }
   }
-
-  public void processCompletion(FormAuthorityRef ref, Map<String, Object> payload, String performingUser, String outcome)
-  {
-    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
-
-    try
-    {
-      ExecutionService execService = processEngine.getExecutionService();
-      if(payload!=null)
-      {
-        execService.startProcessInstanceById(
-            ref.getReferenceId(), payload
-        );
-      }
-      else
-      {
-        execService.startProcessInstanceById(ref.getReferenceId());
-      }      
-    }
-    finally
-    {
-      env.close();
-    }
-  }
 }

Deleted: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/Runner.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/Runner.java	2009-07-02 19:32:12 UTC (rev 5193)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/Runner.java	2009-07-02 19:44:41 UTC (rev 5194)
@@ -1,94 +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.jbpm.integration.console.forms;
-
-import freemarker.template.DefaultObjectWrapper;
-import freemarker.template.Template;
-
-import java.io.*;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class Runner
-{
-  static String template = "<html>\n" +
-      "<body>\n" +
-      "\n" +
-      "<h2>Please enter your name</h2>\n" +
-      "<formResourceName action=\"${formResourceName.action}\" method=\"POST\" enctype=\"multipart/formResourceName-data\">\n" +
-      "<input type=\"text\" name=\"name\" value=\"\"><br/>\n" +
-      "Outcomes:<br/>\n" +
-      "<ul>\n" +
-      "<#list outcome.values as transition>\n" +
-      "  <li>${transition}  \n" +
-      "</#list>\n" +
-      "</ul> \n" +
-      "<input type=\"submit\">\n" +
-      "</formResourceName>\n" +
-      "</body>\n" +
-      "</html>";
-
-  public static void main(String[] args)
-  {
-    Runner r = new Runner();
-
-    Map<String,Object> ctx = new HashMap<String,Object>();
-    FormDirective f = new FormDirective("http://localhost:8080/");
-    OutcomeDirective o = new OutcomeDirective();
-    o.getValues().add("transition1");
-    o.getValues().add("transition2");
-
-    ctx.put("formResourceName", f);
-    ctx.put("outcome", o);
-
-    r.execute(ctx, "testRun", new ByteArrayInputStream(template.getBytes()));
-  }
-
-  private void execute(Map<String, Object> renderContext, String name, InputStream src)
-  {
-    try
-    {
-      freemarker.template.Configuration cfg = new freemarker.template.Configuration();
-      cfg.setObjectWrapper(new DefaultObjectWrapper());
-      cfg.setTemplateUpdateDelay(0);
-
-      Template temp = new Template(name, new InputStreamReader(src), cfg);
-      temp.dump(System.out);
-      
-      final ByteArrayOutputStream bout = new ByteArrayOutputStream();
-      Writer out = new OutputStreamWriter(bout);
-      temp.process(renderContext, out);
-      out.flush();
-
-      System.out.println(new String(bout.toByteArray()));
-    }
-    catch (Exception e)
-    {
-      throw new RuntimeException(e);
-    }   
-  }
-
-
-}

Modified: jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java
===================================================================
--- jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java	2009-07-02 19:32:12 UTC (rev 5193)
+++ jbpm4/trunk/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/TaskFormDispatcher.java	2009-07-02 19:44:41 UTC (rev 5194)
@@ -167,33 +167,4 @@
     }
   }
 
-  public void processCompletion(
-      FormAuthorityRef ref,
-      Map<String,Object> payload,
-      String performingUser,
-      String outcome)
-  {
-    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
-
-    String taskId = ref.getReferenceId();
-
-    try
-    {
-      TaskService taskService = processEngine.getTaskService();
-
-      if(payload!=null)
-        taskService.setVariables(taskId, payload);
-
-      if(null==outcome)
-        taskService.completeTask(taskId);
-      else
-        taskService.completeTask(taskId, outcome);
-
-    }
-    finally
-    {
-      env.close();
-    }
-  }
-
 }




More information about the jbpm-commits mailing list