Project

General

Profile

« Previous | Next » 

Revision 7047

log record paging:
-use start and count parameters
-if start+count exceeds the total number of records, then only return from start to the end of the list
-if start exceeds total record count, start at the end of the list (will be empty list)
https://redmine.dataone.org/issues/2458

View differences:

src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
499 499
    int total = logs.size();
500 500
    if (start != null && count != null) {
501 501
    	int toIndex = start + count;
502
    	if (toIndex <= total) {
503
    		logs = new ArrayList<LogEntry>(logs.subList(start, toIndex));
504
    	}
502
    	// do not exceed total
503
    	toIndex = Math.min(toIndex, total);
504
    	// do not start greater than total
505
    	start = Math.min(start, total);
506
    	// sub set of the list
507
    	logs = new ArrayList<LogEntry>(logs.subList(start, toIndex));
505 508
    }
506 509

  
507 510
    log.setLogEntryList(logs);

Also available in: Unified diff