* sort expression
*/
public Map buildSortQueryParamsMap(String sortExpression) {
SortModel sortModel = getDataGridState().getSortModel();
SortStrategy sortStrategy = sortModel.getSortStrategy();
List currSorts = sortModel.getSorts();
ArrayList newSorts = new ArrayList();
if(currSorts == null || currSorts.size() == 0) {
Sort sort = new Sort();
sort.setSortExpression(sortExpression);
sort.setDirection(sortStrategy.getDefaultDirection());
newSorts.add(sort);
}
else {
boolean foundSort = false;
for(int i = 0; i < currSorts.size(); i++) {
Sort sort = (Sort)currSorts.get(i);
if(!sort.getSortExpression().equals(sortExpression)) {
newSorts.add(sort);
}
else {
Sort newSort = new Sort();
newSort.setSortExpression(sortExpression);
newSort.setDirection(sortStrategy.nextDirection(sort.getDirection()));
newSorts.add(newSort);
foundSort = true;
}
}
if(!foundSort) {
Sort newSort = new Sort();
newSort.setSortExpression(sortExpression);
newSort.setDirection(sortStrategy.getDefaultDirection());
newSorts.add(newSort);
}
}
Map params = _codec.getExistingParams();