}
protected void sort(final String column, final boolean ascending) {
Comparator comparator = new Comparator() {
public int compare(Object o1, Object o2) {
CampaignVO c1 = (CampaignVO) o1;
CampaignVO c2 = (CampaignVO) o2;
if (column == null) {
return 0;
}
if (column.equals("type")) {
return ascending
? c1.getName().compareTo(c2.getName())
: c2.getName().compareTo(c1.getName());
} else if (column.equals("type")) {
return ascending
? c1.getType().compareTo(c2.getType())
: c2.getType().compareTo(c1.getType());
} else if (column.equals("status")) {
return ascending
? c1.getStatus().compareTo(c2.getStatus())
: c2.getStatus().compareTo(c1.getStatus());
} else if (column.equals("beginDate")) {
return ascending
? c1.getBeginDate().compareTo(c2.getBeginDate())
: c2.getBeginDate().compareTo(c1.getBeginDate());
} else if (column.equals("endDate")) {
return ascending
? c1.getBeginDate().compareTo(c2.getBeginDate())
: c2.getBeginDate().compareTo(c1.getBeginDate());
} else {
return 0;
}
}
};