if (!editable) {
return null;
}
FeatureType featureType = null;
MapServiceInstance instance = (MapServiceInstance) mapService
.getMapServicePool().checkoutIdleInstance();
try {
Layer layer = instance.getMap().getLayer(nLayerId);
featureType = layer.getMapLayer().getFeatureSource()
.getSchema();
} finally {
if (instance != null) {
mapService.getMapServicePool().checkinIdelInstance(
instance);
}
}
// Handle features
FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = EsriJsonUtil
.json2FeatureCollection(features,
(SimpleFeatureType) featureType);
instance = (MapServiceInstance) mapService.getMapServicePool()
.checkoutIdleInstance();
HashMap<FeatureId, Boolean> updates = null;
try {
Layer layer = instance.getMap().getLayer(nLayerId);
updates = layer.update(featureCollection);
} finally {
if (instance != null) {
mapService.getMapServicePool().checkinIdelInstance(
instance);