lib/openwfe/expressions/fe_participant.rb in openwferu-0.9.8 vs lib/openwfe/expressions/fe_participant.rb in openwferu-0.9.9
- old
+ new
@@ -39,10 +39,11 @@
# John Mettraux at openwfe.org
#
require 'openwfe/utils'
require 'openwfe/rudefinitions'
+require 'openwfe/expressions/filter'
require 'openwfe/expressions/timeout'
#
# The participant expression, in its own file
@@ -54,46 +55,55 @@
# Participants sit at the edge between the engine and the external
# world. The participant expression transmit the workitem applied
# to it to the Participant instance it looks up in the participant map
# tied to the engine.
#
+ # The Participant expressions includes the FilterMixin and thus
+ # understands and applies the "filter" attribute.
+ #
class ParticipantExpression < FlowExpression
+ include FilterMixin
include TimeoutMixin
names :participant
attr_accessor \
:participant_name,
:applied_workitem
- #
- # apply / reply
def apply (workitem)
- remove_timedout_flag(workitem)
+ remove_timedout_flag workitem
@applied_workitem = workitem.dup
- @participant_name = lookup_ref(workitem)
+ @participant_name = lookup_ref workitem
- @participant_name = fetch_text_content(workitem) \
+ @participant_name = fetch_text_content workitem \
unless @participant_name
determine_timeout()
reschedule(get_scheduler)
+ filter_in workitem
+
store_itself()
+
+ workitem.params = lookup_attributes workitem
get_participant_map.dispatch(@participant_name, workitem)
end
- #def reply (workitem)
- #end
-
def reply_to_parent (workitem)
+
unschedule_timeout()
- super(workitem)
+
+ workitem.attributes.delete "params"
+
+ filter_out workitem
+
+ super workitem
end
#
# The cancel() method of a ParticipantExpression is particular : it
# will emit a CancelItem instance towards the participant itself