lib/ruote/receiver/base.rb in ruote-2.1.10 vs lib/ruote/receiver/base.rb in ruote-2.1.11

- old
+ new

@@ -53,10 +53,18 @@ # launches a new process instance. # # This method is mostly used from the Ruote::Engine class (which includes # this mixin). # + # process_definition must be a result of Ruote.process_definition call + # or XML or JSON serialized process definition, as accepted by + # Ruote::Parser#parse. + # + # fields are workflow parameters that will be placed in workitem.fields. + # + # variables contain engine variables. + # def launch (process_definition, fields={}, variables={}) wfid = @context.wfidgen.generate @context.storage.put_msg( @@ -96,18 +104,28 @@ def sign self.class.to_s end - protected - - # Convenience method, fetches the flow expression (ParticipantExpression) - # that emitted that workitem. + # Convenience method, given a workitem or a fei, returns the + # corresponding flow expession. # - def fetch_flow_expression (workitem) + def fetch_flow_expression (workitem_or_fei) - Ruote::Exp::FlowExpression.fetch(@context, workitem.fei.to_h) + Ruote::Exp::FlowExpression.fetch( + @context, + Ruote::FlowExpressionId.extract_h(workitem_or_fei)) end + + # For example : + # + # fexp = engine.fexp(fei) + # # or + # fexp = engine.fexp(workitem) + # + alias fexp fetch_flow_expression + + protected # Stashes values in the participant expression (in the storage). # # put(workitem.fei, 'key' => 'value', 'colour' => 'blue') #