Catalog catalog = getCatalog();
FeatureTypeInfo buildings = catalog.getFeatureTypeByName(getLayerId(SystemTestData.BUILDINGS));
// limits for mr readfilter
Filter fid113 = ff.equal(ff.property("FID"), ff.literal("113"), false);
tam.putLimits("cite_readfilter", buildings, new VectorAccessLimits(CatalogMode.HIDE, null,
fid113, null, null));
// limits for mr readatts (both limited read attributes and features)
List<PropertyName> readAtts = Arrays.asList(ff.property("the_geom"), ff.property("FID"));
tam.putLimits("cite_readatts", buildings, new VectorAccessLimits(CatalogMode.HIDE,
readAtts, fid113, null, null));
// limits the attributes, but specifies no filtering
tam.putLimits("cite_readattsnf", buildings, new VectorAccessLimits(CatalogMode.HIDE,
readAtts, Filter.INCLUDE, null, Filter.INCLUDE));
// disallow writing on Restricted Street
Filter restrictedStreet = ff.not(ff.like(ff.property("ADDRESS"), "*Restricted Street*", "*", "?",
"\\"));
tam.putLimits("cite_insertfilter", buildings, new VectorAccessLimits(CatalogMode.HIDE, null,
null, null, restrictedStreet));
// allows writing only on 113
tam.putLimits("cite_writefilter", buildings, new VectorAccessLimits(CatalogMode.HIDE, null,
null, null, fid113));
// disallow writing on the ADDRESS attribute
List<PropertyName> writeAtts = Arrays.asList(ff.property("the_geom"), ff.property("FID"));
tam.putLimits("cite_writeatts", buildings, new VectorAccessLimits(CatalogMode.HIDE, null,
null, writeAtts, null));
}