use of org.jowidgets.cap.common.api.sort.SortOrder in project jo-client-platform by jo-source.
the class BeanDtoComparatorImpl method compare.
@Override
public int compare(final IBeanDto firstBeanDto, final IBeanDto secondBeanDto) {
int result = 0;
for (final ISort sort : sorting) {
final String propertyName = sort.getPropertyName();
final SortOrder sortOrder = sort.getSortOrder();
if (null != sortOrder) {
if (sortOrder.equals(SortOrder.ASC)) {
result = compareWithCast(firstBeanDto, secondBeanDto, result, propertyName);
} else if (sortOrder.equals(SortOrder.DESC)) {
result = -1 * compareWithCast(firstBeanDto, secondBeanDto, result, propertyName);
}
}
if (result != 0) {
return result;
}
}
return result;
}