use of com.revolsys.record.io.format.esri.rest.CatalogElement in project com.revolsys.open by revolsys.
the class ArcGisRestAbstractLayerService method addLayer.
public LayerDescription addLayer(final CatalogElement parent, final Map<String, LayerDescription> layersByName, MapEx layerProperties) {
final int id = layerProperties.getInteger("id");
final Resource resource = getResource(Integer.toString(id), ArcGisResponse.FORMAT_PARAMETER);
try {
layerProperties = Json.toMap(resource);
final String layerType = layerProperties.getString("type");
final Function3<ArcGisRestAbstractLayerService, CatalogElement, MapEx, LayerDescription> factory = LAYER_FACTORY_BY_TYPE.get(layerType);
LayerDescription layer;
if (factory == null) {
layer = new LayerDescription(this, parent, layerProperties);
} else {
layer = factory.apply(this, parent, layerProperties);
}
final String name = layer.getName();
if (Property.hasValue(name)) {
layersByName.put(name.toLowerCase(), layer);
return layer;
} else {
return null;
}
} catch (final Throwable e) {
e.printStackTrace();
Logs.debug(this, "Unable to initialize layer: " + resource, e);
return null;
}
}
Aggregations