use of net.geoprism.registry.etl.upload.ImportConfiguration in project geoprism-registry by terraframe.
the class ETLService method doImport.
@Request(RequestType.SESSION)
public JsonObject doImport(String sessionId, String json) {
ImportConfiguration config = ImportConfiguration.build(json);
config.enforceExecutePermissions();
ImportHistory hist;
if (config.getHistoryId() != null && config.getHistoryId().length() > 0) {
String historyId = config.getHistoryId();
hist = ImportHistory.get(historyId);
JobHistoryRecord record = hist.getAllJobRel().getAll().get(0);
ExecutableJob execJob = record.getParent();
execJob.resume(record);
} else {
DataImportJob job = new DataImportJob();
job.setRunAsUserId(Session.getCurrentSession().getUser().getOid());
job.apply();
hist = job.start(config);
}
return JsonParser.parseString(hist.getConfigJson()).getAsJsonObject();
}
use of net.geoprism.registry.etl.upload.ImportConfiguration in project geoprism-registry by terraframe.
the class PatchGotIntoImportHistory method doIt.
@Transaction
private void doIt() {
ImportHistoryQuery ihq = new ImportHistoryQuery(new QueryFactory());
OIterator<? extends ImportHistory> it = ihq.getIterator();
try {
for (ImportHistory hist : it) {
try {
ImportConfiguration config = hist.getConfig();
if (config instanceof GeoObjectImportConfiguration) {
GeoObjectImportConfiguration goConfig = (GeoObjectImportConfiguration) config;
ServerGeoObjectType type = goConfig.getType();
hist.appLock();
hist.setOrganization(type.getOrganization());
hist.setGeoObjectTypeCode(type.getCode());
hist.apply();
}
} catch (net.geoprism.registry.DataNotFoundException e) {
logger.error("ImportHistory references object which does not exist", e);
}
}
} finally {
it.close();
}
}
Aggregations