Search in sources :

Example 6 with GlobalNotificationMessage

use of net.geoprism.registry.ws.GlobalNotificationMessage in project geoprism-registry by terraframe.

the class DataExportJob method afterJobExecute.

@Override
public void afterJobExecute(JobHistory history) {
    super.afterJobExecute(history);
    NotificationFacade.queue(new GlobalNotificationMessage(MessageType.DATA_EXPORT_JOB_CHANGE, null));
}
Also used : GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage)

Example 7 with GlobalNotificationMessage

use of net.geoprism.registry.ws.GlobalNotificationMessage in project geoprism-registry by terraframe.

the class DataExportJob method createNewHistory.

@Override
protected JobHistory createNewHistory() {
    ExportHistory history = new ExportHistory();
    history.setStartTime(new Date());
    history.addStatus(AllJobStatus.NEW);
    history.addStage(ExportStage.CONNECTING);
    history.apply();
    NotificationFacade.queue(new GlobalNotificationMessage(MessageType.DATA_EXPORT_JOB_CHANGE, null));
    return history;
}
Also used : GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage) Date(java.util.Date)

Example 8 with GlobalNotificationMessage

use of net.geoprism.registry.ws.GlobalNotificationMessage 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 9 with GlobalNotificationMessage

use of net.geoprism.registry.ws.GlobalNotificationMessage in project geoprism-registry by terraframe.

the class ServerGeoObjectType method delete.

public void delete() {
    try {
        this.deleteInTransaction();
        Session session = (Session) Session.getCurrentSession();
        // session object in the request.
        if (session != null) {
            session.reloadPermissions();
        }
        // If we get here then it was successfully deleted
        // We have to do a full metadata cache
        // refresh because the GeoObjectType is
        // embedded in the HierarchyType
        ServiceFactory.getRegistryService().refreshMetadataCache();
        NotificationFacade.queue(new GlobalNotificationMessage(MessageType.TYPE_CACHE_CHANGE, null));
    } catch (RuntimeException e) {
        // An error occurred re-create the WMS layer
        throw e;
    }
}
Also used : GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage) Session(com.runwaysdk.session.Session)

Example 10 with GlobalNotificationMessage

use of net.geoprism.registry.ws.GlobalNotificationMessage in project geoprism-registry by terraframe.

the class RegistryService method importTypes.

/**
 * Creates a {@link GeoObjectType} from the given JSON.
 *
 * @param sessionId
 * @param gtJSON
 *          JSON of the {@link GeoObjectType} to be created.
 * @return newly created {@link GeoObjectType}
 */
@Request(RequestType.SESSION)
public void importTypes(String sessionId, String orgCode, InputStream istream) {
    ServiceFactory.getGeoObjectTypePermissionService().enforceCanCreate(orgCode, true);
    GeoRegistryUtil.importTypes(orgCode, istream);
    this.refreshMetadataCache();
    NotificationFacade.queue(new GlobalNotificationMessage(MessageType.TYPE_CACHE_CHANGE, null));
}
Also used : GlobalNotificationMessage(net.geoprism.registry.ws.GlobalNotificationMessage) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

Aggregations

GlobalNotificationMessage (net.geoprism.registry.ws.GlobalNotificationMessage)25 Date (java.util.Date)5 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)4 Request (com.runwaysdk.session.Request)4 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)4 JsonObject (com.google.gson.JsonObject)3 Session (com.runwaysdk.session.Session)3 HttpError (net.geoprism.registry.etl.export.HttpError)3 FhirExternalSystem (net.geoprism.registry.graph.FhirExternalSystem)3 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)2 ListTypeVersion (net.geoprism.registry.ListTypeVersion)2 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)2 DataFormatException (ca.uhn.fhir.parser.DataFormatException)1 GsonBuilder (com.google.gson.GsonBuilder)1 JsonArray (com.google.gson.JsonArray)1 Business (com.runwaysdk.business.Business)1 BusinessQuery (com.runwaysdk.business.BusinessQuery)1 QueryFactory (com.runwaysdk.query.QueryFactory)1 JobHistory (com.runwaysdk.system.scheduler.JobHistory)1 JobHistoryQuery (com.runwaysdk.system.scheduler.JobHistoryQuery)1