Ignore:
Timestamp:
2011-04-20T21:02:12+12:00 (13 years ago)
Author:
ak19
Message:

GS3's OAIserver passes final official oaiserver validation tests: to do with earliestDatestamp. Both the datestamp of the records (documents) returned by listRecords, listIdentifiers and getRecord, as well as the earliestDatestamp returned by an Identify request are now in sync with each other. Related code changes made to perllib to write the earliestDatestamp into GS3's buildconfig.xml (and build.cfg for GS2), and to write new fields oailastmodified and oailastmodifieddate into the collection's database for each document.

File:
1 edited

Legend:

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

    r23922 r23938  
    253253
    254254    ArrayList keys = new ArrayList(info.getKeys());
    255     String lastmodified = "";
    256     if(keys.contains(OAIXML.LASTMODIFIED)) {
    257       lastmodified = info.getInfo(OAIXML.LASTMODIFIED);
    258       lastmodified = OAIXML.getTime(Long.parseLong(lastmodified)*1000); // java wants dates in milliseconds
     255    String oailastmodified = "";
     256    if(keys.contains(OAIXML.OAI_LASTMODIFIED)) {
     257      oailastmodified = info.getInfo(OAIXML.OAI_LASTMODIFIED);
     258      oailastmodified = OAIXML.getTime(Long.parseLong(oailastmodified)*1000); // java wants dates in milliseconds
    259259    }
    260260
     
    262262    Element record = OAIXML.createElement(OAIXML.RECORD);
    263263    //compose the header element
    264     record.appendChild(createHeaderElement(oid, lastmodified));     
     264    record.appendChild(createHeaderElement(oid, oailastmodified));     
    265265    //compose the metadata element
    266266    record.appendChild(createMetadataElement(prefix, info, metadata_format));
     
    332332      }
    333333      ArrayList keys = new ArrayList(info.getKeys());
    334       String lastmodified = "";
    335       if(keys.contains(OAIXML.LASTMODIFIED)) {
    336         lastmodified = info.getInfo(OAIXML.LASTMODIFIED);
    337     lastmodified = OAIXML.getTime(Long.parseLong(lastmodified)*1000); // java wants dates in milliseconds
     334      String oailastmodified = "";
     335      if(keys.contains(OAIXML.OAI_LASTMODIFIED)) {
     336        oailastmodified = info.getInfo(OAIXML.OAI_LASTMODIFIED);
     337    oailastmodified = OAIXML.getTime(Long.parseLong(oailastmodified)*1000); // java wants dates in milliseconds
    338338      }
    339339     
    340       Date this_date = OAIXML.getDate(lastmodified);       
     340      Date this_date = OAIXML.getDate(oailastmodified);       
    341341      if (from_date != null) {
    342342        if(this_date.before(from_date)) {
     
    350350      }     
    351351      //compose the header element and append it
    352       list_identifiers.appendChild(createHeaderElement(oid, lastmodified));     
     352      list_identifiers.appendChild(createHeaderElement(oid, oailastmodified));     
    353353    }//end of for(int i=0; i<oid_list.size(); i++) of doing thru each record
    354354   
     
    418418      }
    419419      ArrayList keys = new ArrayList(info.getKeys());
    420       String lastmodified = "";
    421       if(keys.contains(OAIXML.LASTMODIFIED)) {
    422         lastmodified = info.getInfo(OAIXML.LASTMODIFIED);
    423     lastmodified = OAIXML.getTime(Long.parseLong(lastmodified)*1000); // java wants dates in milliseconds
     420      String oailastmodified = "";
     421      if(keys.contains(OAIXML.OAI_LASTMODIFIED)) {
     422        oailastmodified = info.getInfo(OAIXML.OAI_LASTMODIFIED);
     423    oailastmodified = OAIXML.getTime(Long.parseLong(oailastmodified)*1000); // java wants dates in milliseconds
    424424      }
    425425     
    426       Date this_date = OAIXML.getDate(lastmodified);       
     426      Date this_date = OAIXML.getDate(oailastmodified);       
    427427      if (from_date != null) {
    428428        if(this_date.before(from_date)) {
     
    439439      list_records.appendChild(record);
    440440      //compose the header element
    441       record.appendChild(createHeaderElement(oid, lastmodified));     
     441      record.appendChild(createHeaderElement(oid, oailastmodified));     
    442442      //compose the metadata element
    443443      record.appendChild(createMetadataElement(prefix, info, metadata_format));
     
    501501  /** create a header element used when processing requests like ListRecords/GetRecord/ListIdentifiers
    502502   */
    503   private Element createHeaderElement(String oid, String lastmodified) {   
     503  private Element createHeaderElement(String oid, String oailastmodified) {   
    504504        Element header = OAIXML.createElement(OAIXML.HEADER);
    505505        Element identifier = OAIXML.createElement(OAIXML.IDENTIFIER);
     
    510510        header.appendChild(set_spec);
    511511        Element datestamp = OAIXML.createElement(OAIXML.DATESTAMP);
    512         GSXML.setNodeText(datestamp, lastmodified);
     512        GSXML.setNodeText(datestamp, oailastmodified);
    513513        header.appendChild(datestamp);
    514514        return header;
     
    656656<contains>".1;".2;".3;".4;".5;".6;".7;".8;".9
    657657<docnum>349
     658<oailastmodified>1303283795
     659<lastmodifieddate>20110412
     660<oailastmodifieddate>20110420
    658661----------------------------------------------------------------------
    659662     */
Note: See TracChangeset for help on using the changeset viewer.