Hi John,

Thanks for your quick reply.
This answers our query well.

A couple of concerns however are -

* Is it like a macro expansion? If yes, in future, will it affect hot
deployment or online changes in the process definitions?

* Do you already know any side-effect of using '_eval' or any
recommended way of using it elsewhere? From website, I could know only
about Ruby embedded in XML.


Thanks again.

With regards,

./harshal


On Apr 10, 4:38 am, John Mettraux <[email protected]> wrote:

> On Fri, Apr 10, 2009 at 12:43 AM, harshal <[email protected]> wrote:
>
> > I went through earlier thread as well.
> > Is it possible to refer a subprocess with just 'internal' Ruby
> > definition instead of a URL (either local storage or remote) ?
>
> > An intuitive analogous example to cite would be 'rake' tasks. In
> > 'rake' DSL, the task dependencies are mapped such that they are
> > resolved 'internally'. An example of such process reference is at the
> > end of the post.
>
> Hi Harshal,
>
> thanks for reformulating the question, I understand better now.
>
> Here is a way to do it :
>
> p1 = OpenWFE.process_definition :name => 'p1' do
>   sequence do
>     participant 'a'
>     participant 'b'
>   end
> end
>
> p2 = OpenWFE.process_definition :name => 'p2' do
>   sequence do
>     _eval :def => p1
>     participant 'c'
>   end
> end
>
> You have to set the :dynamic_eval_allowed option of the engine to true
> for this to work :
>
>   engine.application_context[:dynamic_eval_allowed] = true
>
> Since this technique is using "_eval" (not ruby's own eval), it
> happens at runtime (ie the substitution occurs when the process flow
> reaches the _eval).
>
> If you would like the insertion to occur at definition time, you could
> work directly with the internal representation of process definition
> and do something like :
>
> p1 = [ 'process-definition', { 'name' => 'p1' }, [
>   [ 'sequence', {}, [
>     [ 'participant', {}, [ 'a' ] ],
>     [ 'participant', {}, [ 'b' ] ]
>   ]
> ] ]
>
> p2 = [ 'process-definition', { 'name' => 'p2' }, [
>   [ 'sequence', {}, [
>     p1,
>     [ 'participant', {}, [ 'c' ] ]
>   ]
> ] ]
>
> It's straightforward, but a bit tedious. No need to unlock 'dynamic
> evaluation' in the engine. I could probably add an "insert"
> pseudo-expression that does this work inside of ruby process
> definitions. Though I prefer to push people towards the classical
> "subprocess :ref => 'x'" technique. Let me know what you think, it's
> an interesting idea anyway.
>
> Note that these techniques are not "fancy GUI BPMN editor"-friendly,
> they bind process definitions to the Ruby context.
>
> Best regards, thanks again for the reformulation,
>
> --
> 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