source: main/tags/2.80/gsdl/src/oaiservr/listrecsaction.cpp@ 24527

Last change on this file since 24527 was 9608, checked in by kjdon, 19 years ago

added in x++ -> ++x changes submitted by Emanuel Dejanu

  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1#include "listrecsaction.h"
2
3#include "oaitools.h"
4#include "recordaction.h"
5
6bool listrecsaction::validateAction(recptproto *protocol, oaiargs &params)
7{
8 text_t meta = params["metadataPrefix"];
9 int numArgs = 1; // 1st arg (Verb=ListRecords) must be present for us to be here
10
11 if (!abstractlistaction::validateAction(protocol, params, numArgs)) {
12 return false;
13 }
14
15 // metadataPrefix is required - if it's not there, throw an error. Note that the arg isn't
16 // required (or allowed) if a resumptionToken is given, but as we don't handle resumption
17 // tokens this is sufficient. When we DO handle the tokens, this will have to change.
18 if (meta == "") {
19 this->errorType = "badArgument";
20 return false;
21 }
22 else {
23 ++numArgs; // If it's there, increase arg count
24 }
25
26 // The number of valid args should be exactly equal to the number of args actually there.
27 // If not, throw a 'badArgument' error.
28 if (numArgs != params.getSize()) {
29 this->errorType = "badArgument";
30 return false;
31 }
32
33 if (this->formatNotSupported(meta)) { // Check that the metadataPrefix is supported
34 this->errorType = "cannotDisseminateFormat";
35 this->record_action->setErrorType(this->errorType);
36 return false;
37 }
38
39 return true;
40}
41
42//-----------------------------------------------------------------------------------------------
43
44bool listrecsaction::output_document(ostream &output, recptproto *protocol, const text_t &collection,
45 const text_t &OID, const text_t &metadataPrefix)
46{
47 this->record_action->output_record(output, protocol, collection, OID, metadataPrefix);
48 return true;
49}
50
51//-----------------------------------------------------------------------------------------------
52
53
54
Note: See TracBrowser for help on using the repository browser.