Filter filter;
List<InternalFeature> oldFeatures;
List<InternalFeature> newFeatures;
InternalFeature feature;
CoordinateReferenceSystem crs = beanLayer.getCrs();
GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel());
Geometry geometry;
login("marino");
oldFeatures = new ArrayList<InternalFeature>();
newFeatures = new ArrayList<InternalFeature>();
feature = converterService.toInternal(new Feature());
feature.setId("4");
feature.setLayer(beanLayer);
// feature needs a geometry or exceptions all over
geometry = geometryFactory.createPoint(new Coordinate(1.5, 1.5));
feature.setGeometry(geometry);
newFeatures.add(feature);
try {
layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
Assert.fail("create should have failed");
} catch (GeomajasSecurityException gse) {
Assert.assertEquals(ExceptionCode.FEATURE_CREATE_PROHIBITED, gse.getExceptionCode());
}
filter = filterService.createFidFilter(new String[]{"4"});
oldFeatures = layerService.getFeatures(LAYER_ID,
crs, filter, null, VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES);
Assert.assertEquals(0, oldFeatures.size());
login("luc");
oldFeatures = new ArrayList<InternalFeature>();
newFeatures = new ArrayList<InternalFeature>();
feature = converterService.toInternal(new Feature());
feature.setId("4");
feature.setLayer(beanLayer);
// feature needs a geometry or exceptions all over
geometry = geometryFactory.createPoint(new Coordinate(1.5, 1.5));
feature.setGeometry(geometry);
newFeatures.add(feature);
layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
filter = filterService.createFidFilter(new String[]{"4"});
oldFeatures = layerService.getFeatures(LAYER_ID,