Hi list,

In other thread (
http://groups.google.com/group/openwferu-users/browse_thread/thread/8051a30a7a324cda),
John recommended to me that I refactor my process definitions. Definitions
with 300 lines are not optimal, it is true.

In my fat definitions there are some points where many fields are set, one
after another. One way to improve this it is to write a participant that set
multiple fields at the same time loading these fields from a external file.
This way we can keep slim definitions. Next code is an example to do this
within a consume(workitem) method in a new type of participant.


 # From a external file we get a hash like this
 field_hash = { "f1" => "v1", "f2" => "v3", "f3" => "v3" }
 # Use of rufus-dolar gem
 flow_expression = self.get_flow_expression(workitem)
 field_hash = OpenWFE.dosub( field_hash, flow_expression, workitem )

 field_hash.each_pair do | key, value |
   workitem.set_attribute( key, value )
 end

I do one set_attribute call for each field, but I do not know if there is a
way to setting various fields (from a hash) at the same time. Is it possible
to optimize this code?

I know there is something similar when we use set-field command with a hash:

  <set-fields>
    <a>
      <hash>
        <entry>
          <string>f1</string><string>v1</string>
        </entry>
        <entry>
          <string>f2</string><string>v2</string>
        </entry>
        <entry>
          <string>f3</string><string>v3</string>
        </entry>
      </hash>
    </a>
  </set-fields>

But in this case, I do not know if, internally, the engine do one or more
set_attribute calls.

Kind regards.
Diego.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ruote (OpenWFEru) users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to