use of com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException in project kylo by Teradata.
the class JobRepoFeedOperationsProvider method getDependentDeltaResults.
@Override
public FeedDependencyDeltaResults getDependentDeltaResults(Feed.ID feedId, Set<String> props) {
Feed feed = this.feedProvider.getFeed(feedId);
if (feed != null) {
String systemFeedName = FeedNameUtil.fullName(feed.getCategory().getSystemName(), feed.getName());
FeedDependencyDeltaResults results = new FeedDependencyDeltaResults(feed.getId().toString(), systemFeedName);
// find this feeds latest completion
BatchJobExecution latest = jobExecutionProvider.findLatestCompletedJobForFeed(systemFeedName);
// get the dependent feeds
List<Feed> dependents = feed.getDependentFeeds();
if (dependents != null) {
for (Feed depFeed : dependents) {
String depFeedSystemName = FeedNameUtil.fullName(depFeed.getCategory().getSystemName(), depFeed.getName());
// find Completed feeds executed since time
Set<BatchJobExecution> jobs = null;
if (latest != null) {
jobs = (Set<BatchJobExecution>) jobExecutionProvider.findJobsForFeedCompletedSince(depFeedSystemName, latest.getStartTime());
} else {
BatchJobExecution job = jobExecutionProvider.findLatestCompletedJobForFeed(depFeedSystemName);
if (job != null) {
jobs = new HashSet<>();
jobs.add(job);
}
}
if (jobs != null) {
for (BatchJobExecution job : jobs) {
DateTime endTime = job.getEndTime();
Map<String, String> executionContext = job.getJobExecutionContextAsMap();
Map<String, Object> map = new HashMap<>();
// filter the map
if (executionContext != null) {
// add those requested to the results map
for (Entry<String, String> entry : executionContext.entrySet()) {
if (props == null || props.isEmpty() || props.contains(entry.getKey())) {
map.put(entry.getKey(), entry.getValue());
}
}
}
results.addFeedExecutionContext(depFeedSystemName, job.getJobExecutionId(), job.getStartTime(), endTime, map);
}
} else {
results.getDependentFeedNames().add(depFeedSystemName);
}
}
}
return results;
} else {
throw new FeedNotFoundException(feedId);
}
}
Aggregations