#include "listrecsaction.h" #include "oaitools.h" #include "recordaction.h" bool listrecsaction::validateAction(recptproto *protocol, oaiargs ¶ms) { text_t meta = params["metadataPrefix"]; int numArgs = 1; // 1st arg (Verb=ListRecords) must be present for us to be here if (!abstractlistaction::validateAction(protocol, params, numArgs)) { return false; } // metadataPrefix is required - if it's not there, throw an error. Note that the arg isn't // required (or allowed) if a resumptionToken is given, but as we don't handle resumption // tokens this is sufficient. When we DO handle the tokens, this will have to change. if (meta == "") { this->errorType = "badArgument"; return false; } else { ++numArgs; // If it's there, increase arg count } // The number of valid args should be exactly equal to the number of args actually there. // If not, throw a 'badArgument' error. if (numArgs != params.getSize()) { this->errorType = "badArgument"; return false; } if (this->formatNotSupported(meta)) { // Check that the metadataPrefix is supported this->errorType = "cannotDisseminateFormat"; this->record_action->setErrorType(this->errorType); return false; } return true; } //----------------------------------------------------------------------------------------------- bool listrecsaction::output_document(ostream &output, recptproto *protocol, const text_t &collection, const text_t &OID, const text_t &metadataPrefix) { this->record_action->output_record(output, protocol, collection, OID, metadataPrefix); return true; } //-----------------------------------------------------------------------------------------------