use of com.thinkbiganalytics.feedmgr.service.feed.ImportFeedException in project kylo by Teradata.
the class FeedImporter method init.
private void init() {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.IMPORT_FEEDS);
UploadProgressMessage feedImportStatusMessage = uploadProgressService.addUploadStatus(importFeedOptions.getUploadKey(), "Initialize feed import.");
try {
boolean isValid = isValidFileImport(fileName) && ZipFileUtil.validateZipEntriesWithRequiredEntries(file, getValidZipFileEntries(), Sets.newHashSet(ImportFeed.FEED_JSON_FILE));
if (!isValid) {
feedImportStatusMessage.update("Validation error. Feed import error. The zip file you uploaded is not valid feed export.", false);
throw new ImportFeedException("The zip file you uploaded is not valid feed export.");
}
// get the Feed Data
importFeed = readFeedJson(fileName, file);
// initially mark as valid.
importFeed.setValid(true);
// merge in the file components to the user options
Set<ImportComponentOption> componentOptions = ImportUtil.inspectZipComponents(file, ImportType.FEED);
importFeedOptions.addOptionsIfNotExists(componentOptions);
// importFeedOptions.findImportComponentOption(ImportComponent.TEMPLATE_CONNECTION_INFORMATION).addConnectionInfo(importFeed.getReusableTemplateConnections());
importFeed.setImportOptions(importFeedOptions);
feedImportStatusMessage.complete(true);
} catch (Exception e) {
throw new ImportException("Unable to import feed. ", e);
}
}
Aggregations