lib/openwfe/engine/lookup_methods.rb
#
# A method for looking up process instances. It expects some options /
# parameters. The scope is rather wide, it may look among fields
# (attributes) of workitems and variables of processes.
#
# Returns an array of wfid (workflow instance ids)
#
# :value or :val ::
#   matches processes with a field or variable with the given value
# :name ::
#   matches processes containing a field or a variable with that name
# :variable or :var or :v ::
#   matches processes with a variable with that name
# :field or :f ::
#   matches processes with a workitem field named like this
# :wfid_prefix ::
#   matches processes whose wfid (process instance id) begins with the given
#   value
# :wfid ::
#   matches the process instance whose wfid (process instance id) is given
#   here
#
# :to_string ::
#   turns actual values to strings before comparing to the :value / :val
# :recursive ::
#   looks inside of hash/array values (else only scans first level)
#
A method for looking up process instances. It expects some options
parameters. The scope is rather wide, it may look among fields
(attributes) of workitems and variables of processes.

Returns an array of wfid (workflow instance ids)




A method for looking up process instances . It expects some options parameters . The scope is rather wide it may look among fields ( attributes ) of workitems and variables of processes . Returns an array of wfid ( workflow instance ids )
def lookup_processes (options)
      val = options[:value] || options[:val]
      vf = options[:vf]
      var = options[:variable] || options[:var] || options[:v] || vf
      field = options[:field] || options[:f] || vf
      opts = {
        :wfid => options[:wfid],
        :wfid_prefix => options[:wfid_prefix]
      }
      opts[:include_classes] = Environment if var and (not field)
      opts[:workitem] = true if field and (not var)
      exps = get_expression_storage.find_expressions(opts)
      vv = var or (not field)
      ff = field or (not var)
      result = exps.inject([]) do |ids, exp|
        unless ids.include?(exp.fei.wfid)
          vars = exp.is_a?(Environment) ?
            exp.variables : nil
          fields = exp.respond_to?(:applied_workitem) ?
            exp.applied_workitem.fields : nil
          h, k = if vv and vars
            [ exp.fei.wfid == '0' ? nil : vars, var ]
          elsif ff and fields
            [ fields, field ]
          elsif val != nil
            [ vars || fields, nil ]
          else
            [ nil, nil ]
          end
          if val_match?(h, k, val, options) || nested_match?(h, k, val, options)
            ids << exp.fei.wfid
          end
        end
        ids
      end
    end
def lookup_processes ( options ) val = options [ :value ] || options [ :val ] vf = options [ :vf ] var = options [ :variable ] || options [ :var ] || options [ :v ] || vf field = options [ :field ] || options [ :f ] || vf opts = { :wfid => options [ :wfid ] , :wfid_prefix => options [ :wfid_prefix ] } opts [ :include_classes ] = Environment if var and ( not field ) opts [ :workitem ] = true if field and ( not var ) exps = get_expression_storage . find_expressions ( opts ) vv = var or ( not field ) ff = field or ( not var ) result = exps . inject ( [ ] ) do | ids , exp | unless ids . include? ( exp . fei . wfid ) vars = exp . is_a? ( Environment ) ? exp . variables : nil fields = exp . respond_to? ( :applied_workitem ) ? exp . applied_workitem . fields : nil h , k = if vv and vars [ exp . fei . wfid == '0' ? nil : vars , var ] elsif ff and fields [ fields , field ] elsif val != nil [ vars || fields , nil ] else [ nil , nil ] end if val_match? ( h , k , val , options ) || nested_match? ( h , k , val , options ) ids << exp . fei . wfid end end ids end end
A method for looking up process instances.
A method for looking up process instances .
# do look up... # don't check if the id is already in
options
<not_specific>