break;
}
case THRESHOLD: {
if (!calltimeCategory) {
MeasurementDefinition measDef = getMeasurementDefinition(form
.getValueAsString(THRESHOLD_METRIC_ITEMNAME));
newCondition.setName(measDef.getDisplayName());
newCondition.setThreshold(getMeasurementValue(measDef,
form.getValueAsString(THRESHOLD_ABSVALUE_ITEMNAME)));
newCondition.setComparator(form.getValueAsString(THRESHOLD_COMPARATOR_ITEMNAME));
newCondition.setOption(null);
newCondition.setMeasurementDefinition(measDef);
} else {
MeasurementDefinition measDef = getMeasurementDefinition(form
.getValueAsString(CALLTIME_THRESHOLD_METRIC_ITEMNAME));
newCondition.setName(form.getValueAsString(CALLTIME_THRESHOLD_REGEX_ITEMNAME));
newCondition.setThreshold(getMeasurementValue(measDef,
form.getValueAsString(CALLTIME_THRESHOLD_ABSVALUE_ITEMNAME)));
newCondition.setComparator(form.getValueAsString(CALLTIME_THRESHOLD_COMPARATOR_ITEMNAME));
newCondition.setOption(form.getValueAsString(CALLTIME_THRESHOLD_MINMAXAVG_ITEMNAME));
newCondition.setMeasurementDefinition(measDef);
}
break;
}
case BASELINE: {
MeasurementDefinition measDef = getMeasurementDefinition(form
.getValueAsString(BASELINE_METRIC_ITEMNAME));
newCondition.setName(measDef.getDisplayName());
newCondition.setThreshold(getMeasurementValueByUnits(MeasurementUnits.PERCENTAGE,
form.getValueAsString(BASELINE_PERCENTAGE_ITEMNAME)));
newCondition.setComparator(form.getValueAsString(BASELINE_COMPARATOR_ITEMNAME));
newCondition.setOption(form.getValueAsString(BASELINE_SELECTION_ITEMNAME));
newCondition.setMeasurementDefinition(measDef);
break;
}
case CHANGE: {
if (!calltimeCategory) {
MeasurementDefinition measDef = getMeasurementDefinition(form
.getValueAsString(CHANGE_METRIC_ITEMNAME));
newCondition.setName(measDef.getDisplayName());
newCondition.setComparator(null);
newCondition.setThreshold(null);
newCondition.setOption(null);
newCondition.setMeasurementDefinition(measDef);
} else {
MeasurementDefinition measDef = getMeasurementDefinition(form
.getValueAsString(CALLTIME_CHANGE_METRIC_ITEMNAME));
newCondition.setName(form.getValueAsString(CALLTIME_CHANGE_REGEX_ITEMNAME));
newCondition.setThreshold(getMeasurementValueByUnits(MeasurementUnits.PERCENTAGE,
form.getValueAsString(CALLTIME_CHANGE_PERCENTAGE_ITEMNAME)));
newCondition.setComparator(form.getValueAsString(CALLTIME_CHANGE_COMPARATOR_ITEMNAME));
newCondition.setOption(form.getValueAsString(CALLTIME_CHANGE_MINMAXAVG_ITEMNAME));
newCondition.setMeasurementDefinition(measDef);
}
break;
}
case TRAIT: {
MeasurementDefinition measDef = getMeasurementDefinition(form.getValueAsString(TRAIT_METRIC_ITEMNAME));
newCondition.setName(measDef.getDisplayName());
newCondition.setComparator(null);
newCondition.setThreshold(null);
newCondition.setOption(form.getValueAsString(TRAIT_REGEX_ITEMNAME));
newCondition.setMeasurementDefinition(measDef);
break;
}
case CONTROL: {
newCondition.setName(form.getValueAsString(OPERATION_NAME_ITEMNAME));
newCondition.setComparator(null);
newCondition.setThreshold(null);
newCondition.setOption(form.getValueAsString(OPERATION_RESULTS_ITEMNAME));
newCondition.setMeasurementDefinition(null);
break;
}
case EVENT: {
newCondition.setName(form.getValueAsString(EVENT_SEVERITY_ITEMNAME));
newCondition.setComparator(null);
newCondition.setThreshold(null);
Object regex1 = form.getValue(EVENT_REGEX_ITEMNAME);
Object regex2 = form.getValue(EVENT_SOURCE_PATH_REGEX_ITEMNAME);
newCondition.setOption((regex1 == null ? "" : regex1) + AlertCondition.ADHOC_SEPARATOR
+ (regex2 == null ? "" : regex2));
newCondition.setMeasurementDefinition(null);
break;
}
case RESOURCE_CONFIG: {
newCondition.setName(null);
newCondition.setComparator(null);
newCondition.setThreshold(null);
newCondition.setOption(null);
newCondition.setMeasurementDefinition(null);
break;
}
case DRIFT: {
newCondition.setName(form.getValueAsString(DRIFT_DEFNAME_REGEX_ITEMNAME));
newCondition.setComparator(null);
newCondition.setThreshold(null);
newCondition.setOption(form.getValueAsString(DRIFT_PATHNAME_REGEX_ITEMNAME));
newCondition.setMeasurementDefinition(null);
break;
}
case RANGE: {
MeasurementDefinition measDef = getMeasurementDefinition(form.getValueAsString(RANGE_METRIC_ITEMNAME));
newCondition.setName(measDef.getDisplayName());
newCondition.setThreshold(getMeasurementValue(measDef,
form.getValueAsString(RANGE_LO_ABSVALUE_ITEMNAME)));
newCondition.setComparator(form.getValueAsString(RANGE_COMPARATOR_ITEMNAME));
newCondition.setOption(getMeasurementValue(measDef, form.getValueAsString(RANGE_HI_ABSVALUE_ITEMNAME))
.toString());