Changeset 21605

Show
Ignore:
Timestamp:
25.01.2010 15:03:40 (9 years ago)
Author:
mdewsnip
Message:

Swapped an "if" block and an "else" block in metaformat::scan_metadata() so the oaimapping (specified in the oai.cfg file) is used in preference to the automatic code that looks at a value like "dc.Provenance" and maps it automatically to oai_dc.provenance. This means the user always has full control if they want it, instead of being unable to override the automatic mapping if they need to.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/oaiservr/metaformat.cpp

    r18896 r21605  
    6767    } 
    6868 
    69     if (metaItem == this->formatPrefix()) { 
     69    // Map the element using the "oaimapping" specification from the oai.cfg/collect.cfg files, if defined 
     70    text_t mapTo = this->get_mapping(collection, here->first); 
     71    if (mapTo != "") { 
     72      // Do we actually want to do anything here? Doesn't getting here imply that this  
     73      // particular metadata is stuff we don't want? 
     74      if (doOutput) { 
     75    if (this->is_valid_element(mapTo)) { 
     76      this->output_item(output, utf8convert, headerDone, mapTo, here->second.values); 
     77    } 
     78      } 
     79      else { 
     80    if (here->second.values.size() > 0) { 
     81      return true; 
     82    } 
     83      } 
     84    } 
     85 
     86    // Otherwise try to map the element automatically 
     87    // For example, dc.X is mapped to oai_dc.X (doesn't check X is a valid Dublin Core element though) 
     88    else if (metaItem == this->formatPrefix()) { 
    7089      metaItem = substr(last+1, here->first.end()); // Get the rest of the metadata tag (it's name) but without the '.' 
    7190      // remove xxx^ eg Coverage^Spatial becomes spatial 
     
    90109    }   
    91110    else { 
    92       text_t mapTo = this->get_mapping(collection, here->first); 
    93       if (mapTo != "") { 
    94     // Do we actually want to do anything here? Doesn't getting here imply that this  
    95     // particular metadata is stuff we don't want? 
    96     if (doOutput) { 
    97       if (this->is_valid_element(mapTo)) { 
    98         this->output_item(output, utf8convert, headerDone, mapTo, here->second.values); 
    99       } 
    100     } 
    101     else { 
    102       if (here->second.values.size() > 0) { 
    103         return true; 
    104       } 
    105     } 
    106       } 
    107111    } 
    108112