} else {
features = result.getFeatures();
}
} else if (request.getSearchByLocationRequest() != null) {
log.debug("CSV export using LocationRequest");
SearchByLocationResponse result = (SearchByLocationResponse) dispatch.execute(
SearchByLocationRequest.COMMAND, request.getSearchByLocationRequest(), token, locale);
if (result.isError()) {
response.getErrorMessages().addAll(result.getErrorMessages());
response.getErrors().addAll(result.getErrors());
} else {
List<Feature> res = result.getFeatureMap().get(request.getLayerId());
if (res != null) {
features = res.toArray(new Feature[res.size()]);
} else {
features = new Feature[0];
}
}
} else if (request.getSearchByCriterionRequest() != null) {
log.debug("CSV export using CriterionRequest");
FeatureSearchResponse result = (FeatureSearchResponse) dispatch.execute(FeatureSearchRequest.COMMAND,
request.getSearchByCriterionRequest(), token, locale);
if (result.isError()) {
response.getErrorMessages().addAll(result.getErrorMessages());
response.getErrors().addAll(result.getErrors());
} else {
List<Feature> res = result.getFeatureMap().get(request.getLayerId());
if (res != null) {
features = res.toArray(new Feature[res.size()]);
} else {
features = new Feature[0];
}