Search in sources :

Example 36 with QueryFactory

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

the class ListCurationJob method getRunning.

public static ListCurationHistory getRunning(String versionId) {
    ListCurationHistoryQuery query = new ListCurationHistoryQuery(new QueryFactory());
    query.WHERE(query.getVersion().EQ(versionId));
    query.AND(query.getStatus().containsExactly(AllJobStatus.RUNNING));
    List<? extends ListCurationHistory> histories = query.getIterator().getAll();
    if (histories.size() > 0) {
        return histories.get(0);
    } else {
        return null;
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory)

Example 37 with QueryFactory

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

the class ETLService method getValidationProblems.

@Request(RequestType.SESSION)
public JsonObject getValidationProblems(String sessionId, String historyId, boolean onlyUnresolved, int pageSize, int pageNumber) {
    ImportHistory hist = ImportHistory.get(historyId);
    ValidationProblemQuery vpq = new ValidationProblemQuery(new QueryFactory());
    vpq.WHERE(vpq.getHistory().EQ(hist));
    vpq.restrictRows(pageSize, pageNumber);
    vpq.ORDER_BY(vpq.getSeverity(), SortOrder.DESC);
    vpq.ORDER_BY(vpq.getAffectedRows(), SortOrder.ASC);
    if (onlyUnresolved) {
        vpq.WHERE(vpq.getResolution().EQ(ErrorResolution.UNRESOLVED.name()));
    }
    try (OIterator<? extends ValidationProblem> it = vpq.getIterator()) {
        List<ValidationProblem> results = new LinkedList<>(it.getAll());
        return new Page<ValidationProblem>(vpq.getCount(), vpq.getPageNumber(), vpq.getPageSize(), results).toJSON();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) LinkedList(java.util.LinkedList) Request(com.runwaysdk.session.Request)

Example 38 with QueryFactory

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

the class ETLService method getActiveImports.

@Request(RequestType.SESSION)
public JsonObject getActiveImports(String sessionId, int pageSize, int pageNumber, String sortAttr, boolean isAscending) {
    JsonArray ja = new JsonArray();
    QueryFactory qf = new QueryFactory();
    ImportHistoryQuery ihq = new ImportHistoryQuery(qf);
    ihq.WHERE(ihq.getStatus().containsExactly(AllJobStatus.RUNNING).OR(ihq.getStatus().containsExactly(AllJobStatus.NEW)).OR(ihq.getStatus().containsExactly(AllJobStatus.QUEUED)).OR(ihq.getStatus().containsExactly(AllJobStatus.FEEDBACK)));
    this.filterHistoryQueryBasedOnPermissions(ihq);
    ihq.restrictRows(pageSize, pageNumber);
    ihq.ORDER_BY(ihq.get(sortAttr), isAscending ? SortOrder.ASC : SortOrder.DESC);
    try (OIterator<? extends ImportHistory> it = ihq.getIterator()) {
        List<JsonWrapper> results = it.getAll().stream().map(hist -> {
            DataImportJob job = (DataImportJob) hist.getAllJob().getAll().get(0);
            GeoprismUser user = GeoprismUser.get(job.getRunAsUser().getOid());
            return new JsonWrapper(serializeHistory(hist, user, job));
        }).collect(Collectors.toList());
        return new Page<JsonWrapper>(ihq.getCount(), ihq.getPageNumber(), ihq.getPageSize(), results).toJSON();
    }
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) SortOrder(com.runwaysdk.query.OrderBy.SortOrder) Date(java.util.Date) ErrorResolution(net.geoprism.registry.etl.ImportError.ErrorResolution) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) Request(com.runwaysdk.session.Request) Condition(com.runwaysdk.query.Condition) DataExportJob(net.geoprism.registry.etl.export.DataExportJob) Organization(net.geoprism.registry.Organization) JsonWrapper(net.geoprism.registry.view.JsonWrapper) Optional(org.commongeoregistry.adapter.Optional) ServerParentTreeNodeOverTime(net.geoprism.registry.view.ServerParentTreeNodeOverTime) RoleDAOIF(com.runwaysdk.business.rbac.RoleDAOIF) JobHistory(com.runwaysdk.system.scheduler.JobHistory) Collectors(java.util.stream.Collectors) ExportHistory(net.geoprism.registry.etl.export.ExportHistory) Page(net.geoprism.registry.view.Page) List(java.util.List) JsonArray(com.google.gson.JsonArray) GraphType(net.geoprism.registry.model.GraphType) AllJobStatus(com.runwaysdk.system.scheduler.AllJobStatus) SingleActorDAOIF(com.runwaysdk.business.rbac.SingleActorDAOIF) RegistryIdService(net.geoprism.registry.service.RegistryIdService) GeoObjectImportConfiguration(net.geoprism.registry.io.GeoObjectImportConfiguration) JobHistoryRecord(com.runwaysdk.system.scheduler.JobHistoryRecord) RegistryRole(org.commongeoregistry.adapter.metadata.RegistryRole) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) Transaction(com.runwaysdk.dataaccess.transaction.Transaction) GeoSynonymService(net.geoprism.registry.service.GeoSynonymService) RequestType(com.runwaysdk.session.RequestType) SimpleDateFormat(java.text.SimpleDateFormat) ExecutableJob(com.runwaysdk.system.scheduler.ExecutableJob) JsonParser(com.google.gson.JsonParser) RegistryService(net.geoprism.registry.service.RegistryService) ServiceFactory(net.geoprism.registry.service.ServiceFactory) ArrayList(java.util.ArrayList) QueryFactory(com.runwaysdk.query.QueryFactory) LinkedList(java.util.LinkedList) ImportConfiguration(net.geoprism.registry.etl.upload.ImportConfiguration) GeoObjectOverTime(org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) JsonSyntaxException(com.google.gson.JsonSyntaxException) ExportError(net.geoprism.registry.etl.export.ExportError) ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) IOException(java.io.IOException) ValidationResolution(net.geoprism.registry.etl.ValidationProblem.ValidationResolution) MultipartFileParameter(com.runwaysdk.controller.MultipartFileParameter) ExportErrorQuery(net.geoprism.registry.etl.export.ExportErrorQuery) OIterator(com.runwaysdk.query.OIterator) VaultFile(com.runwaysdk.system.VaultFile) GeoprismUser(net.geoprism.GeoprismUser) Session(com.runwaysdk.session.Session) RolePermissionService(net.geoprism.registry.permission.RolePermissionService) InputStream(java.io.InputStream) DataUploader(net.geoprism.DataUploader) QueryFactory(com.runwaysdk.query.QueryFactory) JsonWrapper(net.geoprism.registry.view.JsonWrapper) GeoprismUser(net.geoprism.GeoprismUser) Request(com.runwaysdk.session.Request)

