Changeset 803 for trunk


Ignore:
Timestamp:
1999-12-06T10:27:30+13:00 (24 years ago)
Author:
sjboddie
Message:

added support for multiple gsdlhomes and gdbmhome

Location:
trunk/gsdl/src/colservr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/mggdbmsource.cpp

    r722 r803  
    2828/*
    2929   $Log$
     30   Revision 1.18  1999/12/05 21:27:30  sjboddie
     31   added support for multiple gsdlhomes and gdbmhome
     32
    3033   Revision 1.17  1999/10/19 03:23:40  davidb
    3134   Collection building support through web pages
     
    110113    else if (key == "collectdir") collectdir = value;
    111114    else if (key == "gsdlhome") gsdlhome = value;
     115    else if (key == "gdbmhome") gdbmhome = value;
    112116  }
    113117
     
    134138  outconvertclass text_t2ascii;
    135139 
     140  if (gdbmhome.empty()) gdbmhome = gsdlhome;
     141
    136142  if (!sourceclass::init (logout)) return false;
    137143 
    138144  // get the collection directory name
    139145  if (collectdir.empty()) {
    140     collectdir = filename_cat (gsdlhome, "collect", collection);
     146    collectdir = filename_cat (gdbmhome, "collect", collection);
    141147  }
    142148 
     
    190196}
    191197
    192 bool mggdbmsourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,
     198bool mggdbmsourceclass::get_metadata (const text_t &requestParams, const text_t &refParams,
    193199                      bool getParents, const text_tset &fields,
    194200                      const text_t &OID, MetadataInfo_tmap &metadata,
     
    264270  text_tset::const_iterator fields_here = tfields.begin();
    265271  text_tset::const_iterator fields_end = tfields.end();
     272
    266273  while (fields_here != fields_end) {
    267274    this_metadata.clear();
     
    271278    vector<infodbclass>::reverse_iterator end_info = info_array.rend();
    272279    MetadataInfo_t *tmetaptr = &this_metadata;
     280    int count = 0;
    273281    while (this_info != end_info) {
    274282
    275283      pos_metadata = (*this_info).getmultinfo(*fields_here);
    276    
    277284      if ((*fields_here == "hasnext" || *fields_here == "hasprevious")) {
    278285   
     
    283290      // cache parent contents array
    284291      text_t thisparent = get_parent (OID);
    285       if (thisparent != parentOID) {
    286         parentOID = thisparent;
    287         parentcontents.erase(parentcontents.begin(), parentcontents.end());
    288         if (gdbmptr->getinfo(parentOID, parentinfo)) {
    289           text_t &parentinfocontains = parentinfo["contains"];
    290           if (!parentinfocontains.empty())
    291         splitchar (parentinfocontains.begin(), parentinfocontains.end(),
    292                ';', parentcontents);
     292      if (!thisparent.empty()) {
     293        if (thisparent != parentOID) {
     294          parentOID = thisparent;
     295          parentcontents.erase(parentcontents.begin(), parentcontents.end());
     296          if (gdbmptr->getinfo(parentOID, parentinfo)) {
     297        text_t &parentinfocontains = parentinfo["contains"];
     298        if (!parentinfocontains.empty())
     299          splitchar (parentinfocontains.begin(), parentinfocontains.end(),
     300                 ';', parentcontents);
     301          }
    293302        }
    294       }
    295      
    296       // do tests
    297       text_tarray::const_iterator parentcontents_here = parentcontents.begin();
    298       text_tarray::const_iterator parentcontents_end = parentcontents.end();
    299       text_t shrunk_OID = OID;
    300       shrink_parent (shrunk_OID);
    301       while (parentcontents_here != parentcontents_end) {
    302         if (*parentcontents_here == shrunk_OID) {
    303           if (parentcontents_here == parentcontents.begin()) hasprevious = false;
    304           else hasprevious = true;
     303       
     304        // do tests
     305        text_tarray::const_iterator parentcontents_here = parentcontents.begin();
     306        text_tarray::const_iterator parentcontents_end = parentcontents.end();
     307        text_t shrunk_OID = OID;
     308        shrink_parent (shrunk_OID);
     309        while (parentcontents_here != parentcontents_end) {
     310          if (*parentcontents_here == shrunk_OID) {
     311        if (parentcontents_here == parentcontents.begin()) hasprevious = false;
     312        else hasprevious = true;
     313       
     314        parentcontents_here++;
     315       
     316        if (parentcontents_here == parentcontents.end()) hasnext = false;
     317        else hasnext = true;
     318       
     319        break;
     320          } 
    305321         
    306           parentcontents_here++;
    307          
    308           if (parentcontents_here == parentcontents.end()) hasnext = false;
    309           else hasnext = true;
    310          
    311           break;
    312         } 
    313        
    314         parentcontents_here ++;
    315       }
    316     } 
    317    
    318     // fill in metadata
    319     if ((*fields_here == "hasnext" && hasnext) ||
    320         (*fields_here == "hasprevious" && hasprevious))
    321       tmetaptr->values.push_back("1");
    322     else
    323       tmetaptr->values.push_back("0");
    324    
     322          parentcontents_here ++;
     323        }
     324     
     325        // fill in metadata
     326        if ((*fields_here == "hasnext" && hasnext) ||
     327        (*fields_here == "hasprevious" && hasprevious))
     328          tmetaptr->values.push_back("1");
     329        else
     330          tmetaptr->values.push_back("0");
     331      } else
     332        tmetaptr->values.push_back("0");
     333    }
    325334      }
    326       else if (pos_metadata != NULL && *fields_here != "contains")
     335      else if (pos_metadata != NULL && *fields_here != "contains") {
    327336    tmetaptr->values = *pos_metadata;
     337      }
    328338      else
    329339    tmetaptr->values.push_back("");
     
    336346    }
    337347    metadata[*fields_here] = this_metadata;
    338    
    339348    fields_here++;
    340349  }
    341 
    342350  return true;
    343351}
  • trunk/gsdl/src/colservr/mggdbmsource.h

    r650 r803  
    4242protected:
    4343  text_t gsdlhome;
     44  text_t gdbmhome;
    4445  text_t collection;
    4546  text_t collectdir;
Note: See TracChangeset for help on using the changeset viewer.