Ignore:
Timestamp:
2008-08-12T11:57:10+12:00 (16 years ago)
Author:
mdewsnip
Message:

Completely tidied up abstractlistaction::validateAction() to handle the resumptionToken argument properly, and to structure the checking code more consistently.

File:
1 edited

Legend:

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

    r15198 r16710  
    66bool listrecsaction::validateAction(recptproto *protocol, oaiargs &params)
    77{
    8   int params_size = params.getSize();
    9 
    10   text_t meta    = params["metadataPrefix"];
    11   int    numArgs = 1;                // 1st arg (Verb=ListRecords) must be present for us to be here
    12 
    13   if (!abstractlistaction::validateAction(protocol, params, numArgs)) {
    14     return false;
    15   }
    16 
    17   // metadataPrefix is required - if it's not there, throw an error. Note that the arg isn't
    18   // required (or allowed) if a resumptionToken is given, but as we don't handle resumption
    19   // tokens this is sufficient. When we DO handle the tokens, this will have to change.
    20   if (meta == "") {
    21     this->errorType = "badArgument";
    22     return false;
    23   }
    24   else {
    25     ++numArgs; // If it's there, increase arg count
    26   }
    27  
    28   // The number of valid args should be exactly equal to the number of args actually there.
    29   // If not, throw a 'badArgument' error.
    30   if (numArgs != params_size) {
    31     this->errorType = "badArgument";
    32     return false;
    33   }
    34      
    35   if (this->formatNotSupported(meta)) { // Check that the metadataPrefix is supported
    36     this->errorType = "cannotDisseminateFormat";
    37     this->record_action->setErrorType(this->errorType);
    38     return false;
    39   }
    40 
    41   return true;
     8  return abstractlistaction::validateAction(protocol, params);
    429}
    4310
Note: See TracChangeset for help on using the changeset viewer.