Example 39 with QueryFactory

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

the class ETLService method getImportErrors.

@Request(RequestType.SESSION)
public JsonObject getImportErrors(String sessionId, String historyId, boolean onlyUnresolved, int pageSize, int pageNumber) {
    ImportErrorQuery query = new ImportErrorQuery(new QueryFactory());
    query.WHERE(query.getHistory().EQ(historyId));
    if (onlyUnresolved) {
        query.WHERE(query.getResolution().EQ(ErrorResolution.UNRESOLVED.name()));
    }
    query.ORDER_BY(query.getRowIndex(), SortOrder.ASC);
    query.restrictRows(pageSize, pageNumber);
    try (OIterator<? extends ImportError> it = query.getIterator()) {
        List<ImportError> results = new LinkedList<>(it.getAll());
        return new Page<ImportError>(query.getCount(), query.getPageNumber(), query.getPageSize(), results).toJSON();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) LinkedList(java.util.LinkedList) Request(com.runwaysdk.session.Request)

Example 40 with QueryFactory

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

the class ImportError method queryResolutionStatus.

public static ImportErrorQuery queryResolutionStatus(String historyId, String resolutionStatus) {
    ImportErrorQuery ieq = new ImportErrorQuery(new QueryFactory());
    ieq.WHERE(ieq.getResolution().EQ(resolutionStatus));
    return ieq;
}
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