throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "featureTransaction.layerId");
}
if (null == request.getCrs()) {
throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs");
}
FeatureTransaction featureTransaction = request.getFeatureTransaction();
if (featureTransaction == null) {
return;
}
List<InternalFeature> oldFeatures = new ArrayList<InternalFeature>();
List<InternalFeature> newFeatures = new ArrayList<InternalFeature>();
if (featureTransaction.getOldFeatures() != null) {
for (int i = 0; i < featureTransaction.getOldFeatures().length; i++) {
oldFeatures.add(converter.toInternal(featureTransaction.getOldFeatures()[i]));
}
}
if (featureTransaction.getNewFeatures() != null) {
for (int i = 0; i < featureTransaction.getNewFeatures().length; i++) {
newFeatures.add(converter.toInternal(featureTransaction.getNewFeatures()[i]));
}
}
layerService.saveOrUpdate(featureTransaction.getLayerId(), geoService.getCrs(request.getCrs()), oldFeatures,
newFeatures);
// Apply the new set of InternalFeatures onto the transaction: (ID may be filled in now)
if (featureTransaction.getNewFeatures() != null) {
Feature[] resultFeatures = new Feature[newFeatures.size()];
for (int i = 0; i < newFeatures.size(); i++) {
InternalFeature internalFeature = newFeatures.get(i);
resultFeatures[i] = converter.toDto(internalFeature);
}
featureTransaction.setNewFeatures(resultFeatures);
}
response.setFeatureTransaction(featureTransaction);
}