Hi John, hi All,
my discussion final objective is to understand if is it possible to enable
the passing
of arbitrary object to participants as parameters. Now, i demonstrate it in
the following
example, this doesn't happen, but i suggest a mechanism that enables it. The
problem
is that a similar change impacts significantly on the behavior of the engine
and so
it's not clear to me whether if it is reasonable to introduce it or not
Consider a class:
>> class TomasosClass
>> # this class shape doesn't really matter...
>> end,
suppose you have a simple sequence
>> <sequence>
>> <participant ref="P1" />
>> <participant ref="P2" entering_parameter="${f:xyz}" />
>> </sequence>,
suppose participant P1 is a block one and the engine registration block is
the following
>> { |workitem|
>> workitem.attributes["xyz"] = TomsClass.new
>> }
Problem1:
if P2 is also a block participant whose block def is
>> { |workitem|
>> p workitem.attributes["xyz"]
>> p workitem.attributes["params"]["entering_parameter"] )
>> }
now... from the formal point of view, we should get the same value but
this is not because the dollar notation to_strings
everything... the crucial point seems to me this one:
from openwfe/util/dollar.rb
> def OpenWFE.dsub (text, dict)
>
> [......CUT.....]
>
> dsub("#{pre}#{value}#{text[j+1..-1]}", dict)
> end
"value" can also contain arbitrary objects if few rows before we substitute
> value = if value
> #value.to_s
> value
> # the not stringhed version is an experiment!!
> else
but when is put into "#{pre}#{value}#{text[j+1..-1]}", it necessarily is
transformed
into string, and this prevents to procced with value as Object.
but changing thinks in this way
> if pre.eql?("") && text[j+1..-1].eql?("") #
the idea is that the expression to be dollar sustitued is
"${f:___full_attributes_hash_path_to_object___}"
> return value
> end
> dsub("#{pre}#{value}#{text[j+1..-1]}", dict)
and now it seems to work fine
Problem2
changing the participant expression:
>> <participant ref="P2" entering_parameter="somethingbefore${f:xyz}"
/>
still works, but entering param is again a string(and this is correct)
My proposal is to reserve a special notation to the object passing simply to
avoid confusion
${fo:___full_attributes_hash_path_to_object___}, adding the clause that if
the dollar substitution
target string contains a similar special dollar notation, that notation must
cover all the string:
>> <participant ref="P2"
entering_parameter="something_not_null_before${fo:xyz}or_after"
/> WRONG
>> <participant ref="P2" entering_parameter="${fo:xyz}"
/> CORRECT
this clause is only to avoid ambiguilty and to make simpler the
substitution: once we find "fo" dollar notation
we have only to lookup tha attribute and return it unchanged.
What do you think?
Thanks
Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenWFEru dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/openwferu-dev?hl=en
-~----------~----~----~----~------~----~------~--~---