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();
}
}
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();
}
}
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;
}
Aggregations