StringBuffer orderRule = new StringBuffer();
int ruleSize = orderRules.size();
if (ruleSize > 0) {
orderRule.append(" order by ");
for (int i = 0; i < ruleSize - 1; i++) {
OrderRule rule = (OrderRule) orderRules.get(i);
orderRule.append(rule.getOrderColumn());
orderRule.append(" ");
orderRule.append(rule.getOrderDirection().toString());
orderRule.append(",");
}
OrderRule rule = (OrderRule) orderRules.get(ruleSize - 1);
orderRule.append(rule.getOrderColumn());
orderRule.append(" ");
orderRule.append(rule.getOrderDirection().toString());
}
StringBuffer group = new StringBuffer();
if (groupItems.size() > 0)
group.append(" group by ");