use of net.geoprism.registry.etl.export.DataExportJobQuery in project geoprism-registry by terraframe.
the class SynchronizationConfigService method getJobs.
@Request(RequestType.SESSION)
public JsonObject getJobs(String sessionId, String configId, Integer pageSize, Integer pageNumber) {
QueryFactory qf = new QueryFactory();
DataExportJobQuery jQuery = new DataExportJobQuery(qf);
jQuery.WHERE(jQuery.getConfig().EQ(configId));
ExportHistoryQuery ihq = new ExportHistoryQuery(qf);
ihq.WHERE(ihq.job(jQuery));
ihq.restrictRows(pageSize, pageNumber);
ihq.ORDER_BY_DESC(ihq.getCreateDate());
try (OIterator<? extends ExportHistory> it = ihq.getIterator()) {
LinkedList<JsonWrapper> results = new LinkedList<JsonWrapper>();
while (it.hasNext()) {
ExportHistory hist = it.next();
DataExportJob job = (DataExportJob) hist.getAllJob().getAll().get(0);
GeoprismUser user = GeoprismUser.get(job.getRunAsUser().getOid());
results.add(new JsonWrapper(serializeHistory(hist, user, job)));
}
return new Page<JsonWrapper>(ihq.getCount(), pageNumber, pageSize, results).toJSON();
}
}
Aggregations