use of net.geoprism.registry.dhis2.DHIS2FeatureService in project geoprism-registry by terraframe.
the class DataExportJob method execute.
@Override
public void execute(ExecutionContext executionContext) throws Throwable {
ExportHistory history = (ExportHistory) executionContext.getJobHistoryRecord().getChild();
this.setStage(history, ExportStage.EXPORT);
SynchronizationConfig c = this.getConfig();
ExternalSystemSyncConfig config = c.buildConfiguration();
if (config instanceof DHIS2SyncConfig) {
DHIS2SyncConfig dhis2Config = (DHIS2SyncConfig) config;
DHIS2TransportServiceIF dhis2 = DHIS2ServiceFactory.buildDhis2TransportService(dhis2Config.getSystem());
DHIS2FeatureService dhis2FeatureService = new DHIS2FeatureService();
dhis2FeatureService.setExternalSystemDhis2Version(dhis2, dhis2Config.getSystem());
new DHIS2SynchronizationManager(dhis2, dhis2Config, history).synchronize();
} else if (config instanceof FhirSyncExportConfig) {
FhirExportSynchronizationManager manager = new FhirExportSynchronizationManager((FhirSyncExportConfig) config, history);
manager.synchronize();
} else if (config instanceof FhirSyncImportConfig) {
FhirImportSynchronizationManager manager = new FhirImportSynchronizationManager(c, (FhirSyncImportConfig) config, history);
manager.synchronize();
}
}
use of net.geoprism.registry.dhis2.DHIS2FeatureService in project geoprism-registry by terraframe.
the class ExternalSystemService method applyInTrans.
@Transaction
private JsonObject applyInTrans(String json) {
JsonObject jo = JsonParser.parseString(json).getAsJsonObject();
ExternalSystem system = ExternalSystem.desieralize(jo);
system.apply();
if (system instanceof OauthExternalSystem) {
OauthExternalSystem oauthSystem = (OauthExternalSystem) system;
oauthSystem.updateOauthServer(jo);
if (system instanceof DHIS2ExternalSystem) {
// Test the DHIS2 connection information
new DHIS2FeatureService().setExternalSystemDhis2Version((DHIS2ExternalSystem) system);
}
}
return system.toJSON();
}
Aggregations