Search in sources :

Example 1 with ListTypeQuery

use of net.geoprism.registry.ListTypeQuery in project geoprism-registry by terraframe.

the class AttributeClassificationTest method cleanUpExtra.

@Request
public void cleanUpExtra() {
    ListTypeQuery query = new ListTypeQuery(new QueryFactory());
    OIterator<? extends ListType> it = query.getIterator();
    try {
        while (it.hasNext()) {
            it.next().delete();
        }
    } finally {
        it.close();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) ListTypeQuery(net.geoprism.registry.ListTypeQuery) Request(com.runwaysdk.session.Request)

Example 2 with ListTypeQuery

use of net.geoprism.registry.ListTypeQuery in project geoprism-registry by terraframe.

the class ListTypeInheritedHierarchyTest method cleanUpExtra.

@Request
public void cleanUpExtra() {
    ListTypeQuery query = new ListTypeQuery(new QueryFactory());
    OIterator<? extends ListType> it = query.getIterator();
    try {
        while (it.hasNext()) {
            it.next().delete();
        }
    } finally {
        it.close();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) ListTypeQuery(net.geoprism.registry.ListTypeQuery) Request(com.runwaysdk.session.Request)

Example 3 with ListTypeQuery

use of net.geoprism.registry.ListTypeQuery in project geoprism-registry by terraframe.

the class GeoObjectTypeMetadata method isReferencedInPublicListTypes.

private boolean isReferencedInPublicListTypes() {
    Universal uni = this.getUniversal();
    ServerGeoObjectType type = this.getServerType();
    QueryFactory qf = new QueryFactory();
    ListTypeVersionQuery versionQuery = new ListTypeVersionQuery(qf);
    versionQuery.WHERE(versionQuery.getListVisibility().EQ(ListType.PUBLIC));
    versionQuery.OR(versionQuery.getGeospatialVisibility().EQ(ListType.PUBLIC));
    ListTypeQuery mlq = new ListTypeQuery(qf);
    mlq.WHERE(mlq.EQ(versionQuery.getListType()));
    OIterator<? extends ListType> it = mlq.getIterator();
    while (it.hasNext()) {
        ListType list = it.next();
        if (list.getUniversal().getOid().equals(uni.getOid())) {
            PrivateTypeIsReferencedInPublicMasterLists ex = new PrivateTypeIsReferencedInPublicMasterLists();
            ex.setTypeLabel(this.getServerType().getLabel().getValue());
            throw ex;
        } else {
            JsonArray hierarchies = list.getHierarchiesAsJson();
            for (int i = 0; i < hierarchies.size(); i++) {
                JsonObject hierarchy = hierarchies.get(i).getAsJsonObject();
                JsonArray parents = hierarchy.get("parents").getAsJsonArray();
                for (int j = 0; j < parents.size(); ++j) {
                    JsonObject parent = parents.get(j).getAsJsonObject();
                    if (parent.has("selected") && parent.get("selected").getAsBoolean()) {
                        if (parent.has("code") && parent.get("code").getAsString().equals(type.getCode())) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : JsonArray(com.google.gson.JsonArray) Universal(com.runwaysdk.system.gis.geo.Universal) QueryFactory(com.runwaysdk.query.QueryFactory) PrivateTypeIsReferencedInPublicMasterLists(net.geoprism.registry.geoobjecttype.PrivateTypeIsReferencedInPublicMasterLists) ListType(net.geoprism.registry.ListType) ListTypeQuery(net.geoprism.registry.ListTypeQuery) JsonObject(com.google.gson.JsonObject) ListTypeVersionQuery(net.geoprism.registry.ListTypeVersionQuery)

Aggregations

QueryFactory (com.runwaysdk.query.QueryFactory)3 ListTypeQuery (net.geoprism.registry.ListTypeQuery)3 Request (com.runwaysdk.session.Request)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 Universal (com.runwaysdk.system.gis.geo.Universal)1 ListType (net.geoprism.registry.ListType)1 ListTypeVersionQuery (net.geoprism.registry.ListTypeVersionQuery)1 PrivateTypeIsReferencedInPublicMasterLists (net.geoprism.registry.geoobjecttype.PrivateTypeIsReferencedInPublicMasterLists)1