Thomas, After sending that last email I just realized a few things.
First of all lets say that I have the workflow described in that last
email
programmatically all defined within an xml file or saved in the database
tiein.
Let's also say I removed the first input node. Since it wasn't really
needed
there is no reason to have it there. If we are creating a new article we
can
assume the content has already been created for it.
Now the first node after the start Node should be the input node that
waits
for an editors approval (former $input2 node from my last email)
So let's begin again...
I create a new article object and hydrate it with the users input. Then
I
would simply load a new copy of that workflow a storage object.
New($articleBody) {
/* instantiate new article object */
$article = new article($articleBody);
/* load workflow from database and instantiate workflow variable */
$db = ezcDBFactory::create( 'mysql://[EMAIL PROTECTED]/test' );
$definition = new ezcWorkflowDatabaseDefinitionStorage( $db );
$workflow = $definition->loadByName( ' articlePublishing' );
/* Then I would start the workflow */
$execution = new ezcWorkflowDatabaseExecution( $db );
$execution->workflow - $workflow;
$id = $execution->start();
$article->workflowId = $id;
$article->state = "waiting for approval";
}
Then I would end the new() article action. So the execution would
presumably
start then hit the first input node and then wait. I would need to store
this input $id and a description of this workflow somewhere so that the
editor could review it correct? Lets just say I store it in the new
article
object.
So the editor logs in. I querry my workpool table and find all the $ids
for
workflows that are now waiting for approval.
I pick up that article attached to that $id and show the view for the
approval screen.
The editor pushes the approve button.
The controller for the article object then fires it's approved action
The approved action resumes the workflow with the "approval variable set
to
true (reference the last email for the approval conditional nodes and
variables)
Approved($article) {
$article->approved = true;
$db = ezcDBFactory::create( 'mysql://[EMAIL PROTECTED]/test' );
$execution = new ezcWorkflowDatabaseExecution( $db,
$article->workflowId );
$execution->resume( array('approval' => true ) );
$article->state = "approved waiting for publish";
}
Then the workflow executes the $approvedNode branch and (any service
objects
attached to it correct?) and comes to a stop when it reaches the input
node
for publishing (former $input3 in last email)
So now I close the approved action.
Then the editor decides to publish this article so he goes into the view
for
the publish screen and clicks the publish button for this article.
The published action on the article fires
Published($article) {
$article->published = true;
$db = ezcDBFactory::create( 'mysql://[EMAIL PROTECTED]/test' );
$execution = new ezcWorkflowDatabaseExecution( $db,
$article->workflowId );
$execution->resume( array('published' => true ) );
$article->state = "published";
}
The workflow execution continues. The $publishedNode branch executes
(any
service objects attached to the $publishNode fire) and then the workflow
moves on to the $merge (see last email) and then goes on to the end node
thus finishing the workflow (correct?) does the workflow finish even
though
only one of the paths had been executed preceding the merge? Does it
wait
for anything else before the merge fires it's outNode?
Thanks again for all your help,
Jesse
On 9/26/07 9:18 AM, "Thomas Nunninger" <[EMAIL PROTECTED]> wrote:
> One general note (as this is not the first request regarding workflows
> to my personal email):
>
> Regarding questions about the workflow components (or others), allways
> write to the eZ Components list. That way you ensure that other people
> can profit or answer as well. I will allways post to the list as well
> when answering such mails (unless you convince me, why it's better to
> keep it private).
>
>
> Hi Jesse,
>
>> Hi Thomas, I am sorry to bother you today but I am really interested
>> in using the ezWorkflow component in a project I am working on but I
>> am having trouble grasping how to incorporate it into the MVC
>> architecture. Let's say for instance I have created CRUD screens for
>> content entry. Lets also say that I have some semblance of a user
>> acl. Now one workflow I have modeled involves a writer creating a
>> story and then submitting it to an editor for review before the
>> editor publishes the story. I know we can model this with a petri-net
>> or a directed graph very easily. I also assume this can be created
>> within the ezWorkflow component. My question is how do I get this to
>> actually influence the Controllers and Views of the model as it gets
>> written then approved then published.
>
> In general you allways need to take care about the execution ids and
> which user it belongs to. It could be stored in the session or
database
> or provided via a parameter within the request.
>
> Sometimes it could be stored within the relevant data of the covered
> objects. But if you have a more complex situation, I suggest to use a
> separate table. Such a table could basically contain a column for user
> (group), execution id and perhaps some additional information if
needed
> (e.g. action).
>
> When a user sends an article for publishing, you insert an entry in
the
> table for the next user (group), the execution id and perhaps the
> additional information. (What the next user group is, could be defined
> in a special execution variable and read generally from the workflow
> execution object.).
>
> When the editor looks into his account, you could query the table and
> present him a list with all pending workflows that needs his
> interaction. He could select one execution and provide the needed
input
> data to trigger the workflow to the next step. (If the workflow is not
> finished, you could create a new entry in the table.)
>
> It could be pretty handy if you create your own application-specific
> WorkflowUtils class providing easy handling of starting/triggering
> workflows or fetching a list of all workflows that need input from a
> special user. Then you can reuse this functionality in several places
> of your application.
>
> Hope this answered your question. If not: just ask...
>
> Have a nice day
>
> Thomas
>
>
>
>> Thanks in advance. Your help is greatly appreciated!
>>
>> Jesse Sanford
>
>
--
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components