@Override
protected void encode(FeatureCollectionResponse results, OutputStream output, Encoder encoder)
throws IOException {
if (results.isGetFeatureById()) {
List<FeatureCollection> features = results.getFeatures();
Feature next = DataUtilities.first(features.get(0));
if (next == null) {
throw new WFSException(
(EObject) null,
"No feature matching the requested id found",
WFSException.NOT_FOUND);
} else {
encoder.encode(next, GML.AbstractFeature, output);
}
} else {
encoder.encode(
results.unadapt(FeatureCollectionType.class), WFS.FeatureCollection, output);
}
}