OSWorkflow tutorial
workflow 定義ファイルは次のような構造を持つ
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow PUBLIC
"-//OpenSymphony Group//DTD OSWorkflow 2.8//EN"
"http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
<workflow>
<initial-actions>
...
</initial-actions>
<steps>
...
</steps>
</workflow>
step とは workflow のある位置を意味し、処理が進むにつれて変化する
かも知れないし、しないかも知れない。
Tutorial の例ではドキュメント管理においては初稿、編集、出版などが
考えられる。
action は step 間の移動を含む状態遷移を起こす(起こさないこともある)
初稿開始、初稿完了など。
簡単に言えば step は「どこにいるか」で action は「どこにいけるか」
initial action は state も step もない状態から workflow を開始する
特殊なアクション
1 つのアクションからなる initial action の例:
<action id="1" name="Start Workflow">
<results>
<unconditional-result old-status="Finished" status="Queued" step="1"/>
</results>
</action>
step の例:
<step id="1" name="First Draft">
<actions>
<action id="1" name="Start First Draft">
<results>
<unconditional-result old-status="Finished" status="Underway" step="1"/>
</results>
</action>
<action id="2" name="Finish First Draft">
<results>
<unconditional-result old-status="Finished" status="Queued" step="2"/>
</results>
</action>
</actions>
</step>
<step id="2" name="finished" />
実際には step 2 から開始できたり、step 1 を複数実行できたりと、この定義は
まだまだ甘い。
次のように特定のアクションに入るための status の条件をつけることができる。
<action id="1" name="Start First Draft">
<restrict-to>
<conditions>
<condition type="class">
<arg name="class.name">
com.opensymphony.workflow.util.StatusCondition
</arg>
<arg name="status">Queued</arg>
</condition>
</conditions>
</restrict-to>
<results>
<unconditional-result old-status="Finished" status="Underway" step="1"/>
</results>
</action>
Function は workflow 遷移の過程で実行できる処理で workflow には影響をあたえない。
Function は current context に変数を加えられる。
<action id="1" name="Start First Draft">
<pre-functions>
<function type="class">
<arg name="class.name">com.opensymphony.workflow.util.Caller</arg>
この関数呼び出しで caller に caller 名がセットされる
</function>
</pre-functions>
<results>
<unconditional-result old-status="Finished" status="Underway"
step="1" owner="${caller}"/>
</results>
</action>
最終更新:2006年04月07日 18:13