/** * @return the {@link RevObject.TYPE} of the new object, or {@code null} if there isn't one */ public TYPE newObjectType() { NodeRef newObject = getNewObject(); return newObject != null ? newObject.getType() : null; }
/** * @return the {@link RevObject.TYPE} of the old object, or {@code null} if there isn't one */ public TYPE oldObjectType() { NodeRef oldObject = getOldObject(); return oldObject != null ? oldObject.getType() : null; }
/** * @return the {@link RevObject.TYPE} of the old object, or {@code null} if there isn't one */ public TYPE oldObjectType() { NodeRef oldObject = getOldObject(); return oldObject != null ? oldObject.getType() : null; }
public UpdateTree setChild(NodeRef childTreeNode) { checkNotNull(childTreeNode); final String path = childTreeNode.path(); NodeRef.checkValidPath(path); checkArgument(RevObject.TYPE.TREE.equals(childTreeNode.getType())); childTreeRemoves.remove(path); childTreeUpdates.put(path, childTreeNode); return this; }
public UpdateTree setChild(NodeRef childTreeNode) { checkNotNull(childTreeNode); final String path = childTreeNode.path(); NodeRef.checkValidPath(path); checkArgument(RevObject.TYPE.TREE.equals(childTreeNode.getType())); childTreeRemoves.remove(path); childTreeUpdates.put(path, childTreeNode); return this; }
public RevTreeBuilder getTreeBuilder(final NodeRef featureRef) { checkArgument(TYPE.FEATURE.equals(featureRef.getType())); final String typeTreePath = featureRef.getParentPath(); RevTreeBuilder typeTreeBuilder; typeTreeBuilder = featureTypeTrees.computeIfAbsent(typeTreePath, path -> newTreeBuilder(featureRef)); return typeTreeBuilder; }
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(); }
public void addUnconflicted(DiffEntry diff) { TreeReport treeReport = parentReport(diff.path()); TYPE type = (diff.isAdd() ? diff.getNewObject() : diff.getOldObject()).getType(); if (TYPE.FEATURE == type) { treeReport.unconflictedFeatures.incrementAndGet(); } else { treeReport.unconflictedTrees.incrementAndGet(); } }
@Override public boolean apply(@Nullable DiffEntry input) { // HACK: avoid reporting changed trees if (input.isChange() && input.getOldObject().getType().equals(TYPE.TREE)) { return false; } return input.getOldObject() != null; } });
@Override public boolean apply(@Nullable DiffEntry input) { // HACK: avoid reporting changed trees if (input.isChange() && input.getOldObject().getType().equals(TYPE.TREE)) { return false; } return input.getOldObject() != null; } });
public Name getDescriptorName(NodeRef treeRef) { Preconditions.checkNotNull(treeRef); Preconditions.checkArgument(TYPE.TREE.equals(treeRef.getType())); Preconditions.checkArgument(!treeRef.getMetadataId().isNull(), "NodeRef '%s' is not a feature type reference", treeRef.path()); return new NameImpl(getNamespaceURI(), NodeRef.nodeFromPath(treeRef.path())); }
@Override public boolean apply(NodeRef ref) { TYPE type = ref.getType(); String path = ref.path(); return TYPE.TREE.equals(type) && treePath.equals(path); } }
@Override public boolean apply(NodeRef ref) { TYPE type = ref.getType(); String path = ref.path(); return TYPE.TREE.equals(type) && treePath.equals(path); } }
private void assertNode(Optional<NodeRef> ref, TYPE type, ObjectId expectedMdId, String path) { assertTrue(ref.isPresent()); assertEquals(type, ref.get().getType()); assertEquals(path, ref.get().path()); assertEquals(expectedMdId, ref.get().getMetadataId()); } }
@Test public void testTreeModifiedByAddingExtraFeature() throws Exception { insertAndAdd(points1, points2); insert(points3); List<DiffEntry> difflist = toList(diffOp.setReportTrees(true).call()); assertNotNull(difflist); assertEquals(2, difflist.size()); assertEquals(ChangeType.MODIFIED, difflist.get(0).changeType()); assertEquals(TYPE.TREE, difflist.get(0).getOldObject().getType()); assertEquals(ChangeType.ADDED, difflist.get(1).changeType()); assertEquals(TYPE.FEATURE, difflist.get(1).getNewObject().getType()); }
@Test public void testTreeModifiedByAddingExtraFeature() throws Exception { insertAndAdd(points1, points2); insert(points3); List<DiffEntry> difflist = toList(diffOp.setReportTrees(true).call()); assertNotNull(difflist); assertEquals(2, difflist.size()); assertEquals(ChangeType.MODIFIED, difflist.get(0).changeType()); assertEquals(TYPE.TREE, difflist.get(0).getOldObject().getType()); assertEquals(ChangeType.ADDED, difflist.get(1).changeType()); assertEquals(TYPE.FEATURE, difflist.get(1).getNewObject().getType()); }
@Test public void testAddMultipleFeaturesWithPathFilter() throws Exception { insert(points1); insert(points2); insert(lines1); geogig.command(AddOp.class).addPattern("Points").call(); List<DiffEntry> unstaged = toList(repo.workingTree().getUnstaged(null)); assertEquals(2, unstaged.size()); assertEquals(linesName, unstaged.get(0).newName()); assertEquals(ChangeType.ADDED, unstaged.get(0).changeType()); assertEquals(TYPE.TREE, unstaged.get(0).getNewObject().getType()); }