use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.
the class IntegrationTestBase method deleteExistingFeeds.
protected void deleteExistingFeeds() {
LOG.info("Deleting existing feeds");
// start clean - delete all feeds
FeedSummary[] feeds = getFeeds();
for (FeedSummary feed : feeds) {
deleteFeed(feed.getFeedId());
}
feeds = getFeeds();
Assert.assertTrue(feeds.length == 0);
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.
the class IntegrationTestBase method getFeeds.
protected FeedSummary[] getFeeds() {
final ObjectMapper mapper = new ObjectMapper();
SearchResult<Object> searchResult = getFeedsExpectingStatus(HTTP_OK).as(SearchResultImpl.class);
return searchResult.getData().stream().map(o -> mapper.convertValue(o, FeedSummary.class)).toArray(FeedSummary[]::new);
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.
the class IntegrationTestBase method enableFeed.
protected void enableFeed(String feedId) {
LOG.info("Enabling feed {}", feedId);
Response response = enableFeedExpecting(feedId, HTTP_OK);
FeedSummary feed = response.as(FeedSummary.class);
Assert.assertEquals(Feed.State.ENABLED.name(), feed.getState());
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.
the class DefaultFeedManagerFeedService method enableFeed.
public FeedSummary enableFeed(final String feedId) {
return metadataAccess.commit(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_FEEDS);
if (StringUtils.isNotBlank(feedId)) {
FeedMetadata feedMetadata = getFeedById(feedId);
Feed.ID domainId = feedProvider.resolveFeed(feedId);
boolean enabled = enableFeed(domainId);
// re fetch it
if (enabled) {
feedMetadata.setState(Feed.State.ENABLED.name());
serviceLevelAgreementService.enableServiceLevelAgreementSchedule(domainId);
}
FeedSummary feedSummary = new FeedSummary(feedMetadata);
return feedSummary;
}
return null;
});
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.
the class DefaultFeedManagerFeedService method getFeedSummaryForCategory.
@Override
public List<FeedSummary> getFeedSummaryForCategory(final String categoryId) {
return metadataAccess.read(() -> {
List<FeedSummary> summaryList = new ArrayList<>();
boolean hasPermission = this.accessController.hasPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_FEEDS);
if (hasPermission) {
Category.ID categoryDomainId = categoryProvider.resolveId(categoryId);
List<? extends Feed> domainFeeds = feedProvider.findByCategoryId(categoryDomainId);
if (domainFeeds != null && !domainFeeds.isEmpty()) {
List<FeedMetadata> feeds = feedModelTransform.domainToFeedMetadata(domainFeeds);
for (FeedMetadata feed : feeds) {
summaryList.add(new FeedSummary(feed));
}
}
}
return summaryList;
});
}
Aggregations