Changeset 30034 for main/trunk/greenstone3
- Timestamp:
- 2015-07-16T18:42:45+12:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java
r29270 r30034 490 490 491 491 //if there are any date params, check they're of the right format 492 Date from_date = null; 493 Date until_date = null; 494 492 495 from = param_map.get(OAIXML.FROM); 493 496 if(from != null) { 494 Datefrom_date = OAIXML.getDate(from);497 from_date = OAIXML.getDate(from); 495 498 if(from_date == null) { 496 499 logger.error("invalid date: " + from); … … 500 503 until = param_map.get(OAIXML.UNTIL); 501 504 if(until != null) { 502 Dateuntil_date = OAIXML.getDate(until);505 until_date = OAIXML.getDate(until); 503 506 if(until_date == null) { 504 507 logger.error("invalid date: " + until); … … 506 509 } 507 510 } 511 508 512 if(from != null && until != null) { // check they are of the same date-time format (granularity) 509 513 if(from.length() != until.length()) { … … 511 515 return OAIXML.createErrorMessage(OAIXML.BAD_ARGUMENT, "The request has different granularities (date-time formats) for the From and Until date parameters."); 512 516 } 513 } 517 518 if(from_date.compareTo(until_date) > 0) { // from date can't be later than until date 519 return OAIXML.createErrorMessage(OAIXML.NO_RECORDS_MATCH, ""); 520 } 521 } 522 523 if(until_date != null) { 524 525 // Also call until_date.compareTo(earliestdatestamp) as the until date can't precede the earliest timestamp 526 // Unfortunately, this test has to be done after the granularity test 527 // compareTo() returns the value 0 if the argument Date is equal to this Date; a value less than 0 if this Date is before 528 // the Date argument; and a value greater than 0 if this Date is after the Date argument. 529 long earliestDatestamp = getEarliestDateStamp(collection_list); 530 String earliestDatestamp_str = OAIXML.getTime(earliestDatestamp); 531 Date earliestDatestamp_date = OAIXML.getDate(earliestDatestamp_str); 532 533 if(until_date.compareTo(earliestDatestamp_date) < 0) { 534 return OAIXML.createErrorMessage(OAIXML.NO_RECORDS_MATCH, ""); 535 } 536 } 537 514 538 515 539 // check the set arg is a set we know about
Note:
See TracChangeset
for help on using the changeset viewer.