Returns all factory instances that match the query.

@param query the factory query, not null.
@return the instances found, never null.
547840
public static Collection<MonetaryAmountFactory<?>> getAmountFactories(MonetaryAmountFactoryQuery query) {
        return Optional.ofNullable(monetaryAmountsSingletonQuerySpi()).orElseThrow(() -> new MonetaryException(
                "No MonetaryAmountsSingletonQuerySpi loaded, query functionality is not available."))
                .getAmountFactories(query);
    }
1109794
public java.util.List<com.google.appengine.v1.Instance> getInstancesList() {
    return instances_;
  }
641282
public String query(String query) {
        try {
            Connection conn = this.tx().getConnection();
            ObjectNode result = this.mapper.createObjectNode();
            ArrayNode dataNode = this.mapper.createArrayNode();
            ArrayNode metaNode = this.mapper.createArrayNode();
            Statement statement = conn.createStatement();
            if (logger.isDebugEnabled()) {
                logger.debug(query);
            }
            ResultSet rs = statement.executeQuery(query);
            ResultSetMetaData rsmd = rs.getMetaData();
            boolean first = true;
            while (rs.next()) {
                int numColumns = rsmd.getColumnCount();
                ObjectNode obj = this.mapper.createObjectNode();
                for (int i = 1; i < numColumns + 1; i++) {
                    String columnName = rsmd.getColumnLabel(i);
                    int type = rsmd.getColumnType(i);
                    //make sure to obtain array using getArray()
                    //At least in H2, this makes a difference...
                    Object o = type == Types.ARRAY ? rs.getArray(i) : rs.getObject(i);
                    this.sqlDialect.putJsonObject(obj, columnName, type, o);
                    if (first) {
                        this.sqlDialect.putJsonMetaObject(this.mapper, metaNode, columnName, type, o);
                    }
                }
                first = false;
                dataNode.add(obj);
            }
            result.set("data", dataNode);
            result.set("meta", metaNode);
            return result.toString();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        } finally {
            this.tx().rollback();
        }
    }
847184
public @NotNull <T> List<T> findAll(@NotNull RowMapper<T> rowMapper, @NotNull SqlQuery query) {
        return executeQuery(rowMapper.list(), query);
    }
455837
public static List<ModelServiceInstance> filter(ServiceInstanceQuery query, List<ModelServiceInstance> list) {

        List<ModelServiceInstance> instances = new ArrayList<ModelServiceInstance>();
        for (ModelServiceInstance instance : list) {
            boolean passed = true;
            for (QueryCriterion criterion : query.getCriteria()) {
                if (criterion.isMatch(instance.getMetadata()) == false) {
                    passed = false;
                    break;
                }
            }
            if (passed) {
                instances.add(instance);
            }
        }
        return instances;

    }
858582
private static <T> List<TableFactory> filterByFactoryClass(
		Class<T> factoryClass,
		Map<String, String> properties,
		List<TableFactory> foundFactories) {

		List<TableFactory> classFactories = foundFactories.stream()
			.filter(p -> factoryClass.isAssignableFrom(p.getClass()))
			.collect(Collectors.toList());

		if (classFactories.isEmpty()) {
			throw new NoMatchingTableFactoryException(
				String.format("No factory implements '%s'.", factoryClass.getCanonicalName()),
				factoryClass,
				foundFactories,
				properties);
		}

		return classFactories;
	}
194484
public Results search(Query query) throws IOException {
    return search(clientKey, Collections.<String, String>emptyMap(), query);
  }
416052
public java.util.List<QueryInfo> getQueries() {
        if (queries == null) {
            queries = new com.amazonaws.internal.SdkInternalList<QueryInfo>();
        }
        return queries;
    }
313984
public <V, E> NativeTitanGraphQuery<V, E> create(NativeTitanQueryFactory<V, E> factory) {
        NativeTitanGraphQuery<V, E> query = factory.createNativeTitanQuery();
        for (QueryPredicate predicate : children) {
            predicate.addTo(query);
        }
        return query;
    }
