Project

General

Profile

« Previous | Next » 

Revision 6321

implement d1 paging for the log record results

View differences:

src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
273 273

  
274 274

  
275 275
    Log log = new Log();
276
    Vector<LogEntry> logs = new Vector<LogEntry>();
276
    List<LogEntry> logs = new Vector<LogEntry>();
277 277
    IdentifierManager im = IdentifierManager.getInstance();
278 278
    EventLog el = EventLog.getInstance();
279 279
    if (fromDate == null) {
......
361 361
      le.setSubject(princ);
362 362
      le.setUserAgent("metacat/RESTService");
363 363

  
364
      // event filtering?
364 365
      if (event == null) {
365
        logs.add(le);
366
    	  logs.add(le);
367
      } else if (le.getEvent().equals(event)) {
368
    	  logs.add(le);
366 369
      }
367

  
368
      if (event != null
369
          && e.toString().toLowerCase().trim().equals(
370
              event.toString().toLowerCase().trim())) {
371
        logs.add(le);
372
      }
373 370
    }
371
    
372
    // d1 paging
373
    int total = logs.size();
374
    if (start != null && count != null) {
375
    	int toIndex = start + count;
376
    	if (toIndex <= total) {
377
    		logs = new ArrayList<LogEntry>(logs.subList(start, toIndex));
378
    	}
379
    }
374 380

  
375 381
    log.setLogEntryList(logs);
382
    log.setStart(start);
383
    log.setCount(logs.size());
384
    log.setTotal(total);
376 385
    logMetacat.info("getLogRecords");
377 386
    return log;
378 387
  }

Also available in: Unified diff