/** * Get datasource name * * @return a {@link java.lang.String} object. */ public String getDataSourceExpression() { if (hasThresholds()) { return getThresholdConfig().getDatasourceExpression(); } else { throw new IllegalStateException("No thresholds have been added."); } }
/** * Get datasource type * * @return a {@link java.lang.String} object. */ public String getDatasourceType() { if (hasThresholds()) { return getThresholdConfig().getDsType(); } else { throw new IllegalStateException("No thresholds have been added."); } }
/** * Get datasource Label * * @return a {@link java.lang.String} object. */ public String getDatasourceLabel() { if (hasThresholds()) { return getThresholdConfig().getDsLabel().orElse(null); } else { return null; } }
/** * Returns the names of the dataousrces required to evaluate this threshold entity * * @return Collection of the names of datasources */ public Collection<String> getRequiredDatasources() { if (hasThresholds()) { final Set<String> dataSources = new HashSet<String>(); dataSources.addAll(getThresholdConfig().getRequiredDatasources()); dataSources.addAll(getThresholdConfig().getFilterDatasources()); return dataSources; } else { throw new IllegalStateException("No thresholds have been added."); } } /**
/** * This method is responsible for returning a String object which represents * the content of this ThresholdEntity. Primarily used for debugging * purposes. * * @return String which represents the content of this ThresholdEntity */ @Override public String toString() { if (!hasThresholds()) { return ""; } final StringBuilder buffer = new StringBuilder("{"); buffer.append("evaluator=").append(this.getThresholdConfig().getType()); buffer.append(", dsName=").append(this.getDataSourceExpression()); buffer.append(", dsType=").append(this.getDatasourceType()); buffer.append(", evaluators=["); for (ThresholdEvaluatorState item : getThresholdEvaluatorStates(null)) { buffer.append("{ds=").append(item.getThresholdConfig().getDatasourceExpression()); buffer.append(", value=").append(item.getThresholdConfig().getValue()); buffer.append(", rearm=").append(item.getThresholdConfig().getRearm()); buffer.append(", trigger=").append(item.getThresholdConfig().getTrigger()); buffer.append("}"); } buffer.append("]}"); return buffer.toString(); }