[Yanel-commits] rev 41064 - public/yanel/trunk/src/realms/yanel-website/content

michi at wyona.com michi at wyona.com
Tue Jan 20 14:20:25 CET 2009


Author: michi
Date: 2009-01-20 14:20:24 +0100 (Tue, 20 Jan 2009)
New Revision: 41064

Modified:
   public/yanel/trunk/src/realms/yanel-website/content/f4fb5067-e96e-4c4f-9e18-9ea15f8e57d5
Log:
documentation re workfow enhanced thanks to Gary

Modified: public/yanel/trunk/src/realms/yanel-website/content/f4fb5067-e96e-4c4f-9e18-9ea15f8e57d5
===================================================================
--- public/yanel/trunk/src/realms/yanel-website/content/f4fb5067-e96e-4c4f-9e18-9ea15f8e57d5	2009-01-20 11:26:16 UTC (rev 41063)
+++ public/yanel/trunk/src/realms/yanel-website/content/f4fb5067-e96e-4c4f-9e18-9ea15f8e57d5	2009-01-20 13:20:24 UTC (rev 41064)
@@ -4,11 +4,26 @@
   <title>Workflow</title>
   <link rel="neutron-introspection" type="application/neutron+xml" href="?yanel.resource.usecase=introspection"/>
 </head>
-<body>  <h1>Workflow<br/></h1>  <p>The XMLResource src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java for example has the WorkflowableV1 interface implemented. Also check the YanelServlet for how the workflow interface is used.</p><p>WorkflowableV1 interfaces requires that a resource has also the VersionableV2 interface implemented. (NOTE re Yarep: In order to create revisions one must implement Node.checkout() and Node.checkin() when modifying the content of nodes!)<br/></p><p>A workflow schema can be associated with a resource by adding a reference within the corresponding resource configuration, for example:</p><p>
-<code>
-&lt;yanel:property name=&quot;workflow-schema&quot; value=&quot;/app/workflow/workflow-with-review.xml&quot;/&gt;
-</code>
-</p>
-<p>
-whereas if no source scheme is specified, then the workflow schema is located within the default data repository of the corresponding realm.</p><p>In order to execute workflow transitions one might has to change the acess control policies according to the usecase/role conditions specified within the workflow schema.<br/></p><p></p></body>
-</html>
\ No newline at end of file
+<body>
+  <h1>Workflow<br/></h1>
+  <h2>Implementing Workflow in Resources</h2><p>Workflows can be implemented for all resources that implement the <a href="../../../javadoc/org/wyona/yanel/core/api/attributes/WorkflowableV1.html">WorkflowableV1</a> interface, although in practice it is more common to have the implementation delegate to WorkflowHelper (see org.wyona.yanel.impl.resources.XMLResource for example).</p><p>WorkflowableV1 interfaces require that a resource has also the VersionableV2 interface implemented. (NOTE re Yarep: In order to<br/>create revisions one must implement Node.checkout() and Node.checkin() when modifying the content of nodes!)</p>
+<h2>Workflow Schemas</h2><p>Worflow schemas define what actions, or transitions, may be made from instances of a resource in a given state, and to what state those transitions move. For example, one can define that a resource in state &quot;draft&quot; can be changed to state &quot;review&quot;, and that from &quot;review&quot; it can either enter state &quot;draft&quot; (i.e. it is rejected by the reviewer) or &quot;approved&quot; (i.e. it is accepted by the reviewer).</p>
+<p>There are, essentially, two steps involved in this. First, a schema may be <a href="#create_schema">created</a>, and secondly a resource may be <a href="#associate_schema">associated</a> with that schema. Neither step is compulsory, because if no specific schema is associated with a resource then the schema located within the default data repository of the corresponding realm will be used. That is, if a resource is workflowable by virtue of it implementing a Workflowable interface then there will always be a workflow associated with resources of that type.</p>
+<h3><a name="create_schema"/>Creating a Workflow Schema</h3>
+<p>As already mentioned, a workflow consists of a set of known states, and a set of transitions between those states.</p>
+<p>A typical schema file looks something like this:<br/><br/>
+  <tt>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br/>  &lt;workflow xmlns=&quot;http://www.wyona.org/yanel/workflow/1.0&quot;&gt;<br/>    &lt;states&gt;<br/>      &lt;!-- some known set of states --&gt;<br/>    &lt;/states&gt;<br/><br/>    &lt;transitions&gt;<br/>      &lt;!-- some known set of transitions --&gt;<br/>    &lt;/transitions&gt;<br/>  &lt;/workflow&gt;</tt><br/>
+<br/>and is placed in some directory below the realm's data-repo/data directory.</p>
+<h4>States</h4>Let us assume that we wish to set up a schema like that describe in the first paragraph of this section, with &quot;draft&quot;, &quot;review&quot;, and &quot;approved&quot; states, and some transitions between some of these states. We would declare our states like this:<br/><br/>    <tt>&lt;states&gt;<br/>      &lt;state id=&quot;draft&quot; initial=&quot;true&quot;/&gt;<br/>      &lt;state id=&quot;review&quot;/&gt;<br/>      &lt;state id=&quot;approved&quot;/&gt;<br/>    &lt;/states&gt;</tt>
+<p>Note the 'initial=&quot;true&quot;' next to the &quot;draft&quot; state. This indicates that new instances of the resources that are associated with this schema will initially be in the &quot;draft&quot; state.</p><h4>Transitions</h4><p>A transition entry is required for each transition that should be possible from one state to another.  A transition consists of an id, for example &quot;submit&quot;, a specification of the &quot;from&quot; and &quot;to&quot; states, possibly one or more extra conditions which must be satisfied in order for the transition to be succesful, and one or more textual descriptions of the transition. For example:<br/><br/>
+      <tt>&lt;transition id=&quot;submit&quot; from=&quot;draft&quot; to=&quot;review&quot;&gt;<br/>        &lt;condition class=&quot;org.wyona.yanel.impl.workflow.RoleCondition&quot;&gt;write&lt;/condition&gt;<br/>        &lt;description xml:lang=&quot;en&quot;&gt;Submit for Review&lt;/description&gt;<br/>      &lt;/transition&gt;</tt></p>
+<h4>Complete example</h4>
+<p>The following specifies the states and transitions described in the first paragraph of this section:<br/><br/><tt>  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br/>  &lt;workflow xmlns=&quot;http://www.wyona.org/yanel/workflow/1.0&quot;&gt;<br/><br/>    &lt;states&gt;<br/>      &lt;state id=&quot;draft&quot; initial=&quot;true&quot;/&gt;<br/>      &lt;state id=&quot;review&quot;/&gt;<br/>      &lt;state id=&quot;approved&quot;/&gt;<br/>    &lt;/states&gt;<br/><br/>    &lt;transitions&gt;<br/>      &lt;transition id=&quot;submit&quot; from=&quot;draft&quot; to=&quot;review&quot;&gt;<br/>        &lt;condition class=&quot;org.wyona.yanel.impl.workflow.RoleCondition&quot;&gt;write&lt;/condition&gt;<br/>        &lt;description xml:lang=&quot;en&quot;&gt;Submit for Review&lt;/description&gt;<br/>      &lt;/transition&gt;<br/><br/>      &lt;transition id=&quot;reject&quot; from=&quot;review&quot; to=&quot;draft&quot;&gt;<br/>        &lt;condition class=&quo!
 t;org.wyona.yanel.impl.workflow.RoleCondition&quot;&gt;workflow.approve&lt;/condition&gt;<br/>        &lt;description xml:lang=&quot;en&quot;&gt;Reject&lt;/description&gt;<br/>      &lt;/transition&gt;<br/><br/>      &lt;transition id=&quot;approve-only&quot; from=&quot;review&quot; to=&quot;approved&quot;&gt;<br/>        &lt;condition class=&quot;org.wyona.yanel.impl.workflow.RoleCondition&quot;&gt;workflow.approve&lt;/condition&gt;<br/>        &lt;description xml:lang=&quot;en&quot;&gt;Approve&lt;/description&gt;<br/>      &lt;/transition&gt;<br/>    &lt;/transitions&gt;<br/><br/>  &lt;/workflow&gt;</tt></p>
