Gets the WHERE clause for the SQL query that looks up POI entries.

@param filter  The filter object for determining all wanted categories.
@param version POI specification version.
@return The WHERE clause.
485745
private static String getSQLWhereClauseString(PoiCategoryFilter filter, int version) {
        Collection<PoiCategory> superCategories = filter.getAcceptedSuperCategories();

        if (superCategories.isEmpty()) {
            return "";
        }

        StringBuilder sb = new StringBuilder();
        sb.append(" AND (");
        // for each super category
        for (Iterator<PoiCategory> superCatIter = superCategories.iterator(); superCatIter.hasNext(); ) {
            PoiCategory superCat = superCatIter.next();

            // All child categories of the super category, including their children
            Collection<PoiCategory> categories = superCat.deepChildren();
            // Don't forget the super category itself in the search!
            categories.add(superCat);

            if (version < 2) {
                sb.append(DbConstants.FIND_IN_BOX_CLAUSE_WHERE_CATEGORY_IN_V1);
            } else {
                sb.append(DbConstants.FIND_IN_BOX_CLAUSE_WHERE_CATEGORY_IN);
            }
            // for each category
            for (Iterator<PoiCategory> catIter = categories.iterator(); catIter.hasNext(); ) {
                PoiCategory cat = catIter.next();
                sb.append(cat.getID());
                if (catIter.hasNext()) {
                    sb.append(", ");
                }
            }
            sb.append(")");

            // append OR if it is not the last
            if (superCatIter.hasNext()) {
                sb.append(" OR ");
            }
        }
        sb.append(")");

        return sb.toString();
    }
1288184
protected Query getTermQueryFilter(String field, String term) {

        return getMultiTermQueryFilter(field, term, Collections.singletonList(term));
    }
1293391
private List<CmsCategoryBean> getFilteredCategories(String filter) {

        List<CmsCategoryBean> result;
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(filter)) {
            result = new ArrayList<CmsCategoryBean>();
            for (CmsCategoryBean category : getCategoryList()) {
                if (category.matchesFilter(filter)) {
                    result.add(category);
                }
            }
        } else {
            result = getCategoryList();
        }
        return result;
    }
166472
public TypedQuery<Long> count(Filter filter) {
        CriteriaQuery<Long> query = cb.createQuery(Long.class);
        Root<T> from = query.from(getEntityClass());

        if (filter != null) {
            Predicate where = new CriteriaMapper(from, cb).create(filter);
            query.where(where);
        }

        return getEntityManager().createQuery(query.select(cb.count(from)));
    }
1196180
public static function where($filter, $value = null)
    {
        if (is_scalar($filter)) {
            /** @var \ManaPHP\ModelInterface $model */
            $model = Di::getDefault()->getShared(static::class);
            return static::query(null, $model)->whereEq($model->getPrimaryKey(), $filter);
        } else {
            return static::query()->where($filter, $value);
        }
    }
938721
public static Filter get(final IWhere _where, final IOrder _order, final Type... _baseTypes)
        throws CacheReloadException
    {
        return new Filter().analyze(_where, _order, Arrays.asList(_baseTypes));
    }
896378
public static Filter getFilterForLocation(Class<?> clazz, String location) throws IllegalArgumentException {
        return getFilterForLocation(clazz, location, ContextHolder.get().getCurrentContextId());
    }
1255073
public AntiAffinityPolicyFilter where(Predicate<AntiAffinityPolicyMetadata> filter) {
        checkNotNull(filter, "Filter predicate must be not a null");

        this.predicate = this.predicate.and(filter);

        return this;
    }
635735
private Filter getFilter(String layerFilter, String[] featureIds) throws GeomajasException {
		Filter filter = null;
		if (null != layerFilter) {
			filter = filterService.parseFilter(layerFilter);
		}
		if (null != featureIds) {
			Filter fidFilter = filterService.createFidFilter(featureIds);
			if (null == filter) {
				filter = fidFilter;
			} else {
				filter = filterService.createAndFilter(filter, fidFilter);
			}
		}
		return filter;
	}
