lib/ruote/part/engine_participant.rb in ruote-2.1.11 vs lib/ruote/part/engine_participant.rb in ruote-2.2.0

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -103,11 +103,11 @@ # class EngineParticipant include LocalParticipant - def initialize (opts) + def initialize(opts) if pa = opts['storage_path'] require pa end @@ -116,22 +116,21 @@ raise(ArgumentError.new("missing 'storage_class' parameter")) unless kl @storage = Ruote.constantize(kl).new(opts['storage_args']) end - def consume (workitem) + def consume(workitem) wi = workitem.to_h fexp = Ruote::Exp::FlowExpression.fetch(@context, wi['fei']) params = wi['fields'].delete('params') forget = (fexp.attribute(:forget).to_s == 'true') @storage.put_msg( 'launch', 'wfid' => wi['fei']['wfid'], - 'sub_wfid' => fexp.get_next_sub_wfid, 'parent_id' => forget ? nil : wi['fei'], 'tree' => determine_tree(fexp, params), 'workitem' => wi, 'variables' => fexp.compile_variables) @@ -140,11 +139,11 @@ # special behaviour here in case of :forget => true : # parent_id of remote expression is set to nil and local expression # is unpersisted immediately end - def cancel (fei, flavour) + def cancel(fei, flavour) exps = @storage.get_many('expressions', /^0![^!]+!#{fei.wfid}$/) return true if exps.size < 1 # participant expression will reply to its parent @@ -156,20 +155,20 @@ false # participant expression will NOT reply to its parent end - def reply (fei, workitem) + def reply(fei, workitem) @storage.put_msg( 'reply', 'fei' => fei, 'workitem' => workitem) end protected - def determine_tree (fexp, params) + def determine_tree(fexp, params) pdef = params['def'] || params['pdef'] || params['tree'] tree = Ruote.lookup_subprocess(fexp, pdef)