@SuppressWarnings("unchecked")
@Override
public void walk(FacesContext facesContext, DataVisitor visitor, Range range,
Object argument) throws IOException {
SequenceRange sequenceRange = (SequenceRange) range;
if (this.cachedItems == null || !areEqualRanges(this.cachedRange, sequenceRange)) {
Criteria criteria = createCriteria();
appendFilters(facesContext, criteria);
appendSorts(facesContext, criteria);
if (sequenceRange != null) {
int first = sequenceRange.getFirstRow();
int rows = sequenceRange.getRows();
criteria.setFirstResult(first);
if (rows > 0) {
criteria.setMaxResults(rows);
}