creates the filter instance for the configured rule
485000
@Activate
    protected void activate(ComponentContext context) {
        Dictionary properties = context.getProperties();
        name = (String) properties.get("name");
        filter = ResourceFilterMapping.fromString((String) properties.get("filter"));
    }
642302
@FFDCIgnore(PrivilegedActionException.class)
    private Object createResourceWithFilter(final String filter, final ResourceInfo resourceRefInfo) throws Exception {
        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                @Override
                public Object run() throws Exception {
                    return createResourceWithFilterPrivileged(filter, resourceRefInfo);
                }
            });
        } catch (PrivilegedActionException paex) {
            Throwable cause = paex.getCause();
            if (cause instanceof Exception) {
                throw (Exception) cause;
            }
            throw new Error(cause);
        }
    }
198244
def filter(self, filter_fn):
        
        op = Operator(
            _generate_uuid(),
            OpType.Filter,
            "Filter",
            filter_fn,
            num_instances=self.env.config.parallelism)
        return self.__register(op)
926260
function filterValidRule(rule) {
  return (rule.hasOwnProperty('match')&&typeof rule.match === "object")
  && (rule.hasOwnProperty('use') && (
    typeof rule.use === "object"
    || typeof rule.use === "function"
  ))
  && (
    (rule.match.hasOwnProperty('request'))
    || (rule.match.hasOwnProperty('base'))
  )
}
887941
def clone(self):
        

        cloned_filters = [f.clone() for f in self.filters]
        return self.__class__(cloned_filters, self.attr_type, self.attr_value)
108246
function addFilter (config, filter) {
  if (filter) {
    if (filter[ 0 ] === '-') {
      config.filters.ignore[ filter ] = new RegExp('^' + filter.slice(1).replace(/[*]/g, '.*?') + '$')
    } else {
      config.filters.should[ filter ] = new RegExp('^' + filter.replace(/[*]/g, '.*?') + '$')
    }
  }
}
1187865
public static Filter createFilter(String filterFactoryFqcn, FilterFactoryParams params)
            throws FilterFactory.FilterNotCreatedException {
        FilterFactory filterFactory = createFilterFactory(filterFactoryFqcn);

        return filterFactory.createFilter(params);
    }
508986
def filter(filters = {})
      all.select do |rule|
        [:country, :type].each do |condition|
          break false if filters[condition] && filters[condition] != rule[condition]
          true
        end
      end
    end
1365630
def filtered(self, efilter):
        '''
        
        '''
        if not self.params:
            self.params={'filter' : efilter}
            return self
        if not self.params.has_key('filter'):
            self.params['filter'] = efilter
            return self
        self.params['filter'].update(efilter)
        return self
365408
def add_filter(self, func, rules):
        
        if not callable(func):
            raise ValueError("{} is not callable".format(func))
        if not isinstance(rules, list):
            raise ValueError("{} is not list".format(rules))
        if len(rules) > 1:
            for x in rules:
                self.add_filter(func, [x])
        else:
            target_content = rules[0]
            if isinstance(target_content, six.string_types):
                target_content = to_text(target_content)

                def _check_content(message):
                    return message.content == target_content
            elif is_regex(target_content):

                def _check_content(message):
                    return target_content.match(message.content)
            else:
                raise TypeError("%s is not a valid rule" % target_content)
            argc = len(signature(func).parameters.keys())

            @self.text
            def _f(message, session=None):
                _check_result = _check_content(message)
                if _check_result:
                    if isinstance(_check_result, bool):
                        _check_result = None
                    return func(*[message, session, _check_result][:argc])
78707
def build_filter
      raise(ArgumentError, 'Cannot supply both a filter and an exclusion filter') if include_filter && exclude_filter

      filter                  = where_filter
      (filter ||= {})['_type'] = include_filter if include_filter
      (filter ||= {})['_type'] = {'$not' => exclude_filter} if exclude_filter
      filter
    end
