lib/openwfe/expressions/fe_raw.rb in openwferu-0.9.2 vs lib/openwfe/expressions/fe_raw.rb in openwferu-0.9.3
- old
+ new
@@ -66,21 +66,25 @@
@raw_representation = raw_representation
new_environment() if not @environment_id
end
- def instantiate_real_expression (workitem)
+ def instantiate_real_expression \
+ (workitem, exp_class=nil, attributes=nil)
- attributes = extract_attributes()
+ exp_class = expression_class() unless exp_class
- eclass = expression_class()
+ raise "unknown expression '#{expression_name}'" \
+ unless exp_class
- raise "unknown expression '#{expression_name}'" if not eclass
+ #ldebug do
+ # "instantiate_real_expression() exp_class is #{exp_class}"
+ #end
- ldebug { "instantiate_real_expression() eclass is #{eclass}" }
+ attributes = extract_attributes() unless attributes
- expression = eclass.new(
+ expression = exp_class.new(
@fei,
@parent_id,
@environment_id,
@application_context,
attributes)
@@ -92,17 +96,44 @@
return expression
end
def apply (workitem)
- template = lookup_variable(expression_name())
+ exp_name = expression_name()
- if template and template.kind_of? OpenWFE::FlowExpressionId
- launch_template(template, workitem)
- else
- expression = instantiate_real_expression(workitem)
- expression.apply(workitem)
+ exp_class = nil
+ attributes = nil
+
+ template = lookup_variable(exp_name)
+ #
+ # is it a subprocess ?
+
+ template = get_participant_map.lookup_participant(exp_name) \
+ unless template
+ #
+ # is it a directly a participant ?
+
+ if template
+
+ if template.kind_of? OpenWFE::FlowExpressionId
+ launch_template(template, workitem)
+ return
+ end
+
+ if template.kind_of? OpenWFE::Participant
+ exp_class = OpenWFE::ParticipantExpression
+ attributes = extract_attributes()
+ attributes["ref"] = exp_name
+ end
end
+
+ #
+ # the classical case...
+
+ expression = instantiate_real_expression(
+ workitem, exp_class, attributes)
+
+ expression.apply(workitem)
end
#def reply (workitem)
# no implementation necessary
#end