/** * Adds an element to the list of modified ones * * @param diff */ public void addModifiedFeature(FeatureDiff diff) { modifiedFeatures.add(diff); addFeatureType(diff.getNewFeatureType()); addFeatureType(diff.getOldFeatureType()); }
/** * Adds an element to the list of modified ones * * @param diff */ public void addModifiedFeature(FeatureDiff diff) { modifiedFeatures.add(diff); addFeatureType(diff.getNewFeatureType()); addFeatureType(diff.getOldFeatureType()); }
/** * Adds a feature to the list of removed ones * * @param path the path of the removed feature * @param feature the feature * @param featureType the feature type of the removed feature */ public void addRemovedFeature(String path, RevFeature feature, RevFeatureType featureType) { removedFeatures.add(FeatureInfo.insert(feature, featureType.getId(), path)); addFeatureType(featureType); }
/** * Adds a feature to the list of newly added ones * * @param path the path of the added feature * @param feature the feature * @param featureType the feature type of the added feature */ public void addAddedFeature(String path, RevFeature feature, RevFeatureType featureType) { addedFeatures.add(FeatureInfo.insert(feature, featureType.getId(), path)); addFeatureType(featureType); }
/** * Adds a feature to the list of newly added ones * * @param path the path of the added feature * @param feature the feature * @param featureType the feature type of the added feature */ public void addAddedFeature(String path, RevFeature feature, RevFeatureType featureType) { addedFeatures.add(FeatureInfo.insert(feature, featureType.getId(), path)); addFeatureType(featureType); }
/** * Adds a feature to the list of removed ones * * @param path the path of the removed feature * @param feature the feature * @param featureType the feature type of the removed feature */ public void addRemovedFeature(String path, RevFeature feature, RevFeatureType featureType) { removedFeatures.add(FeatureInfo.insert(feature, featureType.getId(), path)); addFeatureType(featureType); }
@Test public void testModifiedEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); RevFeatureType modifiedFeatureType = RevFeatureTypeBuilder.build(modifiedPointsType); patch.addFeatureType(featureType); patch.addFeatureType(modifiedFeatureType); patch.addAlteredTree( new FeatureTypeDiff(pointsName, featureType.getId(), modifiedFeatureType.getId())); testPatch(patch); }
@Test public void testModifiedEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); RevFeatureType modifiedFeatureType = RevFeatureType.builder().type(modifiedPointsType) .build(); patch.addFeatureType(featureType); patch.addFeatureType(modifiedFeatureType); patch.addAlteredTree( new FeatureTypeDiff(pointsName, featureType.getId(), modifiedFeatureType.getId())); testPatch(patch); }
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); testPatch(patch); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); testPatch(patch); }
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); testPatch(patch); }
@Test public void testRemoveFeatureAttributePatch() throws Exception { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1B.getProperty("extra").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, null); map.put(modifiedPointsType.getDescriptor("extra"), diff); FeatureDiff featureDiff = new FeatureDiff(path, map, RevFeatureTypeBuilder.build(modifiedPointsType), RevFeatureTypeBuilder.build(pointsType)); patch.addModifiedFeature(featureDiff); patch.addFeatureType(RevFeatureTypeBuilder.build(pointsType)); testPatch(patch); }
@Test public void testAddFeatureAttributePatch() throws Exception { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object newValue = points1B.getProperty("extra").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(null, newValue); map.put(modifiedPointsType.getDescriptor("extra"), diff); FeatureDiff featureDiff = new FeatureDiff(path, map, RevFeatureTypeBuilder.build(pointsType), RevFeatureTypeBuilder.build(modifiedPointsType)); patch.addModifiedFeature(featureDiff); patch.addFeatureType(RevFeatureTypeBuilder.build(modifiedPointsType)); testPatch(patch); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); testPatch(patch); }
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTreeId = findTreeChild(root, pointsName); RevTree typeTree = repo.getTree(typeTreeId.get().getObjectId()); assertNotNull(typeTree); assertEquals(featureType.getId(), typeTreeId.get().getMetadataId().get()); }
@Test public void testAddEmptyFeatureTypePatch() throws Exception { Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId())); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTreeId = findTreeChild(root, pointsName); RevTree typeTree = repo.getTree(typeTreeId.get().getObjectId()); assertNotNull(typeTree); assertEquals(featureType.getId(), typeTreeId.get().getMetadataId().get()); }
@Test public void testRemoveFeatureAttributePatch() throws Exception { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1B.getProperty("extra").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, null); map.put(modifiedPointsType.getDescriptor("extra"), diff); FeatureDiff featureDiff = new FeatureDiff(path, map, RevFeatureType.builder().type(modifiedPointsType).build(), RevFeatureType.builder().type(pointsType).build()); patch.addModifiedFeature(featureDiff); patch.addFeatureType(RevFeatureType.builder().type(pointsType).build()); testPatch(patch); }
@Test public void testAddFeatureAttributePatch() throws Exception { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object newValue = points1B.getProperty("extra").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(null, newValue); map.put(modifiedPointsType.getDescriptor("extra"), diff); FeatureDiff featureDiff = new FeatureDiff(path, map, RevFeatureType.builder().type(pointsType).build(), RevFeatureType.builder().type(modifiedPointsType).build()); patch.addModifiedFeature(featureDiff); patch.addFeatureType(RevFeatureType.builder().type(modifiedPointsType).build()); testPatch(patch); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { WorkingTree workingTree = geogig.getRepository().workingTree(); workingTree.createTypeTree(pointsName, pointsType); geogig.command(AddOp.class).setUpdateOnly(false).call(); Patch patch = new Patch(); RevFeatureType featureType = RevFeatureTypeBuilder.build(pointsType); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTree = findTreeChild(root, pointsName); assertFalse(typeTree.isPresent()); }
@Test public void testRemoveEmptyFeatureTypePatch() throws Exception { WorkingTree workingTree = geogig.getRepository().workingTree(); workingTree.createTypeTree(pointsName, pointsType); geogig.command(AddOp.class).setUpdateOnly(false).call(); Patch patch = new Patch(); RevFeatureType featureType = RevFeatureType.builder().type(pointsType).build(); patch.addFeatureType(featureType); patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null)); geogig.command(ApplyPatchOp.class).setPatch(patch).call(); RevTree root = repo.workingTree().getTree(); assertNotNull(root); Optional<Node> typeTree = findTreeChild(root, pointsName); assertFalse(typeTree.isPresent()); }