LOG.warn("ORDER BY has more than one sort criterium, all but the first are ignored.");
class ResultComparator implements Comparator<StoredObject> {
@SuppressWarnings("unchecked")
public int compare(StoredObject so1, StoredObject so2) {
SortSpec s = orderBy.get(0);
CmisSelector sel = s.getSelector();
int result;
if (sel instanceof ColumnReference) {
String propId = ((ColumnReference) sel).getPropertyId();
Object propVal1 = so1.getProperties().get(propId).getFirstValue();
Object propVal2 = so2.getProperties().get(propId).getFirstValue();
if (propVal1 == null && propVal2 == null)
result = 0;
else if (propVal1 == null)
result = -1;
else if (propVal2 == null)
result = 1;
else
result = ((Comparable<Object>) propVal1).compareTo(propVal2);
} else {
// String funcName = ((FunctionReference) sel).getName();
// evaluate function here, currently ignore
result = 0;
}
if (!s.isAscending())
result = -result;
return result;
}
}