use of com.thinkbiganalytics.metadata.rest.model.sla.Obligation in project kylo by Teradata.
the class ServiceLevelAgreementMetricTransformerHelper method getServiceLevelAgreement.
public ServiceLevelAgreement getServiceLevelAgreement(ServiceLevelAgreementGroup serviceLevelAgreement) {
ServiceLevelAgreement transformedSla = new ServiceLevelAgreement();
transformedSla.setId(serviceLevelAgreement.getId());
transformedSla.setName(serviceLevelAgreement.getName());
transformedSla.setDescription(serviceLevelAgreement.getDescription());
for (ServiceLevelAgreementRule rule : serviceLevelAgreement.getRules()) {
try {
ObligationGroup group = new ObligationGroup();
Metric policy = ServiceLevelAgreementMetricTransformer.instance().fromUiModel(rule);
Obligation obligation = new Obligation(policy.getDescription());
obligation.setMetrics(Lists.newArrayList(policy));
group.addObligation(obligation);
group.setCondition(rule.getCondition().name());
transformedSla.addGroup(group);
} catch (PolicyTransformException e) {
throw new RuntimeException(e);
}
}
return transformedSla;
}
use of com.thinkbiganalytics.metadata.rest.model.sla.Obligation in project kylo by Teradata.
the class FeedExecutedSinceFeeds method buildPreconditionObligation.
/**
* Builds the ObligationGroup that holds the metric that will be used to assess if this precondition is met or not
*/
public com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup buildPreconditionObligation() {
Set<Metric> metrics = new HashSet<>();
for (String categoryAndFeed : categoryAndFeedList) {
FeedExecutedSinceFeed metric = new FeedExecutedSinceFeed(sinceCategoryAndFeedName, categoryAndFeed);
metrics.add(metric);
}
Obligation obligation = new Obligation();
obligation.setMetrics(Lists.newArrayList(metrics));
com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup group = new com.thinkbiganalytics.metadata.rest.model.sla.ObligationGroup();
group.addObligation(obligation);
group.setCondition(ObligationGroup.Condition.REQUIRED.name());
return group;
}
Aggregations