def _get_all(
        self,
        exclude_fields=None,
        include_fields=None,
        advanced_filters=None,
        sort=None,
        offset=0,
        limit=None,
        query_options=None,
        from_model_kwargs=None,
        raw_filters=None,
        requester_user=None,
    ):
        """
        :param exclude_fields: A list of object fields to exclude.
        :type exclude_fields: ``list``
        """
        raw_filters = copy.deepcopy(raw_filters) or {}

        exclude_fields = exclude_fields or []
        include_fields = include_fields or []
        query_options = query_options if query_options else self.query_options

        if exclude_fields and include_fields:
            msg = (
                "exclude_fields and include_fields arguments are mutually exclusive. "
                "You need to provide either one or another, but not both."
            )
            raise ValueError(msg)

        exclude_fields = self._validate_exclude_fields(exclude_fields=exclude_fields)
        include_fields = self._validate_include_fields(include_fields=include_fields)

        # TODO: Why do we use comma delimited string, user can just specify
        # multiple values using ?sort=foo&sort=bar and we get a list back
        sort = sort.split(",") if sort else []

        db_sort_values = []
        for sort_key in sort:
            if sort_key.startswith("-"):
                direction = "-"
                sort_key = sort_key[1:]
            elif sort_key.startswith("+"):
                direction = "+"
                sort_key = sort_key[1:]
            else:
                direction = ""

            if sort_key not in self.supported_filters:
                # Skip unsupported sort key
                continue

            sort_value = direction + self.supported_filters[sort_key]
            db_sort_values.append(sort_value)

        default_sort_values = copy.copy(query_options.get("sort"))
        raw_filters["sort"] = db_sort_values if db_sort_values else default_sort_values

        # TODO: To protect us from DoS, we need to make max_limit mandatory
        offset = int(offset)
        if offset >= 2**31:
            raise ValueError('Offset "%s" specified is more than 32-bit int' % (offset))

        limit = validate_limit_query_param(limit=limit, requester_user=requester_user)
        eop = offset + int(limit) if limit else None

        filters = {}
        for k, v in six.iteritems(self.supported_filters):
            filter_value = raw_filters.get(k, None)

            if not filter_value:
                continue

            value_transform_function = self.filter_transform_functions.get(k, None)
            value_transform_function = value_transform_function or (lambda value: value)
            filter_value = value_transform_function(value=filter_value)

            if k in ["id", "name"] and isinstance(filter_value, list):
                filters[k + "__in"] = filter_value
            else:
                field_name_split = v.split(".")

                # Make sure filter value is a list when using "in" filter
                if field_name_split[-1] == "in" and not isinstance(
                    filter_value, (list, tuple)
                ):
                    filter_value = [filter_value]

                filters["__".join(field_name_split)] = filter_value

        if advanced_filters:
            for token in advanced_filters.split(" "):
                try:
                    [k, v] = token.split(":", 1)
                except ValueError:
                    raise ValueError('invalid format for filter "%s"' % token)
                path = k.split(".")
                try:
                    self.model.model._lookup_field(path)
                    filters["__".join(path)] = v
                except LookUpError as e:
                    raise ValueError(six.text_type(e))

        instances = self.access.query(
            exclude_fields=exclude_fields, only_fields=include_fields, **filters
        )
        if limit == 1:
            # Perform the filtering on the DB side
            instances = instances.limit(limit)

        from_model_kwargs = from_model_kwargs or {}
        from_model_kwargs.update(self.from_model_kwargs)

        result = self.resources_model_filter(
            model=self.model,
            instances=instances,
            offset=offset,
            eop=eop,
            requester_user=requester_user,
            **from_model_kwargs,
        )

        resp = Response(json=result)
        resp.headers["X-Total-Count"] = str(instances.count())

        if limit:
            resp.headers["X-Limit"] = str(limit)

        return resp

        :param exclude_fields: A list of object fields to exclude.
        :type exclude_fields: ``list``
        
st2api/st2api/controllers/resource.py