private Event createBasicEvent(String uei, Date date, double dsValue, CollectionResourceWrapper resource) { Map<String,String> params = new HashMap<String,String>(); params.put("threshold", Double.toString(getThresholdConfig().getValue())); params.put("trigger", Integer.toString(getThresholdConfig().getTrigger())); params.put("rearm", Double.toString(getThresholdConfig().getRearm())); return createBasicEvent(uei, date, dsValue, resource, params); }
switch (status) { case TRIGGERED: uei=getThresholdConfig().getTriggeredUEI().orElse(null); if (ThresholdType.LOW.equals(getThresholdConfig().getType())) { if(uei==null || "".equals(uei)) { uei=EventConstants.LOW_THRESHOLD_EVENT_UEI; } else if (ThresholdType.HIGH.equals(getThresholdConfig().getType())) { if(uei==null || "".equals(uei)) { uei=EventConstants.HIGH_THRESHOLD_EVENT_UEI; throw new IllegalArgumentException("Threshold type " + getThresholdConfig().getType() + " is not supported"); uei=getThresholdConfig().getRearmedUEI().orElse(null); if (ThresholdType.LOW.equals(getThresholdConfig().getType())) { if(uei==null || "".equals(uei)) { uei=EventConstants.LOW_THRESHOLD_REARM_EVENT_UEI; } else if (ThresholdType.HIGH.equals(getThresholdConfig().getType())) { if(uei==null || "".equals(uei)) { uei=EventConstants.HIGH_THRESHOLD_REARM_EVENT_UEI; throw new IllegalArgumentException("Threshold type " + getThresholdConfig().getType() + " is not supported");
protected boolean isRearmExceeded(double dsValue) { if (ThresholdType.HIGH.equals(getThresholdConfig().getType())) { return dsValue <= getThresholdConfig().getRearm(); } else if (ThresholdType.LOW.equals(getThresholdConfig().getType())) { return dsValue >= getThresholdConfig().getRearm(); } else { throw new IllegalStateException("This thresholding strategy can only be used for thresholding types of 'high' and 'low'."); } }
protected boolean isTriggerCountExceeded() { return getExceededCount() >= getThresholdConfig().getTrigger(); }
public ThresholdType getType() { return getThresholdConfig().getType(); }
protected boolean isThresholdExceeded(double dsValue) { if (ThresholdType.HIGH.equals(getThresholdConfig().getType())) { return dsValue >= getThresholdConfig().getValue(); } else if (ThresholdType.LOW.equals(getThresholdConfig().getType())) { return dsValue <= getThresholdConfig().getValue(); } else { throw new IllegalStateException("This thresholding strategy can only be used for thresholding types of 'high' and 'low'."); } }