Search in sources :

Example 11 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class ListType method markAllAsInvalid.

@Transaction
public static void markAllAsInvalid(ServerHierarchyType hierarchyType, ServerGeoObjectType type) {
    ListTypeQuery query = new ListTypeQuery(new QueryFactory());
    query.WHERE(query.getValid().EQ((Boolean) null));
    query.OR(query.getValid().EQ(true));
    try (OIterator<? extends ListType> iterator = query.getIterator()) {
        while (iterator.hasNext()) {
            ListType masterlist = iterator.next();
            if (hierarchyType != null && type != null) {
                masterlist.markAsInvalid(hierarchyType, type);
            } else if (hierarchyType != null) {
                masterlist.markAsInvalid(hierarchyType);
            } else if (type != null) {
                masterlist.markAsInvalid(type);
            }
        }
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 12 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class ListType method list.

public static JsonArray list() {
    JsonArray response = new JsonArray();
    ListTypeQuery query = new ListTypeQuery(new QueryFactory());
    try (OIterator<? extends ListType> it = query.getIterator()) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        it.getAll().stream().filter(list -> list.doesActorHaveReadPermission()).sorted((a, b) -> {
            return a.getDisplayLabel().getValue().compareTo(b.getDisplayLabel().getValue());
        }).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()));
            response.add(object);
        });
    }
    return response;
}
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) JsonObject(com.google.gson.JsonObject) SimpleDateFormat(java.text.SimpleDateFormat)

Example 13 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class ListType method deleteAll.

@Transaction
public static void deleteAll(Universal universal) {
    ListTypeQuery query = new ListTypeQuery(new QueryFactory());
    query.WHERE(query.getUniversal().EQ(universal));
    List<? extends ListType> lists = query.getIterator().getAll();
    for (ListType list : lists) {
        list.delete();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 14 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class ListType method deleteMdAttribute.

public static void deleteMdAttribute(Universal universal, AttributeType attributeType) {
    ListTypeQuery query = new ListTypeQuery(new QueryFactory());
    query.WHERE(query.getUniversal().EQ(universal));
    List<? extends ListType> lists = query.getIterator().getAll();
    for (ListType list : lists) {
        list.removeAttributeType(attributeType);
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory)

Example 15 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class ListTypeAttributeGroup method remove.

public static void remove(MdAttributeConcreteDAOIF mdAttribute) {
    ListTypeAttributeGroupQuery query = new ListTypeAttributeGroupQuery(new QueryFactory());
    query.WHERE(query.getTargetAttribute().EQ(mdAttribute.getOid()));
    query.OR(query.getSourceAttribute().EQ(mdAttribute.getOid()));
    OIterator<? extends ListTypeAttributeGroup> it = query.getIterator();
    try {
        List<? extends ListTypeAttributeGroup> groups = it.getAll();
        for (ListTypeAttributeGroup group : groups) {
            group.delete();
        }
    } finally {
        it.close();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory)

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