- Timestamp:
- 2017-02-08T18:31:18+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/oaiservr/oaiaction.cpp
r27534 r31387 403 403 404 404 void oaiaction::output_record_header(ostream &output, const text_t &oaiLabel, const text_t &lastModified, 405 const text_tarray &memberOf, int oaiVersion) 406 { 405 const text_t &deleted_status, const text_tarray &memberOf, int oaiVersion) 406 { 407 if(deleted_status == "D") { // record marked as deleted 408 output << " <header status=\"deleted\">" << endl; 409 } else { // deleted_status is "" or E for exists 407 410 output << " <header>" << endl; 411 } 408 412 output << " <identifier>" << oaiLabel << "</identifier>" << endl; 409 413 output << " <datestamp>" << lastModified << "</datestamp>" << endl; … … 443 447 } 444 448 449 // Method that looks for the requested metaname in the doc_info, and if found, sets the value 450 // in the argument 'metavalue'. 451 void oaiaction::getMeta(ResultDocInfo_t &doc_info, const text_t &metaname, text_t &metavalue) 452 { 453 text_t current_metaname; 454 455 //ofstream logout("oai.log", ios::app); 456 457 MetadataInfo_tmap::iterator current = doc_info.metadata.begin(); 458 MetadataInfo_tmap::iterator end = doc_info.metadata.end(); 459 460 while(current != end){ 461 current_metaname = current->first; 462 lc(current_metaname); // lowercased for string comparison below 463 464 if (current_metaname == metaname && current->second.values.size() >= 1) { // found match with a value 465 metavalue = current->second.values[0]; 466 467 //logout << "Looking for metaname = " << current_metaname << endl; 468 //logout << "\t\t\t Found value = " << metavalue << endl; 469 return; // done 470 } 471 472 ++current; 473 } 474 475 //logout.close(); 476 } 477 445 478 void oaiaction::getLastModifiedDate(ResultDocInfo_t &doc_info, text_t &lastModified) 446 479 { … … 460 493 } 461 494 else{ 462 if (temp == "oailastmodified" && lastModified == "" && current->second.values.size() >= 1) { 463 lastModified = current->second.values[0]; 464 time_t raw_time = (time_t)lastModified.getint(); 465 lastModified = this->parseDatestamp(raw_time); 495 if(lastModified == "" && current->second.values.size() >= 1) { 496 497 if (temp == "oaiinf.timestamp") { // new way is to store oai timestamp in oai db and get it from there 498 // check if there was a timestamp for the doc in the etc/oai-inf database 499 lastModified = current->second.values[0]; 500 501 } else if (temp == "oailastmodified") { // old way, being phased out 502 // check if there was an oailastmodified timestamp for the doc in the collection index db 503 lastModified = current->second.values[0]; 504 } 505 506 if(lastModified != "") { // if we've now set the lastModified value, convert it for display and return 507 time_t raw_time = (time_t)lastModified.getint(); 508 lastModified = this->parseDatestamp(raw_time); 509 510 return; 511 } 466 512 } 467 } 513 } // else keep looking for oai timestamp 468 514 ++current; 469 515 } 516 470 517 } 471 518 … … 475 522 FilterResponse_t response; 476 523 text_tset metadata; 477 bool status_ok = get_info(OID, collection, "", metadata, false, protocol, response, logout); 524 bool status_ok = get_oai_info(OID, collection, "", metadata, false, protocol, response, logout); 525 // get timestamp from etc/oai-inf.<db> now, no longer from index.db 478 526 bool not_too_early = false, not_too_recent = false; 479 527
Note:
See TracChangeset
for help on using the changeset viewer.