use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class BusinessType method getAll.
public static JsonArray getAll() {
JsonArray response = new JsonArray();
Organization.getOrganizations().stream().filter(o -> Organization.isMember(o)).forEach(org -> {
BusinessTypeQuery query = new BusinessTypeQuery(new QueryFactory());
query.WHERE(query.getOrganization().EQ(org));
query.ORDER_BY_DESC(query.getDisplayLabel().localize());
try (OIterator<? extends BusinessType> it = query.getIterator()) {
while (it.hasNext()) {
BusinessType type = it.next();
response.add(type.toJSON());
}
}
});
return response;
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class BusinessType method listByOrg.
public static JsonArray listByOrg() {
JsonArray response = new JsonArray();
final List<? extends Organization> orgs = Organization.getOrganizations();
for (Organization org : orgs) {
final boolean isMember = Organization.isMember(org);
BusinessTypeQuery query = new BusinessTypeQuery(new QueryFactory());
query.WHERE(query.getOrganization().EQ(org));
query.ORDER_BY_DESC(query.getDisplayLabel().localize());
JsonArray types = new JsonArray();
try (OIterator<? extends BusinessType> it = query.getIterator()) {
while (it.hasNext()) {
BusinessType type = it.next();
if (isMember) {
types.add(type.toJSON());
}
}
}
JsonObject object = new JsonObject();
object.addProperty("oid", org.getOid());
object.addProperty("code", org.getCode());
object.addProperty("label", org.getDisplayLabel().getValue());
object.addProperty("write", Organization.isRegistryAdmin(org));
object.add("types", types);
response.add(object);
}
return response;
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class BusinessType method getByCode.
public static BusinessType getByCode(String code) {
BusinessTypeQuery query = new BusinessTypeQuery(new QueryFactory());
query.WHERE(query.getCode().EQ(code));
try (OIterator<? extends BusinessType> it = query.getIterator()) {
if (it.hasNext()) {
return it.next();
}
}
return null;
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphType method getByMdEdge.
public static DirectedAcyclicGraphType getByMdEdge(MdEdge mdEdge) {
DirectedAcyclicGraphTypeQuery query = new DirectedAcyclicGraphTypeQuery(new QueryFactory());
query.WHERE(query.getMdEdge().EQ(mdEdge));
try (OIterator<? extends DirectedAcyclicGraphType> it = query.getIterator()) {
if (it.hasNext()) {
return it.next();
}
}
return null;
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class HierarchicalRelationshipType method getInheritedTypes.
public static List<HierarchicalRelationshipType> getInheritedTypes() {
QueryFactory factory = new QueryFactory();
InheritedHierarchyAnnotationQuery ihaQuery = new InheritedHierarchyAnnotationQuery(factory);
HierarchicalRelationshipTypeQuery query = new HierarchicalRelationshipTypeQuery(factory);
query.WHERE(query.getOid().EQ(ihaQuery.getInheritedHierarchicalRelationshipType().getOid()));
try (OIterator<? extends HierarchicalRelationshipType> it = query.getIterator()) {
return new LinkedList<HierarchicalRelationshipType>(it.getAll());
}
}
Aggregations