Daniel N wrote:

> 
> In the prepare_witness_report_reception (and the
> WitnessReportController#update) you're saying that there is only one
> wfid,
> and in the simple case we've got above I can wrap my head around that
> part.
>  What about in the case where there are concurrent branches of the
> workflow?
> For example:
> 
> pdef = Ruote.process_definition 'incidents' do
>  concurrence do
>    # Branch 1
>    sequence do
>      # before that ...
>      clerk :task => 'record witnesses'
>      prepare_witness_report_reception
>      receive_witness_reports
>      # and then ...
>    end
> 
>     # Branch 2
>    sequence do
>      # before that ...
>      clerk :task => 'record people involved'
>      prepare_involvement_report_reception
>      receive_involvement_reports
>      # and then ...
>    end
>  end
> end
> 
> In this case, we could be in either branch, with a similar setup in
> each
> branch. I can see how this can work when we're creating db records in
> the
> prepare_*_report_reception participant, since we're saving the wfid
> right
> there.  Lets suppose that the object operated on in the db is used by
> many
> things, is there a way to find the relevant wfid by querying the
> storage
> participant?  Are there any other cases where there would be multiple
> wfid's?

There's always only one wfid: It's the id of the process instance which
you launched with RuoteKit.engine.launch … (wfid = work flow id). Yes,
there may be more than one workitem in the storage participant when
running your process definition. You may distinguish them by the
participant name or fields, though not nested ones.

You could do:
    RuoteKit.storage_participant.query(
      :wfid        => report.wfid,
      :participant => 'receive_involvement_reports'
    )

Please note that you also could use an own participant expression for
each witness if you like to blow up your process definition:

    pdef = Ruote.process_definition 'incidents' do
      concurrence do
        # Branch 1
        sequence do
          # before that ...
          clerk :task => 'record witnesses'
          concurrent_iterator :on => '${f:witnesses_list}',
            :to_field => 'witness' do
            send_mail_to_witness
            receive_witness_report
          end
          # and then ...
        end

        # Branch 2
        sequence do
          # before that ...
          clerk :task => 'record people involved'
          concurrent_iterator :on => '${:involved_people_list}',
            :to_field => 'involved_person' do
            send_mail_to_involved_person
            receive_involved_person_report
          end
          # and then ...
        end
      end
    end

(See
http://ruote.rubyforge.org/patterns.html#mu_multiple_instances_with_a_priori_run_time_knowledge
 for docs)

Your query on the storage participant could look like that then:
    RuoteKit.storage_participant.query :wfid => report.wfid,
      :participant => 'receive_witness_report',
      :witness => witness.id

Note: When using that pdef, you may have even more than two workitems in
the storage participant for one wfid, you'd have one for each witness
and involved person. Either filter using the query method, or fetch all
the items for the wfid and filter yourself, like John suggested.

I hope that doesn't confuse you more. Further questions are welcome!

Cheers,
Torsten

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to