Package org.locationtech.geogig.api.plumbing

Examples of org.locationtech.geogig.api.plumbing.ForEachRef


    public void runInternal(GeogigCLI cli) throws IOException {

        ConsoleReader console = cli.getConsole();
        GeoGIG geogig = cli.getGeogig();

        ForEachRef op = geogig.command(ForEachRef.class);

        Predicate<Ref> filter = new Predicate<Ref>() {
            @Override
            public boolean apply(Ref ref) {
                String name = ref.getName();
                if (!name.startsWith(Ref.REFS_PREFIX)) {
                    return false;
                }
                boolean match = patterns.isEmpty() ? true : false;
                for (String pattern : patterns) {
                    if (Strings.isNullOrEmpty(pattern)) {
                        match = true;
                    } else if (name.endsWith("/" + pattern)) {
                        match = true;
                        break;
                    }
                }
                return match;
            }
        };
        op.setFilter(filter);

        ImmutableSet<Ref> refs = op.call();

        for (Ref ref : refs) {
            console.println(ref.getObjectId() + " " + ref.getName());
        }
    }
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.plumbing.ForEachRef

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.