Search in sources :

Example 6 with QueryFactory

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

Example 7 with QueryFactory

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

Example 8 with QueryFactory

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

Example 9 with QueryFactory

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;
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) Operation(com.runwaysdk.business.rbac.Operation) Date(java.util.Date) Authenticate(com.runwaysdk.business.rbac.Authenticate) MdEdgeDAOIF(com.runwaysdk.dataaccess.MdEdgeDAOIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CreateListPermissionException(net.geoprism.registry.roles.CreateListPermissionException) MdAttributeDateTimeUtil(com.runwaysdk.constants.MdAttributeDateTimeUtil) ClassificationType(net.geoprism.registry.model.ClassificationType) Locale(java.util.Locale) Map(java.util.Map) AttributeBooleanType(org.commongeoregistry.adapter.metadata.AttributeBooleanType) TermConverter(net.geoprism.registry.conversion.TermConverter) UpdateListPermissionException(net.geoprism.registry.roles.UpdateListPermissionException) Optional(org.commongeoregistry.adapter.Optional) Collection(java.util.Collection) MdAttributeClassificationDAOIF(com.runwaysdk.dataaccess.MdAttributeClassificationDAOIF) List(java.util.List) JsonArray(com.google.gson.JsonArray) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) GeometryType(org.commongeoregistry.adapter.constants.GeometryType) CompositeRestriction(net.geoprism.registry.query.graph.CompositeRestriction) Universal(com.runwaysdk.system.gis.geo.Universal) ListTypeJob(net.geoprism.registry.etl.ListTypeJob) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) Transaction(com.runwaysdk.dataaccess.transaction.Transaction) GeoprismProperties(net.geoprism.GeoprismProperties) AttributeClassificationType(org.commongeoregistry.adapter.metadata.AttributeClassificationType) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) JsonParser(com.google.gson.JsonParser) Constants(com.runwaysdk.constants.Constants) ServiceFactory(net.geoprism.registry.service.ServiceFactory) Classifier(net.geoprism.ontology.Classifier) LocalizationFacade(com.runwaysdk.localization.LocalizationFacade) ListTypeJobQuery(net.geoprism.registry.etl.ListTypeJobQuery) Classification(net.geoprism.registry.model.Classification) AttributeValueRestriction(net.geoprism.registry.query.graph.AttributeValueRestriction) LocalizedValueConverter(net.geoprism.registry.conversion.LocalizedValueConverter) QueryFactory(com.runwaysdk.query.QueryFactory) LinkedList(java.util.LinkedList) LocalStruct(com.runwaysdk.business.LocalStruct) MdClassificationDAOIF(com.runwaysdk.dataaccess.MdClassificationDAOIF) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) Term(org.commongeoregistry.adapter.Term) AttributeTermType(org.commongeoregistry.adapter.metadata.AttributeTermType) AttributeDateType(org.commongeoregistry.adapter.metadata.AttributeDateType) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) OR(com.runwaysdk.query.OR) File(java.io.File) OIterator(com.runwaysdk.query.OIterator) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) BasicVertexRestriction(net.geoprism.registry.query.graph.BasicVertexRestriction) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) Session(com.runwaysdk.session.Session) RolePermissionService(net.geoprism.registry.permission.RolePermissionService) LocaleSerializer(net.geoprism.registry.service.LocaleSerializer) QueryFactory(com.runwaysdk.query.QueryFactory) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonObject(com.google.gson.JsonObject) SimpleDateFormat(java.text.SimpleDateFormat)

Example 10 with QueryFactory

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());
    }
}
Also used : ListTypeJobQuery(net.geoprism.registry.etl.ListTypeJobQuery) 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