Search in sources :

Example 6 with FeedDestination

use of com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination in project kylo by Teradata.

the class FeedLineageBuilder method build.

private com.thinkbiganalytics.metadata.rest.model.feed.Feed build(Feed domainFeed) {
    com.thinkbiganalytics.metadata.rest.model.feed.Feed feed = restFeeds.containsKey(domainFeed.getId().toString()) ? restFeeds.get(domainFeed.getId().toString()) : model.domainToFeed(domainFeed);
    restFeeds.put(feed.getId(), feed);
    @SuppressWarnings("unchecked") List<? extends com.thinkbiganalytics.metadata.api.feed.FeedSource> sources = domainFeed.getSources();
    Set<FeedSource> feedSources = new HashSet<FeedSource>();
    if (sources != null) {
        sources.stream().forEach(feedSource -> {
            FeedSource src = new FeedSource();
            Datasource ds = buildDatasource(feedSource.getDatasource());
            src.setDatasource(ds);
            feedSources.add(src);
        });
    }
    feed.setSources(feedSources);
    Set<FeedDestination> feedDestinations = new HashSet<FeedDestination>();
    List<? extends com.thinkbiganalytics.metadata.api.feed.FeedDestination> destinations = domainFeed.getDestinations();
    if (destinations != null) {
        destinations.stream().forEach(feedDestination -> {
            FeedDestination dest = new FeedDestination();
            Datasource ds = buildDatasource(feedDestination.getDatasource());
            dest.setDatasource(ds);
            feedDestinations.add(dest);
        });
    }
    feed.setDestinations(feedDestinations);
    if (domainFeed.getDependentFeeds() != null) {
        List<Feed> depFeeds = domainFeed.getDependentFeeds();
        depFeeds.stream().forEach(depFeed -> {
            com.thinkbiganalytics.metadata.rest.model.feed.Feed restFeed = restFeeds.get(depFeed.getId().toString());
            if (restFeed == null) {
                com.thinkbiganalytics.metadata.rest.model.feed.Feed depRestFeed = model.domainToFeed(depFeed);
                restFeeds.put(depRestFeed.getId(), depRestFeed);
                feed.getDependentFeeds().add(depRestFeed);
                build(depFeed);
            } else {
                feed.getDependentFeeds().add(restFeed);
            }
        });
    }
    if (domainFeed.getUsedByFeeds() != null) {
        List<Feed> usedByFeeds = domainFeed.getUsedByFeeds();
        usedByFeeds.stream().forEach(usedByFeed -> {
            com.thinkbiganalytics.metadata.rest.model.feed.Feed restFeed = restFeeds.get(usedByFeed.getId().toString());
            if (restFeed == null) {
                com.thinkbiganalytics.metadata.rest.model.feed.Feed usedByRestFeed = model.domainToFeed(usedByFeed);
                restFeeds.put(usedByRestFeed.getId(), usedByRestFeed);
                feed.getUsedByFeeds().add(usedByRestFeed);
                build(usedByFeed);
            } else {
                feed.getUsedByFeeds().add(restFeed);
            }
        });
    }
    return feed;
}
Also used : Datasource(com.thinkbiganalytics.metadata.rest.model.data.Datasource) FeedDestination(com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination) FeedSource(com.thinkbiganalytics.metadata.rest.model.feed.FeedSource) HashSet(java.util.HashSet) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 7 with FeedDestination

use of com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination in project kylo by Teradata.

the class Model method domainToFeedDestination.

/**
 * Transforms the specified domain object to a REST object.
 *
 * @param domain the domain object
 * @return the REST object
 */
public FeedDestination domainToFeedDestination(@Nonnull final com.thinkbiganalytics.metadata.api.feed.FeedDestination domain) {
    FeedDestination dest = new FeedDestination();
    dest.setDatasource(domainToDs(domain.getDatasource()));
    return dest;
}
Also used : FeedDestination(com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination)

Aggregations

FeedDestination (com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination)7 Datasource (com.thinkbiganalytics.metadata.rest.model.data.Datasource)3 Feed (com.thinkbiganalytics.metadata.rest.model.feed.Feed)3 FeedSource (com.thinkbiganalytics.metadata.rest.model.feed.FeedSource)3 DataOperation (com.thinkbiganalytics.metadata.rest.model.op.DataOperation)3 DateTime (org.joda.time.DateTime)3 FeedExecutedSinceFeed (com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed)2 DirectoryDatasource (com.thinkbiganalytics.metadata.rest.model.data.DirectoryDatasource)2 Test (org.junit.Test)2 Datasource (com.thinkbiganalytics.metadata.api.datasource.Datasource)1 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)1 HiveTableDatasource (com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)1 Dataset (com.thinkbiganalytics.metadata.rest.model.op.Dataset)1 MetadataProvider (com.thinkbiganalytics.nifi.core.api.metadata.MetadataProvider)1 HashSet (java.util.HashSet)1 FlowFile (org.apache.nifi.flowfile.FlowFile)1 ProcessException (org.apache.nifi.processor.exception.ProcessException)1