use of io.milton.http.values.ValueAndType in project lobcder by skoulouzis.
the class JsonPropFindHandler method filterResults.
/**
* If the where argument is given, removes results where it does not
* evaluate to true
*
* If the given where argument starts with ! the condition is negated
*
* @param results
* @param where
*/
private void filterResults(List<PropFindResponse> results, String where) {
if (where != null && where.length() > 0) {
boolean negate = where.startsWith("!");
if (negate) {
where = where.substring(1);
}
ValueAndType prop;
QName qnWhere = parseQName(where);
Iterator<PropFindResponse> it = results.iterator();
boolean removeValue = negate;
while (it.hasNext()) {
PropFindResponse result = it.next();
boolean isTrue = eval(qnWhere, result);
// eg iscollection for a folder -> false == true = false, so dont remove
if (isTrue == removeValue) {
it.remove();
}
}
}
}
Aggregations