use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.
the class JcrFeedProvider method disableFeed.
@Override
public boolean disableFeed(Feed.ID id) {
Feed feed = getFeed(id);
if (accessController.isEntityAccessControlled()) {
feed.getAllowedActions().checkPermission(FeedAccessControl.ENABLE_DISABLE);
}
if (!feed.getState().equals(Feed.State.DISABLED)) {
feed.setState(Feed.State.DISABLED);
// disable any SLAs on this feed
List<ServiceLevelAgreement> serviceLevelAgreements = feed.getServiceLevelAgreements();
if (serviceLevelAgreements != null) {
for (ServiceLevelAgreement sla : serviceLevelAgreements) {
JcrServiceLevelAgreement jcrSla = (JcrServiceLevelAgreement) sla;
jcrSla.disabled();
}
}
return true;
}
return false;
}
use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.
the class JcrFeedProvider method getFeedsForDataHistoryReindexing.
@Override
public List<Feed> getFeedsForDataHistoryReindexing() {
String query = "SELECT e.*\n" + " FROM [tba:feed] as e\n" + " JOIN [tba:feedSummary] AS fs ON ISCHILDNODE(fs, e)\n" + " JOIN [tba:feedData] AS fd ON ISCHILDNODE(fd, e)\n" + " JOIN [tba:historyReindexing] AS fh ON ISCHILDNODE(fh, fd)\n" + " WHERE fh.[tba:reindexingStatus] = 'DIRTY'";
try {
QueryResult result = JcrQueryUtil.query(getSession(), query);
List<JcrFeed> jcrFeeds = JcrQueryUtil.queryResultToList(result, JcrFeed.class);
List<Feed> feeds = new ArrayList<>();
if (jcrFeeds != null) {
feeds.addAll(jcrFeeds);
}
return feeds;
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Unable to get feeds for data history reindexing ", e);
}
}
use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.
the class JcrFeedProvider method findBySystemName.
@Override
public Feed findBySystemName(String categorySystemName, String systemName) {
FeedCriteria c = feedCriteria();
if (categorySystemName != null) {
c.category(categorySystemName);
}
c.name(systemName);
List<Feed> feeds = getFeeds(c);
if (feeds != null && !feeds.isEmpty()) {
return feeds.get(0);
}
return null;
}
use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.
the class DefaultFeedManagerFeedService method enableFeed.
private boolean enableFeed(final Feed.ID feedId) {
return metadataAccess.commit(() -> {
boolean enabled = feedProvider.enableFeed(feedId);
Feed domainFeed = feedProvider.findById(feedId);
if (domainFeed != null) {
domainFeed.setState(Feed.State.ENABLED);
feedProvider.update(domainFeed);
if (enabled) {
FeedMetadata feedMetadata = feedModelTransform.domainToFeedMetadata(domainFeed);
notifyFeedStateChange(feedMetadata, feedId, Feed.State.ENABLED, MetadataChange.ChangeType.UPDATE);
}
}
return enabled;
});
}
use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.
the class DefaultFeedManagerFeedService method checkAccessVersions.
private Optional<Feed.ID> checkAccessVersions(String feedId) {
return metadataAccess.read(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_FEEDS);
Feed.ID domainFeedId = feedProvider.resolveId(feedId);
Feed feed = feedProvider.getFeed(domainFeedId);
if (feed != null) {
if (accessController.isEntityAccessControlled()) {
feed.getAllowedActions().checkPermission(FeedAccessControl.ACCESS_DETAILS);
}
return Optional.of(domainFeedId);
} else {
return Optional.empty();
}
});
}
Aggregations