Changeset 31241

Show
Ignore:
Timestamp:
15.12.2016 17:34:22 (3 years ago)
Author:
ak19
Message:

Corrected misunderstanding on distinction between whether we're processing a ListRecords? request or a ListIdentifiers? request. The difference was denoted by the boolean include_metadata parameter.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/OAIPMH.java

    r31236 r31241  
    512512      } 
    513513      DBInfo info = this.coll_db.getInfo(oid); 
    514       if (info == null) { // can happen if oid was deleted, in which case only oai_info keeps a record of it 
     514      if (info == null) { // can happen if oid was deleted, in which case only oai_info keeps a record of the oid 
    515515        logger.error("Collection database does not contain information about oid: " +oid); 
    516516      } 
     
    540540      } 
    541541       
    542        
    543       // compose a record for adding header and metadata 
    544       Element record = doc.createElement(OAIXML.RECORD); 
    545       list_items.appendChild(record); 
    546       //compose the header element 
    547       record.appendChild(createHeaderElement(doc, oid, OAIXML.getTime(millis), OID_is_deleted)); 
    548  
    549  
    550       //Now check that this id has metadata for the required prefix. 
    551       if (info != null && documentContainsMetadata(info, set_of_elems)) { 
    552       // YES, it does have some metadata for this prefix         
    553        
    554         if (include_metadata) {      
    555         //compose the metadata element 
    556         record.appendChild(createMetadataElement(doc, prefix, info)); 
    557         } /*else { 
    558           //compose the header element and append it 
    559           list_items.appendChild(createHeaderElement(doc, oid, OAIXML.getTime(millis)));       
    560           }*/ 
    561       } // otherwise we won't include this oid. with meta 
    562        
    563        
     542      //compose the header element, which we'll be appending no matter what 
     543      Element header = createHeaderElement(doc, oid, OAIXML.getTime(millis), OID_is_deleted); 
     544 
     545      if (include_metadata) { // doing ListRecords 
     546      // compose a record for adding header and metadata 
     547      Element record = doc.createElement(OAIXML.RECORD); 
     548      list_items.appendChild(record); 
     549      //insert the header element 
     550      record.appendChild(header); 
     551      //Now check that this id has metadata for the required prefix. 
     552      if (info != null && documentContainsMetadata(info, set_of_elems)) { 
     553          // YES, it does have some metadata for this prefix         
     554          //compose the metadata element 
     555          record.appendChild(createMetadataElement(doc, prefix, info)); 
     556      } // otherwise the oid was 'deleted' and only in the oai-inf db and not in the info (collection index) db 
     557      } else { // doing ListIdentifiers 
     558      //append the header element 
     559      list_items.appendChild(header);       
     560      }       
    564561       
    565562    }//end of for(int i=0; i<oid_list.size(); i++) of doing thru each record