diff --git a/src/groovy/net/hedtech/restfulapi/query/Filter.groovy b/src/groovy/net/hedtech/restfulapi/query/Filter.groovy index db70133..eb8e414 100644 --- a/src/groovy/net/hedtech/restfulapi/query/Filter.groovy +++ b/src/groovy/net/hedtech/restfulapi/query/Filter.groovy @@ -52,7 +52,8 @@ class Filter { private static List NUMERIC_TYPES = ['num', 'number'] private static List STRING_TYPES = ['string'] private static List DATE_TYPES = ['date'] - private static List SUPPORTED_TYPES = STRING_TYPES + NUMERIC_TYPES + DATE_TYPES + private static List BOOL_TYPES = ['bool', 'boolean'] + private static List SUPPORTED_TYPES = STRING_TYPES + NUMERIC_TYPES + DATE_TYPES + BOOL_TYPES protected static final Log log = LogFactory.getLog(Filter.class) @@ -81,6 +82,7 @@ class Filter { public boolean isNumeric() { NUMERIC_TYPES.contains(type) } public boolean isDate() { DATE_TYPES.contains(type) } + public boolean isBoolean() { BOOL_TYPES.contains(type) } public String toString() { "Filter[field=$field,operator=$operator,value=$value,type=${persistentProperty?.type},isAssociation=$isAssociation,isMany=$isMany]" diff --git a/src/groovy/net/hedtech/restfulapi/query/HQLBuilder.groovy b/src/groovy/net/hedtech/restfulapi/query/HQLBuilder.groovy index dcdc219..70a12a6 100644 --- a/src/groovy/net/hedtech/restfulapi/query/HQLBuilder.groovy +++ b/src/groovy/net/hedtech/restfulapi/query/HQLBuilder.groovy @@ -112,6 +112,7 @@ class HQLBuilder { else { if (it.isNumeric()) namedParameters."${it.field}" = "${it.value}".toLong() else if (it.isDate()) namedParameters."${it.field}" = parseDate( params, it ) + else if (it.isBoolean()) namedParameters."${it.field}" = "${it.value}".toBoolean() else namedParameters."${it.field}" = "${it.value}" whereFragment += "${firstAlias}.${it.field} "