Search in sources :

Example 1 with QueryFactory

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;
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) Operation(com.runwaysdk.business.rbac.Operation) Transaction(com.runwaysdk.dataaccess.transaction.Transaction) MdGeoVertexInfo(com.runwaysdk.gis.constants.MdGeoVertexInfo) MdAttributeTermDAOIF(com.runwaysdk.dataaccess.MdAttributeTermDAOIF) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonParser(com.google.gson.JsonParser) MdAttributeLocalInfo(com.runwaysdk.constants.MdAttributeLocalInfo) MdAttributeBooleanInfo(com.runwaysdk.constants.MdAttributeBooleanInfo) MdVertex(com.runwaysdk.system.metadata.MdVertex) ServiceFactory(net.geoprism.registry.service.ServiceFactory) Classifier(net.geoprism.ontology.Classifier) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF) DefaultAttribute(org.commongeoregistry.adapter.constants.DefaultAttribute) IndexTypes(com.runwaysdk.constants.IndexTypes) MdAttributeCharacterInfo(com.runwaysdk.constants.MdAttributeCharacterInfo) LocalizedValueConverter(net.geoprism.registry.conversion.LocalizedValueConverter) Map(java.util.Map) QueryFactory(com.runwaysdk.query.QueryFactory) RoleDAO(com.runwaysdk.business.rbac.RoleDAO) Collector(java.util.stream.Collector) JsonSerializable(net.geoprism.registry.view.JsonSerializable) MdAttributeConcrete(com.runwaysdk.system.metadata.MdAttributeConcrete) TermConverter(net.geoprism.registry.conversion.TermConverter) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) MdAttributeCharacterDAO(com.runwaysdk.dataaccess.metadata.MdAttributeCharacterDAO) MdAttributeConcreteDAO(com.runwaysdk.dataaccess.metadata.MdAttributeConcreteDAO) GeoVertex(net.geoprism.registry.graph.GeoVertex) Roles(com.runwaysdk.system.Roles) AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter) MdAttributeConcreteInfo(com.runwaysdk.constants.MdAttributeConcreteInfo) Collectors(java.util.stream.Collectors) BusinessFacade(com.runwaysdk.business.BusinessFacade) MdVertexDAO(com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO) OIterator(com.runwaysdk.query.OIterator) Page(net.geoprism.registry.view.Page) MdAttributeGraphReferenceInfo(com.runwaysdk.constants.MdAttributeGraphReferenceInfo) MdAttributeMultiTermDAOIF(com.runwaysdk.dataaccess.MdAttributeMultiTermDAOIF) MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) List(java.util.List) JsonArray(com.google.gson.JsonArray) DataNotFoundException(com.runwaysdk.dataaccess.cache.DataNotFoundException) MdVertexInfo(com.runwaysdk.constants.graph.MdVertexInfo) Session(com.runwaysdk.session.Session) MdAttributeGraphReferenceDAO(com.runwaysdk.dataaccess.metadata.MdAttributeGraphReferenceDAO) BusinessTypePageQuery(net.geoprism.registry.query.graph.BusinessTypePageQuery) QueryFactory(com.runwaysdk.query.QueryFactory)

Example 2 with QueryFactory

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;
}
Also used : JsonArray(com.google.gson.JsonArray) QueryFactory(com.runwaysdk.query.QueryFactory) JsonObject(com.google.gson.JsonObject)

Example 3 with QueryFactory

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;
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory)

Example 4 with QueryFactory

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;
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory)

Example 5 with QueryFactory

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());
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) LinkedList(java.util.LinkedList)

Aggregations

QueryFactory (com.runwaysdk.query.QueryFactory)158 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)37 LinkedList (java.util.LinkedList)35 Request (com.runwaysdk.session.Request)31 JsonArray (com.google.gson.JsonArray)19 JsonObject (com.google.gson.JsonObject)19 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)19 SimpleDateFormat (java.text.SimpleDateFormat)15 List (java.util.List)14 Date (java.util.Date)13 ChangeRequest (net.geoprism.registry.action.ChangeRequest)13 OIterator (com.runwaysdk.query.OIterator)12 Universal (com.runwaysdk.system.gis.geo.Universal)12 ChangeRequestQuery (net.geoprism.registry.action.ChangeRequestQuery)12 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)11 BusinessQuery (com.runwaysdk.business.BusinessQuery)10 Session (com.runwaysdk.session.Session)10 GeoprismUser (net.geoprism.GeoprismUser)10 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)9 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)8