case AVAIL_GOES_UP:
case AVAIL_GOES_NOT_UP:
return operator;
default:
throw new UnsupportedAlertConditionOperatorException(
"Invalid alertConditionValue for AVAILABILITY category:" + operator);
}
}
case AVAIL_DURATION: {
AlertConditionOperator operator = AlertConditionOperator.valueOf(name.toUpperCase());
switch (operator) {
case AVAIL_DURATION_DOWN:
case AVAIL_DURATION_NOT_UP:
return operator;
default:
throw new UnsupportedAlertConditionOperatorException(
"Invalid alertConditionValue for AVAILABILITY_DURATION category:" + operator);
}
}
case RANGE:
// range can support <= and >=, which we look for here. It can also support < and >, which is checked down below further.
// note that RANGE does not support =, so we throw an exception if caller tries that
if (comparator.equals("<=")) {
return AlertConditionOperator.LESS_THAN_OR_EQUAL_TO;
} else if (comparator.equals(">=")) {
return AlertConditionOperator.GREATER_THAN_OR_EQUAL_TO;
} else if (comparator.equals("=")) {
throw new UnsupportedAlertConditionOperatorException("Comparator [" + comparator + "] "
+ "is not supported for category: " + category.name());
}
default:
if (comparator.equals("<")) {
return AlertConditionOperator.LESS_THAN;
} else if (comparator.equals(">")) {
return AlertConditionOperator.GREATER_THAN;
} else if (comparator.equals("=")) {
return AlertConditionOperator.EQUALS;
} else {
throw new UnsupportedAlertConditionOperatorException("Comparator [" + comparator + "] "
+ "is not supported for category: " + category.name());
}
}
}