lib/openwfe/flowexpressionid.rb in openwferu-0.9.7 vs lib/openwfe/flowexpressionid.rb in openwferu-0.9.8

- old
+ new

@@ -65,10 +65,11 @@ # # A shortcut for fei.workflow_instance_id. # There's also fei.parent_wfid. # alias :wfid :workflow_instance_id + alias :wfid= :workflow_instance_id= # # Overrides the classical to_s() # def to_s () @@ -107,9 +108,30 @@ @workflow_definition_name == other.workflow_definition_name and @workflow_definition_revision == other.workflow_definition_revision and @workflow_instance_id == other.workflow_instance_id and @expression_name == other.expression_name and @expression_id == other.expression_id + end + + # + # Returns true if this other FlowExpressionId is nested within + # this one. + # + # For example (fei TestTag 3 20070331-goyunodabu 0.0.0 sequence) + # is an ancestor of (fei TestTag 3 20070331-goyunodabu 0.0.0.1 redo) + # + # This current implementation doesn't cross the subprocesses + # boundaries. + # + def ancestor_of? (other_fei) + + o = other_fei.dup + o.expression_name = @expression_name + o.expression_id = @expression_id + + return false unless self == o + + OpenWFE::starts_with other_fei.expression_id, @expression_id end def dup OpenWFE::fulldup(self) end