use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class InheritedHierarchyAnnotation method getByUniversal.
public static List<? extends InheritedHierarchyAnnotation> getByUniversal(Universal universal) {
InheritedHierarchyAnnotationQuery query = new InheritedHierarchyAnnotationQuery(new QueryFactory());
query.WHERE(query.getUniversal().EQ(universal));
try (OIterator<? extends InheritedHierarchyAnnotation> iterator = query.getIterator()) {
return iterator.getAll();
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class InheritedHierarchyAnnotation method getByRelationship.
public static List<? extends InheritedHierarchyAnnotation> getByRelationship(HierarchicalRelationshipType hierarchicalRelationship) {
InheritedHierarchyAnnotationQuery query = new InheritedHierarchyAnnotationQuery(new QueryFactory());
query.WHERE(query.getInheritedHierarchicalRelationshipType().EQ(hierarchicalRelationship));
query.OR(query.getForHierarchicalRelationshipType().EQ(hierarchicalRelationship));
try (OIterator<? extends InheritedHierarchyAnnotation> iterator = query.getIterator()) {
return iterator.getAll();
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class InheritedHierarchyAnnotation method get.
public static InheritedHierarchyAnnotation get(Universal universal, HierarchicalRelationshipType forRelationship) {
InheritedHierarchyAnnotationQuery query = new InheritedHierarchyAnnotationQuery(new QueryFactory());
query.WHERE(query.getUniversal().EQ(universal));
query.AND(query.getForHierarchicalRelationshipType().EQ(forRelationship));
try (OIterator<? extends InheritedHierarchyAnnotation> iterator = query.getIterator()) {
List<? extends InheritedHierarchyAnnotation> list = iterator.getAll();
if (list.size() > 0) {
return list.get(0);
}
return null;
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class ListType method listForType.
public static JsonObject listForType(String typeCode) {
ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
Organization org = type.getOrganization();
final boolean isMember = Organization.isMember(org);
ListTypeQuery query = new ListTypeQuery(new QueryFactory());
query.WHERE(query.getUniversal().EQ(type.getUniversal()));
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
final JsonArray lists = new JsonArray();
try (OIterator<? extends ListType> it = query.getIterator()) {
it.getAll().stream().sorted((a, b) -> {
return a.getDisplayLabel().getValue().compareTo(b.getDisplayLabel().getValue());
}).filter(f -> {
return true;
}).forEach(list -> {
// JsonObject object = new JsonObject();
// object.addProperty("label", list.getDisplayLabel().getValue());
// object.addProperty("oid", list.getOid());
// object.addProperty("createDate",
// format.format(list.getCreateDate()));
// object.addProperty("lasteUpdateDate",
// format.format(list.getLastUpdateDate()));
// object.addProperty("write", list.doesActorHaveWritePermission());
// object.addProperty("read", list.doesActorHaveReadPermission());
//
lists.add(list.toJSON());
});
}
JsonObject object = new JsonObject();
object.addProperty("orgCode", org.getCode());
object.addProperty("orgLabel", org.getDisplayLabel().getValue());
object.addProperty("typeCode", type.getCode());
object.addProperty("typeLabel", type.getLabel().getValue());
object.addProperty("geometryType", type.getGeometryType().name());
object.addProperty("write", doesActorHaveWritePermissions(type));
object.add("lists", lists);
return object;
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class ListType method getJobs.
public List<ListTypeJob> getJobs() {
ListTypeJobQuery query = new ListTypeJobQuery(new QueryFactory());
query.WHERE(query.getListType().EQ(this));
try (OIterator<? extends ListTypeJob> it = query.getIterator()) {
return new LinkedList<ListTypeJob>(it.getAll());
}
}
Aggregations