Package org.locationtech.geogig.repository

Examples of org.locationtech.geogig.repository.WorkingTree


        insertAndAdd(points1, points2);
        geogig.command(CommitOp.class).call();

        // insertAndAdd(lines1, lines2);

        WorkingTree workingTree = geogig.getRepository().workingTree();
        final String emptyTreeName = "emptyTree";

        workingTree.createTypeTree(emptyTreeName, pointsType);
        {
            List<DiffEntry> unstaged = toList(workingTree.getUnstaged(null));
            assertEquals(unstaged.toString(), 1, unstaged.size());
            // assertEquals(NodeRef.ROOT, unstaged.get(0).newName());
            assertEquals(emptyTreeName, unstaged.get(0).newName());
        }
        geogig.command(AddOp.class).call();
View Full Code Here


        final RevTree tree1 = geogig.command(RevObjectParse.class).setObjectId(commit1.getTreeId())
                .call(RevTree.class).get();
        assertTrue(tree1.trees().isPresent());
        assertEquals(2, tree1.trees().get().size());

        WorkingTree workingTree = geogig.getRepository().workingTree();
        workingTree.delete(pointsName);
        geogig.command(AddOp.class).call();

        final RevCommit commit2 = geogig.command(CommitOp.class).call();

        RevTree tree2 = geogig.command(RevObjectParse.class).setObjectId(commit2.getTreeId())
View Full Code Here

    /**
     * Inserts the feature to the index but does not stages it to be committed
     */
    public ObjectId insert(GeogigTransaction transaction, Feature f) throws Exception {
        final WorkingTree workTree = (transaction != null ? transaction.workingTree() : repo
                .workingTree());
        Name name = f.getType().getName();
        String parentPath = name.getLocalPart();
        Node ref = workTree.insert(parentPath, f);
        ObjectId objectId = ref.getObjectId();
        return objectId;
    }
View Full Code Here

    public boolean delete(Feature f) throws Exception {
        return delete(null, f);
    }

    public boolean delete(GeogigTransaction transaction, Feature f) throws Exception {
        final WorkingTree workTree = (transaction != null ? transaction.workingTree() : repo
                .workingTree());
        Name name = f.getType().getName();
        String localPart = name.getLocalPart();
        String id = f.getIdentifier().getID();
        boolean existed = workTree.delete(localPart, id);
        return existed;
    }
View Full Code Here

            String treePath = featureType.getName().getLocalPart();
            // check out the datastore branch on the transaction space
            final String branch = getOrFigureOutBranch();
            tx.command(CheckoutOp.class).setForce(true).setSource(branch).call();
            // now we can use the transaction working tree with the correct branch checked out
            WorkingTree workingTree = tx.workingTree();
            workingTree.createTypeTree(treePath, featureType);
            tx.command(AddOp.class).addPattern(treePath).call();
            tx.command(CommitOp.class).setMessage("Created feature type tree " + treePath).call();
            tx.commit();
        } catch (IllegalArgumentException alreadyExists) {
            abort = true;
View Full Code Here

    public void testMappingWays() throws Exception {
        // import and check that we have both ways and nodes
        String filename = OSMImportOp.class.getResource("ways.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // Define mapping
View Full Code Here

    public void testMappingDefaultFields() throws Exception {
        // import and check that we have both ways and nodes
        String filename = OSMImportOp.class.getResource("ways.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // Define mapping
View Full Code Here

    public void testMappingOnlyClosedPolygons() throws Exception {
        // import and check that we have both ways and nodes
        String filename = OSMImportOp.class.getResource("ways_restriction.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // Define mapping
View Full Code Here

    public void testExcludePoligonsWithLessThan3Points() throws Exception {
        // import and check that we have both ways and nodes
        String filename = OSMImportOp.class.getResource("ways_restriction.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // Define mapping
View Full Code Here

    public void testMappingOnlyOpenLines() throws Exception {
        // import and check that we have both ways and nodes
        String filename = OSMImportOp.class.getResource("ways_restriction.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // Define mapping
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.repository.WorkingTree

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.