[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>
-<yanel:property name="workflow-schema" value="/app/workflow/workflow-with-review.xml"/>
-</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 "draft" can be changed to state "review", and that from "review" it can either enter state "draft" (i.e. it is rejected by the reviewer) or "approved" (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><?xml version="1.0" encoding="UTF-8"?><br/> <workflow xmlns="http://www.wyona.org/yanel/workflow/1.0"><br/> <states><br/> <!-- some known set of states --><br/> </states><br/><br/> <transitions><br/> <!-- some known set of transitions --><br/> </transitions><br/> </workflow></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 "draft", "review", and "approved" states, and some transitions between some of these states. We would declare our states like this:<br/><br/> <tt><states><br/> <state id="draft" initial="true"/><br/> <state id="review"/><br/> <state id="approved"/><br/> </states></tt>
+<p>Note the 'initial="true"' next to the "draft" state. This indicates that new instances of the resources that are associated with this schema will initially be in the "draft" 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 "submit", a specification of the "from" and "to" 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><transition id="submit" from="draft" to="review"><br/> <condition class="org.wyona.yanel.impl.workflow.RoleCondition">write</condition><br/> <description xml:lang="en">Submit for Review</description><br/> </transition></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> <?xml version="1.0" encoding="UTF-8"?><br/> <workflow xmlns="http://www.wyona.org/yanel/workflow/1.0"><br/><br/> <states><br/> <state id="draft" initial="true"/><br/> <state id="review"/><br/> <state id="approved"/><br/> </states><br/><br/> <transitions><br/> <transition id="submit" from="draft" to="review"><br/> <condition class="org.wyona.yanel.impl.workflow.RoleCondition">write</condition><br/> <description xml:lang="en">Submit for Review</description><br/> </transition><br/><br/> <transition id="reject" from="review" to="draft"><br/> <condition class=&quo!
t;org.wyona.yanel.impl.workflow.RoleCondition">workflow.approve</condition><br/> <description xml:lang="en">Reject</description><br/> </transition><br/><br/> <transition id="approve-only" from="review" to="approved"><br/> <condition class="org.wyona.yanel.impl.workflow.RoleCondition">workflow.approve</condition><br/> <description xml:lang="en">Approve</description><br/> </transition><br/> </transitions><br/><br/> </workflow></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><yanel:property name="workflow-schema" value="/app/workflow/workflow-with-review.xml"/></tt><br/><br/>to the file RES-CONFIGS_REPO:/some-page.html.yanel-rc so that it looks something like this:<br/><br/><tt> <?xml version="1.0"?><br/> <yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0"><br/> <yanel:rti name="some-page" namespace="http://www.example.com/yanel/resource/1.0"/><br/><b><yanel:property name="workflow-schema" value="/app/workflow/workflow-with-review.xml"/></b><br/> <yanel:custom-config><br/> ...<br/> </yanel:custom-config><br/> </yanel:resource-config></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