Search in sources :

Example 16 with FeedMetadata

use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.

the class InMemoryFeedManagerFeedService method getFeedVersion.

@Override
public Optional<EntityVersion> getFeedVersion(String feedId, String versionId, boolean includeContent) {
    FeedMetadata feed = getFeedById(feedId);
    EntityVersion version = null;
    if (feed != null) {
        version = new EntityVersion(UUID.randomUUID().toString(), "v1.0", feed.getCreateDate());
        if (includeContent) {
            version.setEntity(feed);
        }
    }
    return Optional.ofNullable(version);
}
Also used : EntityVersion(com.thinkbiganalytics.feedmgr.rest.model.EntityVersion) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)

Example 17 with FeedMetadata

use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.

the class InMemoryFeedManagerFeedService method getFeedVersions.

@Override
public FeedVersions getFeedVersions(String feedId, boolean includeContent) {
    FeedVersions versions = new FeedVersions(feedId);
    FeedMetadata feed = getFeedById(feedId);
    if (feed != null) {
        EntityVersion version = versions.addNewVersion(UUID.randomUUID().toString(), "v1.0", feed.getCreateDate());
        if (includeContent) {
            version.setEntity(feed);
        }
    }
    return versions;
}
Also used : EntityVersion(com.thinkbiganalytics.feedmgr.rest.model.EntityVersion) FeedVersions(com.thinkbiganalytics.feedmgr.rest.model.FeedVersions) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)

Example 18 with FeedMetadata

use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.

the class InMemoryFeedManagerFeedService method postConstruct.

@PostConstruct
private void postConstruct() {
    Collection<FeedMetadata> savedFeeds = FileObjectPersistence.getInstance().getFeedsFromFile();
    if (savedFeeds != null) {
        Long maxId = 0L;
        for (FeedMetadata feed : savedFeeds) {
            // update the category mappings
            String categoryId = feed.getCategory().getId();
            FeedCategory category = categoryProvider.getCategoryById(categoryId);
            feed.setCategory(category);
            category.addRelatedFeed(new FeedSummary(feed));
            // add it to the map
            feeds.put(feed.getId(), feed);
        }
        loadSavedFeedsToMetaClientStore();
    }
}
Also used : FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) PostConstruct(javax.annotation.PostConstruct)

Example 19 with FeedMetadata

use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.

the class InMemoryFeedManagerFeedService method getFeedById.

@Override
public FeedMetadata getFeedById(String id, boolean refreshTargetTableSchema) {
    if (feeds != null && !feeds.isEmpty()) {
        FeedMetadata feed = feeds.get(id);
        if (feed != null) {
            // get the latest category data
            FeedCategory category = categoryProvider.getCategoryById(feed.getCategory().getId());
            feed.setCategory(category);
            // set the template to the feed
            RegisteredTemplate registeredTemplate = templateProvider.getRegisteredTemplate(feed.getTemplateId());
            if (registeredTemplate != null) {
                RegisteredTemplate copy = new RegisteredTemplate(registeredTemplate);
                copy.getProperties().clear();
                feed.setRegisteredTemplate(copy);
                feed.setTemplateId(copy.getNifiTemplateId());
            }
            return feed;
        }
    }
    return null;
}
Also used : FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)

Example 20 with FeedMetadata

use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.

the class FeedImporter method validateSensitiveProperties.

private boolean validateSensitiveProperties() {
    FeedMetadata metadata = importFeed.getFeedToImport();
    // detect any sensitive properties and prompt for input before proceeding
    UploadProgressMessage statusMessage = uploadProgressService.addUploadStatus(importFeed.getImportOptions().getUploadKey(), "Validating feed properties.");
    List<NifiProperty> sensitiveProperties = metadata.getSensitiveProperties();
    ImportUtil.addToImportOptionsSensitiveProperties(importFeedOptions, sensitiveProperties, ImportComponent.FEED_DATA);
    boolean valid = ImportUtil.applyImportPropertiesToFeed(metadata, importFeed, ImportComponent.FEED_DATA);
    if (!valid) {
        statusMessage.update("Validation Error. Additional properties are needed before uploading the feed.", false);
        importFeed.setValid(false);
    } else {
        statusMessage.update("Validated feed properties.", valid);
    }
    uploadProgressService.completeSection(importFeed.getImportOptions(), ImportSection.Section.VALIDATE_PROPERTIES);
    return valid;
}
Also used : UploadProgressMessage(com.thinkbiganalytics.feedmgr.rest.model.UploadProgressMessage) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty)

Aggregations

FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)76 NifiProperty (com.thinkbiganalytics.nifi.rest.model.NifiProperty)26 NifiFeed (com.thinkbiganalytics.feedmgr.rest.model.NifiFeed)23 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)21 ArrayList (java.util.ArrayList)21 List (java.util.List)20 Collectors (java.util.stream.Collectors)20 RegisteredTemplate (com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)18 Set (java.util.Set)18 StringUtils (org.apache.commons.lang3.StringUtils)18 UIFeed (com.thinkbiganalytics.feedmgr.rest.model.UIFeed)17 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)17 FeedSummary (com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)16 Map (java.util.Map)16 Inject (javax.inject.Inject)16 Logger (org.slf4j.Logger)16 LoggerFactory (org.slf4j.LoggerFactory)16 FeedServicesAccessControl (com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl)15 AccessController (com.thinkbiganalytics.security.AccessController)15 Optional (java.util.Optional)15