1. opensymphony
  2. osworkflow


osworkflow / docs / Creating_a_new_workflow.html

<html><head><title>OSWorkflow Creating a new workflow</title></head><body>
<ul class="star">
<li>Up to <a href="Documentation.html">Documentation</a></li>
<li>Back to <a href="Interface_choices.html">Interface choices</a></li>
<li>Forward to <a href="Executing_actions.html">Executing actions</a></li>
</ul><p class="paragraph"></p>This is a very brief guide on how you can create a new workflow instance using the OSWorkflow Java APIs. First, the workflow definition file (in XML) must be created and defined using the <a href="Configuration.html">Configuration</a>. Then your code must know what the <b class="bold">initialStep</b> value should be for initializing an instance. Before you can initialize a workflow you must <b class="bold">create</b> it so that you have an ID that can be referenced from now on in the API. The following code example illustrates this:<p class="paragraph"></p>
<div class="wikicode"><pre>Workflow wf = <span class="java&#45;keyword">new</span> BasicWorkflow(username);
HashMap inputs = <span class="java&#45;keyword">new</span> HashMap();
inputs.put(<span class="java&#45;quote">"docTitle"</span>, request.getParameter(<span class="java&#45;quote">"title"</span>));
wf.initialize(<span class="java&#45;quote">"workflowName"</span>, 1, inputs);</pre></div><p class="paragraph"></p>Note that usually, you would use a more appropriate Workflow implementation rather than BasicWorkflow. For example, EJBWorkflow or OfbizWorkflow. If you want to use a Workflow store that does not have a custom workflow context implementation (for example, JDBC, or Hibernate), then use BasicWorkflow. Contributions of WorkflowContexts for various stores are more than welcome!</body></html>