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;
}
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;
}
Aggregations