1120406
public static Interface[] get_filtered(nitro_service service, String filter) throws Exception{
		Interface obj = new Interface();
		options option = new options();
		option.set_filter(filter);
		Interface[] response = (Interface[]) obj.getfiltered(service, option);
		return response;
	}
424176
def where(filter)
      if filter.is_a?(String) # we got a Sparql snippet
        where_clauses << filter
      elsif filter.is_a?(Hash)
        filter.each_pair do |key, value|
          field = resource_class.get_field(key)
          value = RDF::Literal.new(value) unless value.respond_to?(:to_base)
          where_clauses << "?uri <#{ field.predicate }> #{ value.to_base }"
        end
      end
      self
    end
209439
public <ResultT> ResultT findOne(final Bson filter, final Class<ResultT> resultClass) {
    return executeFindOne(filter, null, resultClass);
  }
887422
private void setWhere(Where where) throws SqlParseException {
		if (where != null) {
			QueryBuilder whereQuery = QueryMaker.explan(where);
			request.filter(whereQuery);
		} else {
			request.filter(QueryBuilders.matchAllQuery());
		}
	}
195540
public Filter getFilter()
        throws CacheReloadException
    {
        final IWhere where = eqlStmt.getQuery().getWhere();
        final IOrder order = eqlStmt.getOrder();
        return Filter.get(where, order, getTypes().toArray(new Type[getTypes().size()]));
    }
784644
public String toURLQueryString() {
        StringJoiner joiner = new StringJoiner("&");
        if (releaseIdFilter.getGroupId() != null) {
            joiner.add("groupId=" + releaseIdFilter.getGroupId());
        }
        if (releaseIdFilter.getArtifactId() != null) {
            joiner.add("artifactId=" + releaseIdFilter.getArtifactId());
        }
        if (releaseIdFilter.getVersion() != null) {
            joiner.add("version=" + releaseIdFilter.getVersion());
        }
        // don't send over the default status filter (e.g. one that accepts all the states) as it is not needed, it is
        // the default
        if (!statusFilter.equals(KieContainerStatusFilter.ACCEPT_ALL)) {
            String status = statusFilter.getAcceptedStatuses()
                    .stream()
                    .map(s -> s.toString())
                    .collect(Collectors.joining(","));
            joiner.add("status=" + status);
        }
        return joiner.toString();
    }
940436
@SneakyThrows
    public Collection<GitObject> getObjectsInRepository(final TreeFilter filter) {
        val repository = this.gitInstance.getRepository();
        val head = repository.resolve(Constants.HEAD);

        try (val walk = new RevWalk(repository)) {
            val commit = walk.parseCommit(head);
            val tree = commit.getTree();
            try (val treeWalk = new TreeWalk(repository)) {
                treeWalk.addTree(tree);
                treeWalk.setRecursive(true);
                treeWalk.setFilter(filter);
                val list = new ArrayList<GitObject>();
                while (treeWalk.next()) {
                    val object = readObject(treeWalk);
                    list.add(object);
                }
                return list;
            }
        }
    }
124266
public MongoDeepJobConfig<T> filterQuery(Filter[] filters) {

        if (filters.length > 0) {
            List<BasicDBObject> list = new ArrayList<>();

            QueryBuilder queryBuilder = QueryBuilder.start();
            for (int i = 0; i < filters.length; i++) {
                BasicDBObject bsonObject = new BasicDBObject();

                Filter filter = filters[i];
                if (filter.getFilterType().equals(FilterType.EQ)) {
                    bsonObject.put(filter.getField(), filter.getValue());
                } else {
                    bsonObject.put(filter.getField(),
                            new BasicDBObject("$".concat(filter.getFilterType().getFilterTypeId().toLowerCase()),
                                    filter.getValue()));
                }

                list.add(bsonObject);
            }
            queryBuilder.and(list.toArray(new BasicDBObject[list.size()]));

            filterQuery(queryBuilder);
        }
        return this;

    }