Restores the fields of the current workitem. That means usually copying them from a saved version in a variable or in a separate field.
restore :from_var => 'v'
or
restore :from_f => 'customer.address.street', :to_f => 'delivery.street'
(yes, this sets the field 'street' inside of the field 'delivery')
This expressions has a 'set_fields' alias. It can be handy (and readable) to set a bunch of workitem fields in one sweep somewhere in a process :
Ruote.process_definition :name => 'working hard' do
sequence do
set_fields :val => { 'customer' => { 'name' => 'Fred', 'age' => 40 } }
participant :ref => 'delivery'
participant :ref => 'invoincing'
end
end
# File lib/ruote/exp/fe_restore.rb, line 62 def apply from = has_attribute(*] v var variable ].map { |k| "from_#{k}" }) || has_attribute(*] f fld field ].map { |k| "from_#{k}" }) || has_attribute(*] val value ]) to = has_attribute(*] f fld field ].map { |k| "to_#{k}" }) || has_attribute('to') from = 'from_var' if from == 'from_v' afrom = attribute(from) fields = if from.match(/var/) lookup_variable(afrom) elsif from.match(/f/) Ruote.lookup(h.applied_workitem['fields'], afrom) else # val afrom end if to Ruote.set(h.applied_workitem['fields'], attribute(to), fields) else h.applied_workitem['fields'] = fields end # TODO : merge strategies reply_to_parent(h.applied_workitem) end
Generated with the Darkfish Rdoc Generator 2.