Search in sources :

Example 1 with ListTypeVersion

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);
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ListType(net.geoprism.registry.ListType) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Request(com.runwaysdk.session.Request)

Example 2 with ListTypeVersion

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);
    }
}
Also used : FhirSyncLevel(net.geoprism.registry.etl.FhirSyncLevel) ListTypeVersion(net.geoprism.registry.ListTypeVersion) FhirExternalSystem(net.geoprism.registry.graph.FhirExternalSystem) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) DataFormatException(ca.uhn.fhir.parser.DataFormatException) IOException(java.io.IOException) HttpError(net.geoprism.registry.etl.export.HttpError) GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage)

Example 3 with ListTypeVersion

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);
}
Also used : DefaultSerializer(org.commongeoregistry.adapter.metadata.DefaultSerializer) ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ListType(net.geoprism.registry.ListType) JsonObject(com.google.gson.JsonObject) ListTypeVersion(net.geoprism.registry.ListTypeVersion) SimpleDateFormat(java.text.SimpleDateFormat) Request(com.runwaysdk.session.Request)

Example 4 with ListTypeVersion

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();
}
Also used : ListType(net.geoprism.registry.ListType) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

Example 5 with ListTypeVersion

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();
}
Also used : JsonSerializable(net.geoprism.registry.view.JsonSerializable) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Request(com.runwaysdk.session.Request)

Aggregations

ListTypeVersion (net.geoprism.registry.ListTypeVersion)20 Request (com.runwaysdk.session.Request)15 ListType (net.geoprism.registry.ListType)11 JsonObject (com.google.gson.JsonObject)9 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)5 QueryFactory (com.runwaysdk.query.QueryFactory)4 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)3 ListTypeEntry (net.geoprism.registry.ListTypeEntry)3 SingleListType (net.geoprism.registry.SingleListType)3 JsonArray (com.google.gson.JsonArray)2 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)2 Session (com.runwaysdk.session.Session)2 IncrementalListType (net.geoprism.registry.IncrementalListType)2 IntervalListType (net.geoprism.registry.IntervalListType)2 InvalidMasterListException (net.geoprism.registry.InvalidMasterListException)2 ListTypeVersionQuery (net.geoprism.registry.ListTypeVersionQuery)2 FhirSyncLevel (net.geoprism.registry.etl.FhirSyncLevel)2 ServerGeoObjectService (net.geoprism.registry.geoobject.ServerGeoObjectService)2 JsonSerializable (net.geoprism.registry.view.JsonSerializable)2 GlobalNotificationMessage (net.geoprism.registry.ws.GlobalNotificationMessage)2