# #-- # Copyright (c) 2005-2007, John Mettraux, OpenWFE.org # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # . Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # . Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # . Neither the name of the "OpenWFE" nor the names of its contributors may be # used to endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. #++ # # $Id: workitem.rb 3555 2006-11-13 00:47:53Z jmettraux $ # # # "hecho en Costa Rica" # enhanced in Japan # # john.mettraux@openwfe.org # module OpenWFE # # FlowExpressionId # class FlowExpressionId attr_accessor \ :owfe_version, \ :engine_id, \ :initial_engine_id, \ :workflow_definition_url, \ :workflow_definition_name, \ :workflow_definition_revision, \ :workflow_instance_id, \ :expression_name, \ :expression_id # # overrides the classical to_s() # def to_s () return "(fei #{@owfe_version} #{@engine_id}/#{@initial_engine_id} #{@workflow_definition_url} #{@workflow_definition_name} #{@workflow_definition_revision} #{@workflow_instance_id} #{@expression_name} #{@expression_id})" end def hash () return to_s().hash() end def == (other) return false if not other.kind_of?(FlowExpressionId) @owfe_version == other.owfe_version and @engine_id == other.engine_id and @initial_engine_id == other.initial_engine_id and @workflow_definition_url == other.workflow_definition_url and @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 def dup n = FlowExpressionId.new n.owfe_version = @owfe_version.dup n.engine_id = @engine_id.dup n.initial_engine_id = @initial_engine_id.dup n.workflow_definition_url = @workflow_definition_url.dup n.workflow_definition_name = @workflow_definition_name.dup n.workflow_definition_revision = @workflow_definition_revision.dup n.workflow_instance_id = @workflow_instance_id.dup n.expression_name = @expression_name.dup n.expression_id = @expression_id.dup return n end alias eql? == alias to_debug_s to_s #def to_debug_s # "#{to_s} (h#{hash}) (i#{object_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] end # # This class method parses a string into a FlowExpressionId instance # def FlowExpressionId.to_fei (string) fei = FlowExpressionId.new() ss = string.split(" ") #puts "\n#{ss}" fei.owfe_version = ss[1] ssRawEngineId = ss[2].split("/") fei.engine_id= ssRawEngineId[0] fei.initial_engine_id= ssRawEngineId[1] fei.workflow_definition_url = ss[3] fei.workflow_definition_name = ss[4] fei.workflow_definition_revision = ss[5] fei.workflow_instance_id = ss[6] fei.expression_name = ss[7] fei.expression_id = ss[8][0..-2] return fei end end end