1078701
public function createFilterDriver()
	{
		$aliases = $this->app['config']->get('basset.aliases.filters', array());

		$node = $this->app['config']->get('basset.node_paths', array());

		$filter = new FilterFactory($aliases, $node, $this->app['env']);

		return $this->factory($filter);
	}
835168
public FilterChain create() throws FilterConfigurationException {
        Preconditions.checkState(filters != null, "list of filters must be set");
        Preconditions.checkState(inputType != null, "inputType must be set");
        Preconditions.checkState(outputType != null, "outputType must be set");

        Preconditions.checkState(filters.size() > 0, "need at least one filter");
        validateFiltersList();

        Iterator<Object> iterator = filters.iterator();

        FilterChainElement firstInstance = getInstanceFromListElement(iterator.next());
        if (!firstInstance.getSupportedInputType().isAssignableFrom(inputType)
                || !firstInstance.getSupportedOutputType().isAssignableFrom(outputType)) {
            throw new FilterConfigurationException(String.format(
                "incompatible Filtertype (%s) should be (%s->%s) - is (%s->%s)",
                firstInstance.getClass(), inputType, outputType, firstInstance.getSupportedInputType(),
                firstInstance.getSupportedOutputType()));
        }
        FilterChainElement current = firstInstance;
        while (iterator.hasNext()) {
            Object next = iterator.next();
            FilterChainElement nextFilterElement = getInstanceFromListElement(next);
            if (nextFilterElement == null) {
                current.setNext((FilterAction) next);
                break;
            }
            current.setNext(nextFilterElement);
            current = nextFilterElement;
        }
        return new FilterChain(firstInstance);
    }
1005134
def prepare_rules(self, attributes = [], ip_ranges = [], params = {}):
        
        for filename in self.rule_definitions:
            if filename in self.rules:
                for rule in self.rules[filename]:
                    rule.set_definition(self.rule_definitions, attributes, ip_ranges, params)
            else:
                self.rules[filename] = []
                new_rule = Rule(filename, self.rule_type, {'enabled': False, 'level': 'danger'})
                new_rule.set_definition(self.rule_definitions, attributes, ip_ranges, params)
                self.rules[filename].append(new_rule)
846975
def filter_factory(global_conf, **local_conf):
    """"""
    conf = global_conf.copy()
    conf.update(local_conf)

    def visible(app):
        return VisibleFilter(app, conf)
    return visible
831809
def factory(self, data, manager=None):
        

        # Make the syntax a little nicer for common cases.
        if isinstance(data, dict) and len(data) == 1 and 'type' not in data:
            op = list(data.keys())[0]
            if op == 'or':
                return Or(data, self, manager)
            elif op == 'and':
                return And(data, self, manager)
            elif op == 'not':
                return Not(data, self, manager)
            return ValueFilter(data, manager)
        if isinstance(data, six.string_types):
            filter_type = data
            data = {'type': data}
        else:
            filter_type = data.get('type')
        if not filter_type:
            raise PolicyValidationError(
                "%s Invalid Filter %s" % (
                    self.plugin_type, data))
        filter_class = self.get(filter_type)
        if filter_class is not None:
            return filter_class(data, manager)
        else:
            raise PolicyValidationError(
                "%s Invalid filter type %s" % (
                    self.plugin_type, data))
97658
def apply_filters_to_scope(scope, user_params, options)
      helper_instance = fresh_helper_instance

      requested_filters = extract_filters(user_params, options)
      requested_filters.each do |filter_name, filter_arg|
        filter_lambda = configuration[:filters][filter_name][:value]

        args_for_filter_lambda = [filter_arg]
        args_for_filter_lambda << requested_filters if configuration[:filters][filter_name][:include_params]

        if filter_lambda
          scope = helper_instance.instance_exec(scope, *args_for_filter_lambda, &filter_lambda)
        else
          scope = scope.send(filter_name, *args_for_filter_lambda)
        end
      end

      scope
    end