Source

osworkflow / docs / 3.3 Common and Global Actions.html

Full commit
<html>
    <head>
        <title>3.3 Common and Global Actions</title>
	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
    </head>

    <body>
	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
		    <tr>
			    <td valign="top" class="pagebody">

				    <ul class="star">
<li> Back to <a href="3.2 Workflow Concepts.html">3.2 Workflow Concepts</a></li>
<li> Forward to <a href="3.4 Functions.html">3.4 Functions</a></li>
</ul><br/>
Two convenient features that can help reduce code duplication when defining workflow descriptors are common actions, and global actions.<p class="paragraph">The basic idea is simple. Both of these types of actions can be defined at the top of the workflow descriptor, after the initial-actions element.</p>Common actions are useful in cases where at various points of the workflow, a particular action needs to be available. For example, this could be a &#039;send email&#039; action. The action would likely have some pre-functions, perhaps a validator, perhaps even an inline script. All in all it might be 7-8 lines of xml. Since this action is needed in multiple places, the code would have to be duplicated wherever it&#039;s needed. <p class="paragraph">Defining it as a common action avoids this need for duplication. The action would be defined once as a common action. Then any steps that need to have that action available would simply reference it like this:</p><div class="code"><pre>&lt;common&#45;action id=&quot;100&quot; /&gt;</pre></div><p class="paragraph">Global actions are slightly different. They are defined the same way (in a global-actions element after initial-actions), but instead of having to be explicitly referenced by a particular step, they are always available to ALL steps. An example of a global action for example could be &#039;terminate workflow&#039;, where at any stage, it is possible to end the workflow (for example, by setting its state to KILLED), and perhaps log it and send an email (defined as functions in the global action).</p>In both cases, all global and common actions should have unique ID&#039;s that do not clash with any other action ID&#039;s in the workflow descriptor.

				    
			    </td>
		    </tr>
	    </table>
    </body>
</html>