Changeset 11279


Ignore:
Timestamp:
2006-02-17T11:37:59+13:00 (18 years ago)
Author:
kjdon
Message:

idNeedsTranslating now call OID.needsTranslating, also added a check for null parent id before using in when getting siblings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractDocumentRetrieve.java

    r11268 r11279  
    2727import org.greenstone.gsdl3.util.GSPath;
    2828import org.greenstone.gsdl3.util.MacroResolver;
     29import org.greenstone.gsdl3.util.OID;
    2930
    3031// XML classes
     
    236237        Element request_node = (Element) request_nodes.item(i);
    237238        String node_id = request_node.getAttribute(GSXML.NODE_ID_ATT);
     239
    238240        if (external_id) {
    239241        // can we have .pr etc extensions with external ids?
     
    245247        continue;
    246248        }
    247        
    248249        try {
    249250        Element metadata_list = getMetadataList(node_id, all_metadata, metadata_names_list);
     
    434435        //Siblings: get the other descendants of the selected node's parent
    435436        if (want_siblings) {
     437            String parent_id = getParentId(doc_id);
     438            if (parent_id != null) {
     439            // if parent == current id, then we are at the top
     440            // and can't get siblings
     441            Element parent_node = (Element)base_node.getParentNode(); // this may be the structure element if there has been no request for parents or ancestors
    436442           
    437             Element parent_node = (Element)base_node.getParentNode(); // this may be the structure element if there has been no request for parents or ancestors
    438             String parent_id = getParentId(doc_id);
    439             // add siblings, - returns a pointer to the new current node
    440             base_node = addSiblings(parent_node, parent_id, doc_id);
     443            // add siblings, - returns a pointer to the new current node
     444            base_node = addSiblings(parent_node, parent_id, doc_id);
     445            }
     446
    441447        }
    442448       
     
    591597    */
    592598    protected boolean idNeedsTranslating(String id) {
    593     if (id.length()<5) return false;
    594     String tail = id.substring(id.length()-3);
    595     return (tail.equals(".fc") || tail.equals(".lc") ||
    596         tail.equals(".pr") || tail.equals(".ns") ||
    597         tail.equals(".ps") || tail.equals(".rt") ||
    598         tail.equals(".ss"));
    599 
     599    return OID.needsTranslating(id);
    600600    }
    601601
Note: See TracChangeset for help on using the changeset viewer.