def narrow_filter(fi, workitem)

      if fi.is_a?(Array) or fi.respond_to?(:consume) or fi.respond_to?(:filter)

        fi

      elsif fi.is_a?(Hash)

        workitem ? fi['out'] || fi['reply'] : fi['in'] || fi['apply']

      elsif fi.is_a?(String)

        filter =
          lookup_variable(fi) ||
          @context.plist.lookup(fi, workitem || h.applied_workitem)

        if filter.respond_to?(:consume) or filter.respond_to?(:filter)
          (workitem || h.applied_workitem)['participant_name'] = fi
        end

        filter

      else

        nil
      end
    end
def narrow_filter(fi, workitem)

      if fi.is_a?(Array) or fi.respond_to?(:consume) or fi.respond_to?(:filter)

        fi

      elsif fi.is_a?(Hash)

        workitem ? fi['out'] || fi['reply'] : fi['in'] || fi['apply']

      elsif fi.is_a?(String)

        filter =
          lookup_variable(fi) ||
          @context.plist.lookup(fi, workitem || h.applied_workitem)

        if filter.respond_to?(:consume) or filter.respond_to?(:filter)
          (workitem || h.applied_workitem)['participant_name'] = fi
        end

        filter

      else

        nil
      end
    end
Called successively to dig for the filter (Array or Participant).