Search in sources :

Example 1 with ImportFeedException

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);
    }
}
Also used : UploadProgressMessage(com.thinkbiganalytics.feedmgr.rest.model.UploadProgressMessage) ImportException(com.thinkbiganalytics.feedmgr.service.template.importing.ImportException) ImportFeedException(com.thinkbiganalytics.feedmgr.service.feed.ImportFeedException) ImportComponentOption(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption) ImportFeedException(com.thinkbiganalytics.feedmgr.service.feed.ImportFeedException) IOException(java.io.IOException) ImportException(com.thinkbiganalytics.feedmgr.service.template.importing.ImportException)

Aggregations

ImportComponentOption (com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption)1 UploadProgressMessage (com.thinkbiganalytics.feedmgr.rest.model.UploadProgressMessage)1 ImportFeedException (com.thinkbiganalytics.feedmgr.service.feed.ImportFeedException)1 ImportException (com.thinkbiganalytics.feedmgr.service.template.importing.ImportException)1 IOException (java.io.IOException)1