/** * Determines if a specific feature type is versioned (existing in the main repository). * * @param treePath feature type to check * @return true if the feature type is versioned, false otherwise. */ @Override public boolean hasRoot(final String treePath) { Optional<NodeRef> typeNameTreeRef = context.command(FindTreeChild.class) .setChildPath(treePath).call(); return typeNameTreeRef.isPresent(); }
/** * Determines if a specific feature type is versioned (existing in the main repository). * * @param treePath feature type to check * @return true if the feature type is versioned, false otherwise. */ @Override public boolean hasRoot(final String treePath) { Optional<NodeRef> typeNameTreeRef = context.command(FindTreeChild.class) .setChildPath(treePath).call(); return typeNameTreeRef.isPresent(); }
/** * @param path the path to search for * @return an {@link Optional} of the {@link Node} for the child, or {@link Optional#absent()} * if it wasn't found */ @Override public Optional<Node> getRootTreeChild(String path) { Optional<NodeRef> nodeRef = command(FindTreeChild.class).setChildPath(path).call(); if (nodeRef.isPresent()) { return Optional.of(nodeRef.get().getNode()); } else { return Optional.absent(); } }
private NodeRef resolTypeTreeRef(final String refspec, final String treePath, final RevTree rootTree) { Optional<NodeRef> typeTreeRef = command(FindTreeChild.class).setParent(rootTree) .setChildPath(treePath).call(); checkArgument(typeTreeRef.isPresent(), "Type tree %s does not exist", refspec); checkArgument(TYPE.TREE.equals(typeTreeRef.get().getType()), "%s did not resolve to a tree", refspec); return typeTreeRef.get(); }
private NodeRef resolTypeTreeRef(final String refspec, final String treePath, final RevTree rootTree) { Optional<NodeRef> typeTreeRef = command(FindTreeChild.class).setParent(rootTree) .setChildPath(treePath).call(); checkArgument(typeTreeRef.isPresent(), "Type tree %s does not exist", refspec); checkArgument(TYPE.TREE.equals(typeTreeRef.get().getType()), "%s did not resolve to a tree", refspec); return typeTreeRef.get(); }
private NodeRef resolTypeTreeRef(final String refspec, final String treePath, final RevTree rootTree) { Optional<NodeRef> typeTreeRef = command(FindTreeChild.class).setParent(rootTree) .setChildPath(treePath).call(); checkArgument(typeTreeRef.isPresent(), "Type tree %s does not exist", refspec); checkArgument(TYPE.TREE.equals(typeTreeRef.get().getType()), "%s did not resolve to a tree", refspec); return typeTreeRef.get(); }
private NodeRef resolTypeTreeRef(final String refspec, final String treePath, final RevTree rootTree) { Optional<NodeRef> typeTreeRef = command(FindTreeChild.class).setParent(rootTree) .setChildPath(treePath).call(); checkArgument(typeTreeRef.isPresent(), "Type tree %s does not exist", refspec); checkArgument(TYPE.TREE.equals(typeTreeRef.get().getType()), "%s did not resolve to a tree", refspec); return typeTreeRef.get(); }
private ObjectId getPathHash(RevTree tree, String path) { ObjectId hash = ObjectId.NULL; Optional<NodeRef> ref = findTreeChild.setChildPath(path).setParent(tree).call(); if (ref.isPresent()) { hash = ref.get().getNode().getObjectId(); } return hash; } }
private ObjectId getPathHash(RevTree tree, String path) { ObjectId hash = ObjectId.NULL; Optional<NodeRef> ref = findTreeChild.setChildPath(path).setParent(tree).call(); if (ref.isPresent()) { hash = ref.get().getNode().getObjectId(); } return hash; } }
private Optional<Node> findTreeChild(RevTree root, String pathRemove) { Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(root) .setChildPath(pathRemove).call(); Optional<Node> node = Optional.absent(); if (nodeRef.isPresent()) { node = Optional.of(nodeRef.get().getNode()); } return node; } }
private Optional<Node> findTreeChild(RevTree root, String pathRemove) { Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(root) .setChildPath(pathRemove).call(); Optional<Node> node = Optional.absent(); if (nodeRef.isPresent()) { node = Optional.of(nodeRef.get().getNode()); } return node; }
private Optional<Node> findTreeChild(RevTree root, String pathRemove) { Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(root) .setChildPath(pathRemove).call(); Optional<Node> node = Optional.absent(); if (nodeRef.isPresent()) { node = Optional.of(nodeRef.get().getNode()); } return node; }
private Optional<Node> findTreeChild(RevTree root, String pathRemove) { Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(root) .setChildPath(pathRemove).call(); Optional<Node> node = Optional.absent(); if (nodeRef.isPresent()) { node = Optional.of(nodeRef.get().getNode()); } return node; } }
private NodeRef putFeatures(NodeRef layer, int featureCount) { List<FeatureInfo> features = createFeatures(layer, featureCount); repo.workingTree().insert(features.iterator(), new DefaultProgressListener()); Optional<NodeRef> ref = repo.command(FindTreeChild.class) .setParent(repo.workingTree().getTree()).setChildPath(layer.path()).call(); assertTrue(ref.isPresent()); return ref.get(); }
@Test public void testImportTable() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); importOp.setAll(false); importOp.setTable("table1"); RevTree newWorkingTree = importOp.call(); Optional<NodeRef> ref = geogig.command(FindTreeChild.class).setParent(newWorkingTree) .setChildPath("table1/feature1").call(); assertTrue(ref.isPresent()); ref = geogig.command(FindTreeChild.class).setParent(newWorkingTree) .setChildPath("table1/feature2").call(); assertTrue(ref.isPresent()); }
@Test public void testCreateTypeTreeAutomaticallyWhenInsertingWitNoExistingTypeTree() throws Exception { insert(points1, points2); Optional<NodeRef> treeRef = repo.command(FindTreeChild.class).setChildPath(pointsName) .setParent(workTree.getTree()).call(); assertTrue(treeRef.isPresent()); assertTrue(treeRef.get().getNode().getMetadataId().isPresent()); assertFalse(treeRef.get().getNode().getMetadataId().get().isNull()); RevFeatureType featureType = repo.objectDatabase() .getFeatureType(treeRef.get().getMetadataId()); assertEquals(pointsType, featureType.type()); }
@Test public void testRevertOnlyCommit() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c1.getId())).call(); final Optional<Ref> currHead = geogig.command(RefParse.class).setName(Ref.HEAD).call(); final Optional<ObjectId> headTreeId = geogig.command(ResolveTreeish.class) .setTreeish(currHead.get().getObjectId()).call(); RevTree headTree = repo.getTree(headTreeId.get()); Optional<NodeRef> points1Node = geogig.command(FindTreeChild.class) .setChildPath(NodeRef.appendChild(pointsName, idP1)).setParent(headTree).call(); assertFalse(points1Node.isPresent()); }
@Test public void testCheckoutPathFilter() throws Exception { ObjectId points1Id = insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insert(points1_modified); CheckoutResult result = geogig.command(CheckoutOp.class).addPath("Points/Points.1").call(); Optional<RevTree> workTree = geogig.command(RevObjectParse.class) .setObjectId(result.getNewTree()).call(RevTree.class); Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()) .setChildPath("Points/Points.1").call(); assertEquals(points1Id, nodeRef.get().getNode().getObjectId()); }
@Test public void testRevertOnlyCommit() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); final Optional<Ref> currHead = geogig.command(RefParse.class).setName(Ref.HEAD).call(); final Optional<ObjectId> headTreeId = geogig.command(ResolveTreeish.class) .setTreeish(currHead.get().getObjectId()).call(); RevTree headTree = repo.getTree(headTreeId.get()); Optional<NodeRef> points1Node = geogig.command(FindTreeChild.class) .setChildPath(NodeRef.appendChild(pointsName, idP1)).setParent(headTree).call(); assertFalse(points1Node.isPresent()); }
@Test public void testCheckoutPathFilter() throws Exception { ObjectId points1Id = insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insert(points1_modified); CheckoutResult result = geogig.command(CheckoutOp.class).addPath("Points/Points.1").call(); Optional<RevTree> workTree = geogig.command(RevObjectParse.class) .setObjectId(result.getNewTree()).call(RevTree.class); Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()) .setChildPath("Points/Points.1").call(); assertEquals(points1Id, nodeRef.get().getNode().getObjectId()); }