}
protected Comparator getComparator(final SortingCriteria sortingCriteria) {
return new Comparator(){
public int compare(final Object o1, final Object o2) {
Subscriber subscriber1= (Subscriber)o1;
Subscriber subscriber2 = (Subscriber)o2;
int comparisonResult = 0;
if(sortingCriteria.getSortingTerm()==SortingCriteria.ALPHABETICAL_SORTING) {
comparisonResult = collator.compare(subscriber1.getPublisher().getResName(), subscriber1.getPublisher().getResName());
} else if(sortingCriteria.getSortingTerm()==SortingCriteria.DATE_SORTING) {
comparisonResult = subscriber1.getLastModified().compareTo(subscriber1.getLastModified());
} else if(sortingCriteria.getSortingTerm()==SortingCriteria.TYPE_SORTING) {
String type1 = ControllerFactory.translateResourceableTypeName(subscriber1.getPublisher().getType(), getTranslator().getLocale());
String type2 = ControllerFactory.translateResourceableTypeName(subscriber2.getPublisher().getType(), getTranslator().getLocale());
comparisonResult = type1.compareTo(type2);
}
if(!sortingCriteria.isAscending()) {
//if not isAscending return (-comparisonResult)
return -comparisonResult;