Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.RepositoryFilter


                final JsonParser parser = new JsonParser();
                final JsonElement messageJson = parser.parse(body);

                final Set<ObjectId> tracked = new HashSet<ObjectId>();

                RepositoryFilter filter = new RepositoryFilter();

                ObjectId commitId = ObjectId.NULL;

                if (messageJson.isJsonObject()) {
                    final JsonObject message = messageJson.getAsJsonObject();
                    final JsonArray trackedArray;
                    if (message.has("tracked") && message.get("tracked").isJsonArray()) {
                        trackedArray = message.get("tracked").getAsJsonArray();
                    } else {
                        trackedArray = new JsonArray();
                    }
                    if (message.has("commitId") && message.get("commitId").isJsonPrimitive()) {
                        commitId = ObjectId.valueOf(message.get("commitId").getAsJsonPrimitive()
                                .getAsString());
                    } else {
                        commitId = ObjectId.NULL;
                    }
                    for (final JsonElement e : trackedArray) {
                        if (e.isJsonPrimitive()) {
                            tracked.add(ObjectId.valueOf(e.getAsJsonPrimitive().getAsString()));
                        }
                    }

                    if (message.has("filter") && message.get("filter").isJsonArray()) {
                        JsonArray filterArray = message.get("filter").getAsJsonArray();
                        for (final JsonElement e : filterArray) {
                            if (e.isJsonObject()) {
                                JsonObject filterObject = e.getAsJsonObject();
                                String featureType = null;
                                String filterType = null;
                                String filterText = null;
                                if (filterObject.has("featurepath")
                                        && filterObject.get("featurepath").isJsonPrimitive()) {
                                    featureType = filterObject.get("featurepath")
                                            .getAsJsonPrimitive().getAsString();
                                }
                                if (filterObject.has("type")
                                        && filterObject.get("type").isJsonPrimitive()) {
                                    filterType = filterObject.get("type").getAsJsonPrimitive()
                                            .getAsString();
                                }
                                if (filterObject.has("filter")
                                        && filterObject.get("filter").isJsonPrimitive()) {
                                    filterText = filterObject.get("filter").getAsJsonPrimitive()
                                            .getAsString();
                                }
                                if (featureType != null && filterType != null && filterText != null) {
                                    filter.addFilter(featureType, filterType, filterText);
                                }
                            }
                        }

                    }
View Full Code Here

TOP

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

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.