use of org.motechproject.mds.json.ImportReader in project motech by motech.
the class ImportExportServiceImpl method importSchema.
private void importSchema(final ImportContext importContext, final JsonReader jsonReader) {
LOGGER.debug("Importing schema...");
doInTransaction(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
ImportReader importReader = new ImportReader(jsonReader, importContext);
importReader.importSchema();
} catch (IOException e) {
throw new ImportExportException("An error occurred during importing schema", e);
}
}
});
if (importContext.hasUnresolvedEntities()) {
LOGGER.warn("Unresolved relationships found. Skipping. ({})", importContext.getUnresolvedEntities());
}
LOGGER.debug("Schema imported.");
LOGGER.debug("Regenerating MDS bundle and refreshing affected bundles: {}", importContext.getAffectedModules());
mdsBundleRegenerationService.regenerateMdsDataBundleAfterDdeEnhancement(importContext.getAffectedModulesArray());
LOGGER.debug("Bundles regenerated/refreshed");
}
use of org.motechproject.mds.json.ImportReader in project motech by motech.
the class ImportExportServiceImpl method importInstances.
private void importInstances(final ImportContext importContext, final JsonReader jsonReader) {
LOGGER.debug("Importing instances...");
doInTransaction(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
importContext.removeExistingInstances();
ImportReader importReader = new ImportReader(jsonReader, importContext);
importReader.importInstances();
} catch (IOException e) {
throw new ImportExportException("An error occurred during importing schema", e);
}
}
});
LOGGER.debug("Instances imported.");
}
Aggregations