use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfiguration in project kylo by Teradata.
the class JcrServiceLevelAgreementCheck method setActionConfigurations.
public void setActionConfigurations(List<? extends ServiceLevelAgreementActionConfiguration> actionConfigurations) {
try {
NodeIterator nodes = this.node.getNodes(ACTION_CONFIGURATIONS);
while (nodes.hasNext()) {
Node metricNode = (Node) nodes.next();
metricNode.remove();
}
for (ServiceLevelAgreementActionConfiguration actionConfiguration : actionConfigurations) {
Node node = this.node.addNode(ACTION_CONFIGURATIONS, ACTION_CONFIGURATION_TYPE);
JcrPropertyUtil.setProperty(node, JcrPropertyConstants.TITLE, actionConfiguration.getClass().getSimpleName());
ServiceLevelAgreementActionConfig annotation = actionConfiguration.getClass().getAnnotation(ServiceLevelAgreementActionConfig.class);
String desc = actionConfiguration.getClass().getSimpleName();
if (annotation != null) {
desc = annotation.description();
}
JcrPropertyUtil.setProperty(node, DESCRIPTION, desc);
JcrUtil.addGenericJson(node, JcrPropertyConstants.JSON, actionConfiguration);
}
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to retrieve the metric nodes", e);
}
}
Aggregations