lib/openwfe/flowexpressionid.rb in openwferu-0.9.8 vs lib/openwfe/flowexpressionid.rb in openwferu-0.9.9
- old
+ new
@@ -141,30 +141,63 @@
#alias to_debug_s to_s
#def to_debug_s
# "#{to_s} (h#{hash}) (i#{object_id})"
#end
+
def to_debug_s
"(fei #{@workflow_definition_name} #{@workflow_definition_revision} #{@workflow_instance_id} #{@expression_id} #{@expression_name})"
end
def to_short_s
"(fei #{@workflow_instance_id} #{@expression_id} #{@expression_name})"
end
#
+ # Yet another debugging method. Just returns the sub_instance_id and
+ # the expression_id, in a string.
+ #
+ def to_env_s
+ "i#{sub_instance_id} #{@expression_id}"
+ end
+
+ #
# Returns the workflow instance id without any subflow indices.
# For example, if the wfid is "1234.0.1", this method will
# return "1234".
#
def parent_workflow_instance_id
i = workflow_instance_id.index(".")
- return workflow_instance_id if not i
- #return workflow_instance_id[0..i]
- return workflow_instance_id[0..i-1]
+ return workflow_instance_id unless i
+ workflow_instance_id[0..i-1]
end
alias :parent_wfid :parent_workflow_instance_id
+
+ #
+ # Returns "" if this expression id belongs to a top process,
+ # returns something like ".0" or ".1.3" if this exp id belongs to
+ # an expression in a subprocess.
+ # (Only used in some unit tests for now)
+ #
+ def sub_instance_id
+ i = workflow_instance_id.index(".")
+ return "" unless i
+ workflow_instance_id[i..-1]
+ end
+
+ #
+ # Returns the last part of the expression_id. For example, if
+ # the expression_id is "0.1.0.4", "4" will be returned.
+ #
+ # This method is used in "concurrence" when merging workitems coming
+ # backing from the children expressions.
+ #
+ def child_id
+ i = @expression_id.rindex(".")
+ return @expression_id unless i
+ @expression_id[i+1..-1]
+ end
#
# This class method parses a string into a FlowExpressionId instance
#
def FlowExpressionId.to_fei (string)