private static List<ResultsRow> sort(List<ResultColumn> cols, List<ResultsRow> rows) throws ReportException {
//column index -> priority
final ArrayList<ColumnPriority> orderByCols = new ArrayList<ColumnPriority>();
for(int i=0; i<cols.size(); i++) {
ResultColumn col = cols.get(i);
if(col.getOrderPriority() != 0) {
orderByCols.add(new ColumnPriority(i, col.getOrderPriority()));
}
}
Collections.sort(orderByCols);
Collections.sort(rows, new Comparator<ResultsRow>() {