Ignore:
Timestamp:
2011-08-16T17:52:13+12:00 (10 years ago)
Author:
ak19
Message:

Fixed a new failure of the OAI validation test of GS2's OAI server: where list records is given an Until date that is earlier than the earliestDatestamp. Needs to return a noRecordsMatch. It does now. The calculation of the earliestDatestamp is now shifted to the oaiaction.cpp superclass and called by both identifyaction and listrecordsaction for the identify and listrecords OAI queries, since these tasks need to work with earliestDatestamp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/oaiservr/listrecsaction.cpp

    r22739 r24412  
    156156      this->errorType = "badArgument";
    157157      return false;
    158     }
     158    }   
    159159  }
    160160
     
    178178      return false;
    179179    }
    180 
     180   
    181181    // Check the collection is one that is in the list in the oai.cfg file
    182182    text_tarray &collections = this->configuration->getCollectionsList();
     
    204204      return false;
    205205    }
    206   }
     206   
     207    // check we're not requested to retrieve records of *this* set/coll
     208    // from an earlier date than *this* set's earliestdatestamp
     209    if (params["until"] != "") {
     210        text_t eDatestamp = cinfo.earliestDatestamp;
     211        time_t raw_time = (time_t)eDatestamp.getint();
     212        eDatestamp = this->parseDatestamp(raw_time);
     213       
     214        // error if request is for records of an earlier date than this coll/set's earliestDatestamp       
     215        if(params["until"] < eDatestamp) {
     216            this->errorType = "noRecordsMatch"; // for *this* set/coll of the repository
     217            return false;
     218        }
     219    }
     220   
     221  } else { // no set (collection) specified
     222     if (params ["until"] != "") {  // check we're not requested to retrieve records of an earlier
     223                                    // date than the earliestdatestamp across all collections/sets
     224        // John Thompson advises not to do lazy evaluation of earliestDatestamp here, because
     225        // reading x number of build.cfg files for x number of collections to work out the
     226        // earliestDatestamp among them is not too expensive an operation, but we do want the OAI
     227        // Server to give accurate results when queried, as that's specified by the OAI protocol.
     228        //if(this->mEarliestDatestamp == "") {
     229        text_t eDatestamp = this->calcEarliestDatestamp(protocol, params);
     230        //}
     231       
     232        if(params["until"] < eDatestamp) { // request is for records of an earlier date than earliestDatestamp     
     233            this->errorType = "noRecordsMatch";
     234            return false;
     235        }       
     236     }
     237  }
    207238
    208239  // If we've reached here everything must be fine
Note: See TracChangeset for help on using the changeset viewer.