use of org.codice.ddf.spatial.geocoding.FeatureQueryException in project ddf by codice.
the class CatalogFeatureQueryable method query.
@Override
public List<SimpleFeature> query(String queryString, String featureCode, int maxResults) throws FeatureQueryException {
Validate.notNull(queryString, "queryString can't be null");
if (maxResults < 0) {
throw new IllegalArgumentException("maxResults can't be negative");
}
Query query = catalogHelper.getQueryForName(queryString);
QueryRequest queryRequest = new QueryRequestImpl(query);
SourceResponse response;
try {
response = catalogFramework.query(queryRequest);
} catch (UnsupportedQueryException | SourceUnavailableException | FederationException e) {
throw new FeatureQueryException("Failed to query catalog", e);
}
return response.getResults().stream().map(Result::getMetacard).map(this::getFeatureForMetacard).filter(Objects::nonNull).limit(maxResults).collect(Collectors.toList());
}
Aggregations