Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.NodeRef


        final SortedMap<NodeRef, NodeRef> changedTrees = treeDifference.findChanges();
        final SortedMap<NodeRef, NodeRef> filteredChangedTrees = changedTrees;// filterChanges(changedTrees);

        for (Map.Entry<NodeRef, NodeRef> changedTreeRefs : filteredChangedTrees.entrySet()) {

            NodeRef leftTreeRef = changedTreeRefs.getKey();
            NodeRef rightTreeRef = changedTreeRefs.getValue();
            String newPath = rightTreeRef.path();
            if (ignoreList.contains(newPath)) {
                continue;
            }
            if (!filterApplies(newPath, treeDifference.getRightTree())) {
                continue;
            }
            ignoreList.add(newPath);
            RevTree tree = applyChanges(leftTreeRef, rightTreeRef);

            Envelope bounds = SpatialOps.boundsOf(tree);
            Node newTreeNode = Node.create(rightTreeRef.name(), tree.getId(),
                    rightTreeRef.getMetadataId(), TYPE.TREE, bounds);

            MutableTree leftRoot = treeDifference.getLeftTree();
            String parentPath = rightTreeRef.getParentPath();
            leftRoot.setChild(parentPath, newTreeNode);
        }
    }
View Full Code Here


        for (; iterator.hasNext();) {
            final DiffEntry diff = iterator.next();
            if (diff.isDelete()) {
                builder.remove(diff.oldName());
            } else {
                NodeRef newObject = diff.getNewObject();
                Node node = newObject.getNode();
                builder.put(node);
            }
        }

        final RevTree newTree = builder.build();
View Full Code Here

            case ADDED:
                if (obj.isPresent()) {
                    TYPE type = command(ResolveObjectType.class).setObjectId(
                            diff.getNewObject().objectId()).call();
                    if (TYPE.TREE.equals(type)) {
                        NodeRef headVersion = command(FindTreeChild.class).setChildPath(path)
                                .setParent(repository.getOrCreateHeadTree()).call().get();
                        if (!headVersion.getMetadataId()
                                .equals(diff.getNewObject().getMetadataId())) {
                            report.addConflict(new Conflict(path, ObjectId.NULL, diff
                                    .getNewObject().getMetadataId(), headVersion.getMetadataId()));
                        }
                    } else {
                        if (!obj.get().getId().equals(diff.newObjectId())) {
                            report.addConflict(new Conflict(path, ObjectId.NULL,
                                    diff.newObjectId(), obj.get().getId()));
View Full Code Here

        return node;
    }

    public static DiffEntry readDiff(DataInput in) throws IOException {
        boolean oldNode = in.readBoolean();
        NodeRef oldNodeRef = null;
        if (oldNode) {
            oldNodeRef = readNodeRef(in);
        }
        boolean newNode = in.readBoolean();
        NodeRef newNodeRef = null;
        if (newNode) {
            newNodeRef = readNodeRef(in);
        }

        return new DiffEntry(oldNodeRef, newNodeRef);
View Full Code Here

    public static NodeRef readNodeRef(DataInput in) throws IOException {
        Node node = readNode(in);
        final byte[] metadataId = new byte[20];
        in.readFully(metadataId);
        String parentPath = in.readUTF();
        return new NodeRef(node, parentPath, ObjectId.createNoClone(metadataId));
    }
View Full Code Here

            this.metadataId = metadataId;
        }

        @Override
        public NodeRef apply(Node node) {
            return new NodeRef(node, treePath, node.getMetadataId().or(metadataId));
        }
View Full Code Here

                if (rightNode.getObjectId().equals(leftNode.getObjectId())) {
                    String leftParent = NodeRef.parentPath(left.getKey());
                    String rightParent = NodeRef.parentPath(right.getKey());

                    NodeRef leftRef = new NodeRef(leftNode, leftParent, ObjectId.NULL);
                    NodeRef rightRef = new NodeRef(rightNode, rightParent, ObjectId.NULL);
                    matches.put(leftRef, rightRef);
                }
            }
        }
        return matches;
View Full Code Here

            Node node = newTree.getValue().getNode();
            String parentPath = NodeRef.parentPath(newTree.getKey());
            // pass NULL to the NodeRef metadataId, to it defers to the one in the Node in case it
            // has one (see NodeRef.getMetadataId())
            ObjectId metadataId = ObjectId.NULL;
            NodeRef ref = new NodeRef(node, parentPath, metadataId);
            newTreeRefs.add(ref);
        }
        return newTreeRefs;
    }
View Full Code Here

            String nodePath = e.getKey();
            String parentPath = NodeRef.parentPath(nodePath);
            ValueDifference<MutableTree> vd = e.getValue();
            MutableTree left = vd.leftValue();
            MutableTree right = vd.rightValue();
            NodeRef lref = new NodeRef(left.getNode(), parentPath, ObjectId.NULL);
            NodeRef rref = new NodeRef(right.getNode(), parentPath, ObjectId.NULL);
            if (!pureMetadataChanges.containsKey(lref)) {
                matches.put(lref, rref);
            }
        }
        return matches;
View Full Code Here

            if (leftNode.equals(rightNode)) {
                final Optional<ObjectId> leftMetadata = leftNode.getMetadataId();
                final Optional<ObjectId> rightMetadata = rightNode.getMetadataId();
                if (!leftMetadata.equals(rightMetadata)) {
                    String parentPath = NodeRef.parentPath(nodePath);
                    NodeRef leftRef = new NodeRef(leftNode, parentPath, ObjectId.NULL);
                    NodeRef rightRef = new NodeRef(rightNode, parentPath, ObjectId.NULL);
                    matches.put(leftRef, rightRef);
                }
            }
        }
        return matches;
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.NodeRef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.