Search in sources :

Example 1 with FeedPreconditionImpl

use of com.thinkbiganalytics.metadata.core.feed.BaseFeed.FeedPreconditionImpl in project kylo by Teradata.

the class InMemoryFeedProvider method createPrecondition.

@Override
public Feed createPrecondition(Feed.ID feedId, String descr, List<Metric> metrics) {
    BaseFeed feed = (BaseFeed) this.feeds.get(feedId);
    if (feed != null) {
        // Remove the old one if any
        FeedPreconditionImpl precond = (FeedPreconditionImpl) feed.getPrecondition();
        if (precond != null) {
            this.slaProvider.removeAgreement(precond.getAgreement().getId());
        }
        ServiceLevelAgreement sla = this.slaProvider.builder().name("Precondition for feed " + feed.getName() + " (" + feed.getId() + ")").description(descr).obligationBuilder(Condition.REQUIRED).metric(metrics).build().build();
        return setupPrecondition(feed, sla);
    } else {
        throw new FeedCreateException("A feed with the given ID does not exists: " + feedId);
    }
}
Also used : FeedPreconditionImpl(com.thinkbiganalytics.metadata.core.feed.BaseFeed.FeedPreconditionImpl) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)

Aggregations

FeedPreconditionImpl (com.thinkbiganalytics.metadata.core.feed.BaseFeed.FeedPreconditionImpl)1 ServiceLevelAgreement (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)1