972881
public static QueryFactory getQueryFactory(Cache<?, ?> cache) {
      if (cache == null || cache.getAdvancedCache() == null) {
         throw new IllegalArgumentException("cache parameter shall not be null");
      }
      AdvancedCache<?, ?> advancedCache = cache.getAdvancedCache();
      ensureAccessPermissions(advancedCache);
      EmbeddedQueryEngine queryEngine = SecurityActions.getCacheComponentRegistry(advancedCache).getComponent(EmbeddedQueryEngine.class);
      if (queryEngine == null) {
         throw log.queryModuleNotInitialised();
      }
      return new EmbeddedQueryFactory(queryEngine);
   }
470454
private List<?> getResultList(Query query) {
        // TODO : use lazy fetch here?
        if (projection != null) {
            List<?> results = query.getResultList();
            List<Object> rv = new ArrayList<Object>(results.size());
            for (Object o : results) {
                if (o != null) {
                    if (!o.getClass().isArray()) {
                        o = new Object[]{o};
                    }
                    rv.add(projection.newInstance((Object[]) o));
                } else {
                    rv.add(null);
                }
            }
            return rv;
        } else {
            return query.getResultList();
        }
    }
992742
public Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException
    {
        Class itemClass = query.getSearchClass();
        ClassDescriptor cld = getClassDescriptor(itemClass);
        return getIteratorFromQuery(query, cld);
    }
417950
public Iterator<Integer> searchAll(RuleQuery query) {
    SearchRequestBuilder esSearch = client
      .prepareSearch(TYPE_RULE)
      .setScroll(TimeValue.timeValueMinutes(SCROLL_TIME_IN_MINUTES));

    optimizeScrollRequest(esSearch);
    QueryBuilder qb = buildQuery(query);
    Map<String, QueryBuilder> filters = buildFilters(query);

    BoolQueryBuilder fb = boolQuery();
    for (QueryBuilder filterBuilder : filters.values()) {
      fb.must(filterBuilder);
    }

    esSearch.setQuery(boolQuery().must(qb).filter(fb));
    SearchResponse response = esSearch.get();
    return scrollIds(client, response, Integer::parseInt);
  }
1138359
public List<FogbugzCase> searchForCases(String query) throws InvalidResponseException, NoSuchCaseException {
        HashMap<String, String> params = new HashMap<String, String>();  // Hashmap defaults to <String, String>
        params.put("cmd", "search");
        params.put("q", query);
        params.put("cols", "ixBug,tags,fOpen,sTitle,sFixFor,ixPersonOpenedBy,ixPersonAssignedTo" + // No trailing comma
                this.getCustomFieldsCSV());

        Document doc = null;
        try {
            doc = this.getFogbugzDocument(params);
        } catch (Exception e) {
            throw new InvalidResponseException(e.getMessage());
        }

        // Check for case count in cases tag, so we know wheter to parse the response ever further or not.
        int caseCount = 0;
        try {
            Node casesContainer = doc.getElementsByTagName("cases").item(0);
            caseCount = Integer.parseInt(casesContainer.getAttributes().getNamedItem("count").getTextContent());
        } catch (NumberFormatException e) {
            log.log(Level.INFO, "No valid number in case count XML response.", e);
        }
        if (caseCount < 1) {
            throw new NoSuchCaseException("Fogbugz did not return a case for query id " + query);
        }

        NodeList caseNodes = doc.getElementsByTagName("case");
        ArrayList<FogbugzCase> caseList = new ArrayList<FogbugzCase>();
        for (int i = 0; i < caseNodes.getLength(); i++) {
            caseList.add(this.constructCaseFromXmlNode(caseNodes.item(i)));
        }
        return caseList;
    }
1054005
public final List<T> findByQuery(String query, Object... params) {
        return this.findSortedByQuery(query, null, params);
    }
846501
@Override
	public ResourceList<T> findAll(Iterable<I> ids, QuerySpec querySpec) {
		RegistryEntry entry = resourceRegistry.findEntry(resourceClass);
		String idName = entry.getResourceInformation().getIdField().getUnderlyingName();

		QuerySpec idQuerySpec = querySpec.duplicate();
		idQuerySpec.addFilter(new FilterSpec(Arrays.asList(idName), FilterOperator.EQ, ids));
		return findAll(idQuerySpec);
	}
882880
public QueryRequestBuilder<T,ID> query(QueryExpression query)
    {
        return new QueryRequestBuilder<T, ID>(version,type,entityName,query.build());
    }