+<h4>Note on conditions:</h4>
+<p>Conditions are references to Java classes which implement the org.wyona.yanel.core.workflow.Condition.interface.</p>
+<p>RoleConditions mean that for the user to perform the transition, he or she must be allowed by <a href="../security/access-policies.html">access policies</a> to perform that operation.</p>
+<h3><a name="associate_schema"/>Associate the Resource with the Schema</h3>
+<p>A workflow schema is associated with a resource by adding such a reference to the resource configuration file.</p>
+<p>For example, adding<br/><br/><tt>&lt;yanel:property name=&quot;workflow-schema&quot; value=&quot;/app/workflow/workflow-with-review.xml&quot;/&gt;</tt><br/><br/>to the file RES-CONFIGS_REPO:/some-page.html.yanel-rc so that it looks something like this:<br/><br/><tt>  &lt;?xml version=&quot;1.0&quot;?&gt;<br/>  &lt;yanel:resource-config xmlns:yanel=&quot;http://www.wyona.org/yanel/rti/1.0&quot;&gt;<br/>    &lt;yanel:rti name=&quot;some-page&quot; namespace=&quot;http://www.example.com/yanel/resource/1.0&quot;/&gt;<br/><b>&lt;yanel:property name=&quot;workflow-schema&quot; value=&quot;/app/workflow/workflow-with-review.xml&quot;/&gt;</b><br/>    &lt;yanel:custom-config&gt;<br/>      ...<br/>    &lt;/yanel:custom-config&gt;<br/>  &lt;/yanel:resource-config&gt;</tt><br/><br/>would mean that the system will lookup the schema in DATA_REPO:/app/workflow/workflow-with-review.xml when it is needed.<br/></p>
+</body>
+</html>



More information about the Yanel-commits mailing list