use of org.geotools.filter.v1_1.OGCConfiguration in project ddf by codice.
the class CswCqlTextFilter method getCqlText.
public String getCqlText(FilterType filterType) throws UnsupportedQueryException {
Parser parser = new Parser(new OGCConfiguration());
try {
StringReader reader = new StringReader(marshalFilterType(filterType));
Object parsedFilter = parser.parse(reader);
if (parsedFilter instanceof Filter) {
Filter filterToCql = (Filter) parsedFilter;
LOGGER.debug("Filter to Convert to CQL => {}", filterToCql);
String cql = ECQL.toCQL(filterToCql);
LOGGER.debug("Generated CQL from Filter => {}", cql);
return cql;
} else {
throw new UnsupportedQueryException("Query did not produce a valid filter.");
}
} catch (IOException | SAXException | ParserConfigurationException | JAXBException e) {
throw new UnsupportedQueryException("Unable to create CQL Filter.", e);
}
}
Aggregations