Changeset 4876


Ignore:
Timestamp:
2003-07-03T16:15:16+12:00 (21 years ago)
Author:
kjdon
Message:

added a new extension to OIDs: ss, specified sibling. the format is doc.sibnum.ss. sibnums go from one to num siblings (at this stage). so had to modify the translateOID method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gdbm/GDBMWrapper.java

    r4156 r4876  
    143143    /** translates oids containing .pr, .fc, .lc, .ns, .ps into proper oids
    144144     * a suffix is expected to be present so test before using
    145      * TODO: fc, lc, ns, ps, .rt*/
     145     * TODO: fc, lc, ns, ps, .rt .ss*/
    146146    public String translateOID(String oid) {
    147147
    148    
    149148    int p = oid.lastIndexOf('.');
    150149    if (p != oid.length()-3) {
     
    152151        return oid;
    153152    }
    154 
     153   
    155154    String top = oid.substring(0, p);
    156155    String suff = oid.substring(p+1);
     
    160159        return OID.getTop(top);
    161160    } else {
    162         System.out.println("looking up gdbm db");
     161        int sibling_num = 0;
     162        if (suff.equals("ss")) {
     163        // we have to remove the sib num before we get top
     164        p = top.lastIndexOf('.');
     165        sibling_num = Integer.parseInt(top.substring(p+1));
     166        top = top.substring(0, p);
     167        }
     168       
    163169        // need to get info out of gdbm db -
    164170        String doc_id = top;
     
    166172        doc_id = OID.getParent(top);
    167173        }
    168         System.out.println("doc id to lok up is"+doc_id);
    169174        DBInfo info = getInfo(doc_id);
    170175        if (info==null) {
     
    185190        return children[children.length-1];
    186191        } else {
     192        if (suff.equals("ss")) {
     193            return children[sibling_num-1];
     194        }
    187195        // find the position that we are at.
    188196        int i=0;
Note: See TracChangeset for help on using the changeset viewer.