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;
}
}
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();
}
}
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();
}
}
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();
}
}
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;
}
Aggregations