Thomas, Thank you so much for your time. I am going to joint the
ezComponents mailing list now. However until I am actually on the list 
(it
takes a little bit to process my subscription I guess) Can you answer 
the
following questions. I can or you can repost this wherever you wish.

I understand the idea behind having a "workpool" if you will. Of which 
each
user in the system can have a subset of the work within the pool 
assigned to
them. Based on the assignment of the work and a given FSM or directed 
graph
you can create a workflow. I get this. (tell me if any of that is 
wrong!)

>From what you tell me below what I would do in my persistence layer is
create a storage place for the "workpool" and when users log into the 
system
retrieve the subset of the workflows that involve them from the pool and
display them in some way so that they can act on them. I get this (again
tell me if I am wrong!)

What I really don't know is this:

Given an advanced roles based access control system with crud screens 
for

A) Adding new articles

B) Reviewing / Editing articles

C) Listing Articles that have been added but not reviewed

D) Approving articles and publishing them

Now given the above I am assuming the scenario I gave in the original 
email
would go something like:

The Writer enters the system and clicks on the add new article link. 
This in
turn executes the new action inside the articles controller.

This new action in turn instantiates a new article model AND also a new
ezcWorkflow('articlePublishing'); or something similar.

The new() action also adds the freshly instantiated article object as a
workflow variable of a new input node called $input and tat input node 
is
added as an output node of the startNode of the new workflow object.


/*however the new action is syntaxed in ezframework*/
New($articleBody) {

/* instantiate new article object */

$article = new article($articleBody);
$workflow = new ezcWorkflow('articlePublishing');
$input1 = new ezcWorkflowNodeInput( array( 'article' => new
ezcWorkflowConditionIsObject ) );
$workflow->startNode->addOutputNode( $input );


Correct so far? After we add that initial output node to the start node 
(it
should pass automatically because the new() action should only fire when
someone actually posts content to it) we then need to wait for an 
editors
input for approval so we add anther input node.


$input2 = new ezcWorkflowNodeInput( array( 'approval' => new
ezcWorkflowConditionIsBool ) );

$input2->addInNode( $input );


Then I imagine that the $workflow object needs an exclusive choice as to
whether or not the article has been approved (which at this point is has 
not
been)


/* create action nodes */
$approvedNode = new ezcWorkflowNodeAction( 'printApproved' );
$notapprovedNode = new excWorkflowNodeAction( 'printNotApproved' );

$branch->addConditionalOutNode( new ezcWorkflowConditionVariable(
'approval', new ezcWorkflowConditionIsTrue ), $approvedNode );

$branch->addConditionalOutNode( new ezcWorkflowConditionVariable(
'approval', new ezcWorkflowConditionIsFalse ), $notApprovedNode );



Then we need to add an input node to the $approvedNode That waits for
boolean value as to weather or not the article has been published.


$input3 = new ezcWorkflowNodeInput( array( 'publish' => new
ezcWorkflowConditionIsBool ) );

$input3->addInNode( $approvedNode );


Then we need to add an exclusive choice for whether or not it was 
published.


/* create action nodes */
$publishedNode = new ezcWorkflowNodeAction( 'printPublished' );
$notPublishedNode = new excWorkflowNodeAction( 'printNotPublished' );

$branch->addConditionalOutNode( new 
ezcWorkflowConditionVariable( 'publish',
new ezcWorkflowConditionIsTrue ), $publishedNode );

$branch->addConditionalOutNode( new 
ezcWorkflowConditionVariable( 'publish',
new ezcWorkflowConditionIsFalse ), $notPublishedNode );


Then we need to merge everything with a simple merge


$merge = new ezcWorkflowNodeSimpleMerge;
$merge->addInNode( $publishedNode );
$merge->addInNode( $notPublishedNode );
$merge->addInNode( $notApprovedNode );
$merge->addOutNode( $workflow->endNode );

}


Assuming that all of the above is generally correct ( I imagine I may 
have
some syntax errors. My lack of experience with the ezComponents MVC
implementation may have thrown things off)

Do I put all of the above code in the new() action OR

Do I put the following in the new() action

/*however the new action is syntaxed in ezframework*/
New($articleBody) {

/* instantiate new article object */

$article = new article($articleBody);
$workflow = new ezcWorkflow('articlePublishing');
$input1 = new ezcWorkflowNodeInput( array( 'article' => new
ezcWorkflowConditionIsObject ) );
$workflow->startNode->addOutputNode( $input );

$input2 = new ezcWorkflowNodeInput( array( 'approval' => new
ezcWorkflowConditionIsBool ) );

$input2->addInNode( $input );


And then put the following in a "approve" action:

Approve($isApproved) {

/* create action nodes */
$approvedNode = new ezcWorkflowNodeAction( 'printApproved' );
$notapprovedNode = new excWorkflowNodeAction( 'printNotApproved' );

$branch->addConditionalOutNode( new ezcWorkflowConditionVariable(
'approval', new ezcWorkflowConditionIsTrue ), $approvedNode );

$branch->addConditionalOutNode( new ezcWorkflowConditionVariable(
'approval', new ezcWorkflowConditionIsFalse ), $notApprovedNode );


$input3 = new ezcWorkflowNodeInput( array( 'publish' => new
ezcWorkflowConditionIsBool ) );

$input3->addInNode( $approvedNode );
}


And then put the following in a "publish" action:

Publish($publishIt){
/* create action nodes */
$publishedNode = new ezcWorkflowNodeAction( 'printPublished' );
$notPublishedNode = new excWorkflowNodeAction( 'printNotPublished' );

$branch->addConditionalOutNode( new 
ezcWorkflowConditionVariable( 'publish',
new ezcWorkflowConditionIsTrue ), $publishedNode );

$branch->addConditionalOutNode( new 
ezcWorkflowConditionVariable( 'publish',
new ezcWorkflowConditionIsFalse ), $notPublishedNode );

$merge = new ezcWorkflowNodeSimpleMerge;
$merge->addInNode( $publishedNode );
$merge->addInNode( $notPublishedNode );
$merge->addInNode( $notApprovedNode );
$merge->addOutNode( $workflow->endNode );
}

OR do I have everything in the wrong place all together?? Basicly I just
need to know where to add the code that constructs the workflow.

Also once I have a workflow constructed how do I pause it? I know that 
it
can be paused on input nodes but what does that actual entail? Can you 
give
me code samples for how one would say save the new article to the 
database
then wait for an editor to review it and approve it?

Also where do I put the code that actually get's triggered by the
"$approvedNode", "$notApprovedNode", "$publishedNode", "$notPublishedNode"?
As you can imagine I want to fire off some code when something has been
approved, not approved etc.

Thanks so much for your time. I know this email was long and I do really
appreciate any help you can give me!

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

Reply via email to