On Thu, Mar 11, 2010 at 3:54 AM, Christian <[email protected]> wrote:
>
>> Well, could you please rephrase your question ?
>
> As Torsten wrote, one should use the storage participant (SP), if
> human interaction is present. Thus, I want to use 3 SPs in sequence.
> Since the SP cannot have any logic in it, I have to put it into e.g. a
> controller where I pull the workitem from the SP and after processing
> it, pass it back to the SP. Is this the right way to deal with the
> SP?

Hello Christian,

yes, it's fine.

Here is something straight out of a ruote[-kit] + rails app I have :

---8<---
  def update # a workitem

    workitem = get_workitem

    fields = Rufus::Json.decode(params[:workitem]['fields'])
    workitem.fields.merge!(fields)

    if params[:commit] == 'save'
      #
      # save

      RuoteKit.storage_participant.update(workitem)

      redirect_to :action => :show

    else # if params[:commit] == 'forward'
      #
      # forward (workitem resume in flow)

      RuoteKit.storage_participant.reply(workitem)

      redirect_to :action => :index
    end
  end

  protected

  def get_workitem

    fei = params[:id]

    fei = Ruote::FlowExpressionId.from_id(fei.split('!')[-3..-1].join('!'))
      # ruote 2.1.8 will fix that, making that line unnecessary

    RuoteKit.storage_participant[fei]
  end
--->8---

Workitem is retrieved in storage participant. New field values are
merged in, the if the "action" is 'forward', then the #reply method of
the participant is called, else simply the #update method (which will
save the workitem with its new fields).


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

Reply via email to