Search in sources :

Example 41 with Feed

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;
}
Also used : JcrServiceLevelAgreement(com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) JcrServiceLevelAgreement(com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 42 with Feed

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);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) QueryResult(javax.jcr.query.QueryResult) ArrayList(java.util.ArrayList) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 43 with Feed

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;
}
Also used : FeedCriteria(com.thinkbiganalytics.metadata.api.feed.FeedCriteria) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 44 with Feed

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;
    });
}
Also used : FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) UIFeed(com.thinkbiganalytics.feedmgr.rest.model.UIFeed)

Example 45 with Feed

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();
        }
    });
}
Also used : ID(com.thinkbiganalytics.metadata.api.feed.Feed.ID) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) UIFeed(com.thinkbiganalytics.feedmgr.rest.model.UIFeed)

Aggregations

Feed (com.thinkbiganalytics.metadata.api.feed.Feed)69 ArrayList (java.util.ArrayList)19 UIFeed (com.thinkbiganalytics.feedmgr.rest.model.UIFeed)17 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)15 NifiFeed (com.thinkbiganalytics.feedmgr.rest.model.NifiFeed)15 Category (com.thinkbiganalytics.metadata.api.category.Category)14 FeedNotFoundException (com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException)14 FeedManagerTemplate (com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)13 List (java.util.List)13 FeedProvider (com.thinkbiganalytics.metadata.api.feed.FeedProvider)12 HashMap (java.util.HashMap)12 DateTime (org.joda.time.DateTime)12 ID (com.thinkbiganalytics.metadata.api.feed.Feed.ID)11 Collectors (java.util.stream.Collectors)11 Inject (javax.inject.Inject)11 Test (org.junit.Test)11 FeedAccessControl (com.thinkbiganalytics.metadata.api.feed.security.FeedAccessControl)10 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)10 AccessController (com.thinkbiganalytics.security.AccessController)10 HashSet (java.util.HashSet)10