use of net.geoprism.registry.ListTypeVersion in project geoprism-registry by terraframe.
the class CurationService method curate.
@Request(RequestType.SESSION)
public JsonObject curate(String sessionId, String listTypeVersionId) {
final ListTypeVersion version = ListTypeVersion.get(listTypeVersionId);
final ListType listType = version.getListType();
final ServerGeoObjectType serverGOT = listType.getGeoObjectType();
final String orgCode = listType.getOrganization().getCode();
this.checkPermissions(orgCode, serverGOT);
ListCurationJob job = new ListCurationJob();
job.setRunAsUserId(Session.getCurrentSession().getUser().getOid());
job.apply();
ListCurationHistory history = job.start(version);
return this.serializeHistory(history, GeoprismUser.get(job.getRunAsUser().getOid()), job);
}
use of net.geoprism.registry.ListTypeVersion in project geoprism-registry by terraframe.
the class FhirExportSynchronizationManager method synchronize.
public void synchronize() {
final FhirExternalSystem system = (FhirExternalSystem) this.config.getSystem();
try (FhirConnection connection = FhirConnectionFactory.get(system)) {
SortedSet<FhirSyncLevel> levels = this.config.getLevels();
int expectedLevel = 0;
long exportCount = 0;
for (FhirSyncLevel level : levels) {
if (level.getLevel() != expectedLevel) {
throw new ProgrammingErrorException("Unexpected level number [" + level.getLevel() + "].");
}
history.appLock();
history.setWorkProgress((long) expectedLevel);
history.setExportedRecords(exportCount);
history.apply();
ListTypeVersion version = ListTypeVersion.get(level.getVersionId());
FhirDataPopulator populator = FhirFactory.getPopulator(level.getImplementation());
ListTypeFhirExporter exporter = new ListTypeFhirExporter(version, connection, populator, true);
long results = exporter.export();
exportCount += results;
expectedLevel++;
}
history.appLock();
history.setWorkTotal((long) expectedLevel);
history.setWorkProgress((long) expectedLevel);
history.setExportedRecords(exportCount);
history.clearStage();
history.addStage(ExportStage.COMPLETE);
history.apply();
NotificationFacade.queue(new GlobalNotificationMessage(MessageType.DATA_EXPORT_JOB_CHANGE, null));
handleExportErrors();
} catch (Exception e) {
throw new HttpError(e);
}
}
use of net.geoprism.registry.ListTypeVersion in project geoprism-registry by terraframe.
the class ListTypeService method record.
@Request(RequestType.SESSION)
public JsonObject record(String sessionId, String oid, String uid) {
ListTypeVersion version = ListTypeVersion.get(oid);
if (version.getWorking()) {
ListType type = version.getListType();
if (type.doesActorHaveExploratoryPermission()) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
ServerGeoObjectType geoObjectType = type.getGeoObjectType();
ServerGeoObjectIF geoObject = new ServerGeoObjectService().getGeoObject(uid, geoObjectType.getCode());
JsonObject object = new JsonObject();
object.addProperty("recordType", "GEO_OBJECT");
object.add("type", geoObject.getType().toJSON(new DefaultSerializer()));
object.addProperty("code", geoObject.getCode());
object.addProperty(ListTypeVersion.FORDATE, format.format(version.getForDate()));
// Add geometry so we can zoom to it
object.add("geoObject", geoObject.toGeoObject(version.getForDate()).toJSON());
return object;
}
}
return version.record(uid);
}
use of net.geoprism.registry.ListTypeVersion in project geoprism-registry by terraframe.
the class ListTypeService method apply.
@Request(RequestType.SESSION)
public JsonObject apply(String sessionId, JsonObject list) {
ListType mList = ListType.apply(list);
((Session) Session.getCurrentSession()).reloadPermissions();
// Auto publish the working versions of the lists
List<ListTypeVersion> versions = mList.getVersions();
for (ListTypeVersion version : versions) {
if (version.getWorking()) {
this.publishVersion(sessionId, version.getOid());
}
}
return mList.toJSON();
}
use of net.geoprism.registry.ListTypeVersion in project geoprism-registry by terraframe.
the class ListTypeService method data.
@Request(RequestType.SESSION)
public JsonObject data(String sessionId, String oid, String criteria, Boolean showInvalid, Boolean includeGeometries) {
ListTypeVersion version = ListTypeVersion.get(oid);
Page<JsonSerializable> page = version.data(JsonParser.parseString(criteria).getAsJsonObject(), showInvalid, includeGeometries);
return page.toJSON();
}
Aggregations