On Sat, Jul 11, 2009 at 3:41 AM, Patrick<[email protected]> wrote:
>
> I'm trying to reduce code duplication in our process definitions, and
> in doing so have run into a few problems.  I'd like to be able to
> create a process that, at any time, can be rewound back to any given
> participant.
>
> If I don't have any subprocess participants, handling the rewinding is
> trivial, and just requires placing a cursor around all the
> participants.  However, if I have a subprocess, I seem to either have
> to let the subprocess finish before rewinding, or add a cursor to the
> subprocess as well, which allows me to end it immediately, but then I
> can't get the __cursor_command__ attribute up to the main process's
> cursor because it is consumed in the subprocess.
>
> Is there a way to do this that I'm missing, or do subprocesses and
> cursor commands not play well enough together for this to be possible?

Hello again Patrick,

Maybe something like :

---8<---
OpenWFE.process_definition :name => 'test' do
  cursor do
    alpha
    sub0
    rewind :if => '${f:top_rewind}'
  end
  process_definition :name => 'sub0' do
    cursor do
      bravo
      charly
        # those two participants may rewind locally
        # or a the top by setting the field top_rewind to true
    end
  end
end
--->8---

where the "top rewind" is made explicit via a "top_rewind" field.

I don't know if that suits the logic you want to implement/model,
there's probably a better way.


> I hoped to work around subprocesses utilizing the Ruby process
> definition and mixins to construct a single process definition with no
> subprocesses, but since require is disallowed in process definitions,
> that was a no-go.

There is another way : you could point to a process definition
generated on the fly, here is a sinatra-like example :

---8<---
# call with GET /process_definition/special?participants=alpha,bravo,charly
#
get '/process_definition/special' do

  %{
    OpenWFE.process_definition :name => 'special' do
      cursor do
        #{params['participants'].split(',').join(';')}
      end
    end
  }
end
--->8---

Process definitions generated on the fly vs as static documents, there
are a bunch of different techniques. Questions are welcome.

Maybe that's a bit evil and you lose the benefit of a clear process definition.


Hope this 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to