lib/ruote/part/storage_participant.rb in ruote-2.1.9 vs lib/ruote/part/storage_participant.rb in ruote-2.1.10

- old
+ new

@@ -94,11 +94,11 @@ # Removes the document/workitem from the storage # def cancel (fei, flavour) - doc = fetch(fei.to_h) + doc = fetch(fei) r = @context.storage.delete(doc) cancel(fei, flavour) if r != nil end @@ -110,21 +110,23 @@ doc ? Ruote::Workitem.new(doc) : nil end def fetch (fei) - fei = fei.to_h if fei.respond_to?(:to_h) + hfei = Ruote::FlowExpressionId.extract_h(fei) - @context.storage.get('workitems', to_id(fei)) + @context.storage.get('workitems', to_id(hfei)) end # Removes the workitem from the in-memory hash and replies to the engine. # def reply (workitem) - doc = fetch(workitem.fei.to_h) + # TODO: change method name (receiver mess cleanup) + doc = fetch(Ruote::FlowExpressionId.extract_h(workitem)) + r = @context.storage.delete(doc) return reply(workitem) if r != nil workitem.h.delete('_rev') @@ -235,11 +237,12 @@ # def query (criteria) cr = criteria.inject({}) { |h, (k, v)| h[k.to_s] = v; h } - return @context.storage.query_workitems(cr) \ - if @context.storage.respond_to?(:query_workitems) + return @context.storage.query_workitems(cr).collect { |h| + Ruote::Workitem.new(h) + } if @context.storage.respond_to?(:query_workitems) offset = cr.delete('offset') limit = cr.delete('limit') wfid = cr.delete('wfid')