lib/openwfe/expressions/raw.rb in openwferu-0.9.15 vs lib/openwfe/expressions/raw.rb in openwferu-0.9.16

- old
+ new

@@ -55,10 +55,12 @@ def initialize ( fei, parent_id, env_id, application_context, raw_representation) super(fei, parent_id, env_id, application_context, nil) + #linfo { "initialize() '#{fei.expression_name}'" } + @raw_representation = raw_representation #new_environment() if not @environment_id # # now done in the launch methods of the expression pool @@ -90,12 +92,10 @@ handle_descriptions() expression.children = extract_children() - expression.store_itself() - expression end # # When a raw expression is applied, it gets turned into the @@ -106,15 +106,12 @@ exp_name, exp_class, attributes = determine_real_expression expression = instantiate_real_expression( workitem, exp_name, exp_class, attributes) - #expression.apply_time = OpenWFE::now() - # - # This method is extremely costly, now avoiding it - expression.apply_time = Time.now + expression.store_itself expression.apply workitem end # @@ -205,19 +202,21 @@ participant_name = lookup_participant(var_value) if participant_name exp_name = participant_name - exp_class = OpenWFE::ParticipantExpression + exp_class = ParticipantExpression attributes['ref'] = participant_name end - elsif var_value.is_a?(OpenWFE::FlowExpressionId) + elsif var_value.is_a?(FlowExpressionId) \ + or var_value.is_a?(RawExpression) - exp_class = OpenWFE::SubProcessRefExpression + exp_class = SubProcessRefExpression attributes['ref'] = exp_name end + # else, it's a standard expression [ exp_name, exp_class, attributes ] end # @@ -235,42 +234,44 @@ default = true "description" else "description__#{k}" end - set_variable vname, description + set_variable vname, description.to_s end return if ds.length < 1 - set_variable "description", ds[0][1] \ + set_variable "description", ds[0][1].to_s \ unless default end - def extract_attributes () - raise NotImplementedError.new("'abstract method' sorry") - end - def extract_children () - raise NotImplementedError.new("'abstract method' sorry") - end - def extract_descriptions () - raise NotImplementedError.new("'abstract method' sorry") - end - def extract_parameters () - raise NotImplementedError.new("'abstract method' sorry") - end - def extract_text_children () - raise NotImplementedError.new("'abstract method' sorry") - end + #-- + #def extract_attributes () + # raise NotImplementedError.new("'abstract method' sorry") + #end + #def extract_children () + # raise NotImplementedError.new("'abstract method' sorry") + #end + #def extract_descriptions () + # raise NotImplementedError.new("'abstract method' sorry") + #end + #def extract_parameters () + # raise NotImplementedError.new("'abstract method' sorry") + #end + #def extract_text_children () + # raise NotImplementedError.new("'abstract method' sorry") + #end + #++ # # Expressions can get tagged. Tagged expressions can easily # be cancelled (undone) or redone. # def consider_tag (workitem, new_expression) - tagname = new_expression.lookup_attribute(:tag, workitem) + tagname = new_expression.lookup_string_attribute :tag, workitem return unless tagname ldebug { "consider_tag() tag is '#{tagname}'" } @@ -311,14 +312,14 @@ # class Parameter def initialize (field, match, default, type) - @field = field - @match = match - @default = default - @type = type + @field = to_s field + @match = to_s match + @default = to_s default + @type = to_s type end # # Will raise an exception if this param requirement is not # met by the workitem. @@ -344,9 +345,17 @@ enforce_type(workitem, field_value) end protected + + # + # Used in the constructor to flatten everything to strings. + # + def to_s (o) + return nil unless o + o.to_s + end # # Will raise an exception if it cannot coerce the type # of the value to the one desired. #