On Wed, Nov 03, 2010 at 06:16:25AM +1100, 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?
>
> 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?
Hello Daniel,
I guess I'd do something like
---8<---
# app/controller/witness_report.rb
class WitnessReportController
def update
report = Report.find(params[:id])
# update report ...
if report.all_the_reports_for_that_case_have_been_received
# unleash the flow
workitem = RuoteKit.engine.storage_participant.by_participant(
'receive_witness_reports'
).find { |wi|
wi.wfid == report.wfid
}
# grab our waiting workitem
workitem.fields['report_count'] = report.all_the_reports_count
# some additional info before proceeding
RuoteKit.engine.storage_participant.proceed(workitem)
# the flow will resume after 'receive_witness_reports'
end
end
end
--->8---
or
---8<---
workitem = RuoteKit.engine.storage_participant.by_wfid(
report.wfid
).find { |wi|
wi.participant_name == 'receive_witness_reports'
}
--->8---
depending on the expected load. This second variant is probably better, less
iterating.
(of course, I guess you'd put it all this jazz in the Report class).
I hope it helps, best regards,
--
John Mettraux - http://jmettraux.wordpress.com
--
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