&& DateUtil.isDate(secondValue)) {
try {
return DateUtil.getDate(firstValue).compareTo(
DateUtil.getDate(secondValue)) == 1;
} catch (ParseException e) {
throw new FilterException("Unable to parse date ("
+ firstValue + ", " + secondValue + ")");
}
}
throw new FilterException("Operator > for value " + firstValue
+ " and value " + secondValue + " is not applicable.");
case ">=":
if (StringUtils.isNumeric(firstValue)
&& StringUtils.isNumeric(secondValue)) {
return Double.parseDouble(firstValue) > Double
.parseDouble(secondValue);
} else if (DateUtil.isDate(firstValue)
&& DateUtil.isDate(secondValue)) {
try {
return DateUtil.getDate(firstValue).compareTo(
DateUtil.getDate(secondValue)) >= 0;
} catch (ParseException e) {
throw new FilterException("Unable to parse date ("
+ firstValue + ", " + secondValue + ")");
}
}
throw new FilterException("Operator >= for value " + firstValue
+ " and value " + secondValue + " is not applicable.");
case "<":
if (StringUtils.isNumeric(firstValue)
&& StringUtils.isNumeric(secondValue)) {
return Double.parseDouble(firstValue) < Double
.parseDouble(secondValue);
} else if (DateUtil.isDate(firstValue)
&& DateUtil.isDate(secondValue)) {
try {
return DateUtil.getDate(firstValue).compareTo(
DateUtil.getDate(secondValue)) == -1;
} catch (ParseException e) {
throw new FilterException("Unable to parse date ("
+ firstValue + ", " + secondValue + ")");
}
}
throw new FilterException("Operator < for value " + firstValue
+ " and value " + secondValue + " is not applicable.");
case "<=":
if (StringUtils.isNumeric(firstValue)
&& StringUtils.isNumeric(secondValue)) {
return Double.parseDouble(firstValue) < Double
.parseDouble(secondValue);
} else if (DateUtil.isDate(firstValue)
&& DateUtil.isDate(secondValue)) {
try {
return DateUtil.getDate(firstValue).compareTo(
DateUtil.getDate(secondValue)) <= 0;
} catch (ParseException e) {
throw new FilterException("Unable to parse date ("
+ firstValue + ", " + secondValue + ")");
}
}
throw new FilterException("Operator <= for value " + firstValue
+ " and value " + secondValue + " is not applicable.");
}
throw new FilterException("Unkown operator " + _operator);
}