use of org.locationtech.geogig.geotools.data.GeoGigDataStore.ChangeType in project GeoGig by boundlessgeo.
the class GeogigFeatureSource method getNativeReader.
/**
* @param propertyNames properties to retrieve, empty array for no properties at all
* {@link Query#NO_NAMES}, {@code null} means all properties {@link Query#ALL_NAMES}
*/
private FeatureReader<SimpleFeatureType, SimpleFeature> getNativeReader(@Nullable String[] propertyNames, Filter filter, @Nullable Integer offset, @Nullable Integer maxFeatures, @Nullable final ScreenMap screenMap) {
if (screenMap == null) {
LOGGER.trace("GeoGigFeatureSource.getNativeReader: no screenMap provided");
} else {
LOGGER.trace("GeoGigFeatureSource.getNativeReader: using screenMap filter");
}
LOGGER.trace("Query filter: {}", filter);
filter = (Filter) filter.accept(new SimplifyingFilterVisitor(), null);
LOGGER.trace("Simplified filter: {}", filter);
GeogigFeatureReader<SimpleFeatureType, SimpleFeature> nativeReader;
final String rootRef = getRootRef();
final String featureTypeTreePath = getTypeTreePath();
final SimpleFeatureType fullType = getSchema();
boolean ignoreAttributes = false;
if (propertyNames != null && propertyNames.length == 0) {
String[] inProcessFilteringAttributes = Filters.attributeNames(filter, fullType);
ignoreAttributes = inProcessFilteringAttributes.length == 0;
}
final String compareRootRef = oldRoot();
final GeoGigDataStore.ChangeType changeType = changeType();
final Context context = getCommandLocator();
nativeReader = new GeogigFeatureReader<SimpleFeatureType, SimpleFeature>(context, fullType, filter, featureTypeTreePath, rootRef, compareRootRef, changeType, offset, maxFeatures, screenMap, ignoreAttributes);
return nativeReader;
}
use of org.locationtech.geogig.geotools.data.GeoGigDataStore.ChangeType in project GeoGig by boundlessgeo.
the class GeoGigDataStoreTest method testDiffFeatures.
private void testDiffFeatures(ObjectId oldRoot, ObjectId newRoot, int expectedAdded, int expectedRemoved, int expectedChanged) throws IOException {
dataStore.setHead(newRoot.toString());
List<String> fids;
SimpleFeatureCollection features;
ChangeType changeType = ChangeType.ADDED;
features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType).getFeatures();
fids = toIdList(features);
assertEquals(changeType + fids.toString(), expectedAdded, fids.size());
assertEquals(changeType + fids.toString(), expectedAdded, features.size());
changeType = ChangeType.REMOVED;
features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType).getFeatures();
fids = toIdList(features);
assertEquals(changeType + fids.toString(), expectedRemoved, fids.size());
assertEquals(changeType + fids.toString(), expectedRemoved, features.size());
changeType = ChangeType.CHANGED_NEW;
features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType).getFeatures();
fids = toIdList(features);
assertEquals(changeType + fids.toString(), expectedChanged, fids.size());
assertEquals(changeType + fids.toString(), expectedChanged, features.size());
changeType = ChangeType.CHANGED_OLD;
features = dataStore.getDiffFeatureSource(pointsName, oldRoot.toString(), changeType).getFeatures();
fids = toIdList(features);
assertEquals(changeType + fids.toString(), expectedChanged, fids.size());
assertEquals(changeType + fids.toString(), expectedChanged, features.size());
}
Aggregations