Hi all
I am struck  with Sub work flow .when I loaded  it into DB..in node
table I found some nodes with no connection.. I think I am wrong.

Here is my two  work flows
The main workflow

<workflow name="LeaveApplication" version="1">
 <node id="1" type="Start">
   <outNode id="2"/>
  </node>
 <node id="2" type="Input">
        <!-- that's where the personal can apply for a leave -->
        <variable name="XY">
            <condition type="IsString"/>
        </variable>
        <outNode id="3" />
    </node>
    <!-- check whether team lead  is available -->
    <node id="3" type="Input">
        <!-- team leader avail -->
        <variable name="teamLeaderAvail">
            <condition type="IsBool" />
        </variable>

        <outNode id="4" />
    </node>

    <node id="4" type="ExclusiveChoice">
        <condition type="Variable" name="teamLeaderAvail">
            <condition type="IsFalse"/>
            <outNode id="5"/>
        </condition>
        <condition type="Variable" name="teamLeaderAvail">
            <condition type="IsTrue"/>
            <outNode id="6"/>
        </condition>
    </node>
    <!-- starting sub work flow -->
    <node id="5" type="SubWorkflow" subWorkflowName="OnLeave">
        <outNode id="7"/>
    </node>

    <node id="6" type="Input">
        <!-- team leader approve -->
        <variable name="teamLeaderApprove">
            <condition type="IsBool" />
        </variable>

        <outNode id="7" />
    </node>

    <node id="7" type="ExclusiveChoice">
        <condition type="Variable" name="teamLeaderApprove">
            <condition type="IsFalse"/>
            <outNode id="8"/>
        </condition>
        <condition type="Variable" name="teamLeaderApprove">
            <condition type="IsTrue"/>
            <outNode id="9"/>
        </condition>
    </node>

    <!-- as it wasn't approved finish workflow here -->
    <node id="8" type="End" />

    <node id="9" type="Input">
    <!-- project manager approve -->
        <variable name="projectManagerApprove">
            <condition type="IsBool" />
        </variable>

        <outNode id="10" />
    </node>

    <node id="10" type="ExclusiveChoice">
        <condition type="Variable" name="projectManagerApprove">
             <condition type="IsFalse"/>
             <outNode id="11"/>
         </condition>
        <condition type="Variable" name="projectManagerApprove">
              <condition type="IsTrue"/>
              <outNode id="12"/>
         </condition>
    </node>

   <node id="11" type="End" />

   <node id="12" type="End" />
</workflow>

-----------
Here is the Sub work flow

<workflow name="OnLeave" version="1">
  <node id="1" type="Start">
    <outNode id="2"/>
  </node>
  <node id="2" type="Input">
    <!-- team leader approve -->
    <variable name="SubTeamLeaderApprove">
      <condition type="IsBool" />
    </variable>
    <outNode id="3" />
  </node>

I have a doubt here do I have to make an ExclusiveChoice  here. I am
not sure here so I comment the ExclusiveChoice

  <!--<node id="3" type="ExclusiveChoice">
    <condition type="Variable" name="SubTeamLeaderApprove">
      <condition type="IsFalse"/>
      <outNode id="5"/>
    </condition>
    <condition type="Variable" name="SubTeamLeaderApprove">
      <condition type="IsTrue"/>
      <outNode id="6"/>
    </condition>
  </node> -->
  <!-- as it wasn't approved finish workflow here -->
   <node id="3" type="End" />
</workflow>

My requirement is I want to check whether the team lead is available
or not for a leave approval. If he is on leave the leave approval
process should be done by some co-team leads. So here I need a sub
work flow rit?. If the co-team lead approve it should go to PM..
This is my logic..


Do I have to save the two workflows individually? Or when I save main
workflow will the subworkflow save automatically from the xml file.
In one lone of code like.
$workflow = $definition->loadByName( 'LeaveApplication' );
$definition->save( $workflow );

------------
Here is the code I used to insert to DB

$definition = new ezcWorkflowDefinitionStorageXml( '../../Workflow/docs/' );
$workflow = $definition->loadByName( 'LeaveApplication' );
workflow1 = $definition->loadByName( 'OnLeave' );//sub work flow

$db = ezcDbFactory::create( 'mysql://test:[EMAIL PROTECTED]/test' );

Set up workflow definition storage (database).
$definition = new ezcWorkflowDatabaseDefinitionStorage( $db );

// Save workflow definition to database.
   $definition->save( $workflow );
   $definition->save( $workflow1 );//sub work flow

Did I made any mistake in the code while storing to DB…

------------
How to fetch that two from work flow table

Should I need to do like this
$workflow = $definition->loadByName( 'LeaveApplication' );
$subworkflow = $definition->loadByName( 'OnLeave' );


 $execution = new ezcWorkflowDatabaseExecution( $db );
   // Pass workflow object to workflow executer.
$execution->workflow = $workflow;
$subexecution->workflow = $subworkflow;

How can I fetch the two work flow details? Is there be any relation in
the node table between the main work flow and sub work flow? .

Will the main work flow will suspend on reaching subnode.at  that time
should wand to load the work flow again. to resume the main work flow
again.

OR Did I made any mistake here

What is the different between

$execution->setVariable( 'XY','Apply');

And

$execution->resume(array( 'XY' => 'ghk' ) );

I think my mail is too long. Hope u can understand my queries

Do feel free to tell if I am wrong some where..


Thanks

surej
-- 
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components

Reply via email to