Ignore:
Timestamp:
2012-07-31T11:30:08+12:00 (12 years ago)
Author:
kjdon
Message:

rank now optional for docNode as we will use these classes for browse/retrieve. getDocType now checks default_document_type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/SimpleDocument.java

    r24395 r26039  
    3939    }
    4040
    41     /** create an element to go into the search results list. A node element
    42      * has the form
    43      * <docNode nodeId='xxx' nodeType='leaf' docType='hierarchy' rank='0.23'/>
    44      */
    45     public Element createDocNode(String node_id, String rank) {
    46     // override to provide version that checks 'default_document_type'
    47  
    48     Element node = this.doc.createElement(GSXML.DOC_NODE_ELEM);
    49     node.setAttribute(GSXML.NODE_ID_ATT, node_id);
    50     node.setAttribute(GSXML.NODE_RANK_ATT, rank);
    51     String doc_type = null;
    52     if (default_document_type != null) {
    53         doc_type = default_document_type;
    54     } else {
    55         doc_type = getDocType(node_id);
    56     }
    57     node.setAttribute(GSXML.DOC_TYPE_ATT, doc_type);
    58     String node_type = getNodeType(node_id, doc_type); 
    59     node.setAttribute(GSXML.NODE_TYPE_ATT, node_type);
    60     return node;
    61     }
    62 
    63 
    6441    /** returns the document type of the doc that the specified node
    6542    belongs to. should be one of
     
    6744    GSXML.DOC_TYPE_PAGED,
    6845    GSXML.DOC_TYPE_HIERARCHY
     46    GSXML.DOC_TYPE_PAGEDHIERARCHY
    6947    default implementation returns GSXML.DOC_TYPE_SIMPLE, over ride
    7048    if documents can be hierarchical
    7149    */
    7250    public String getDocType(String node_id) {
    73     return GSXML.DOC_TYPE_SIMPLE;
     51      if (default_document_type != null) {
     52    return default_document_type;
     53      }
     54      return GSXML.DOC_TYPE_SIMPLE;
    7455    }
    7556   
Note: See TracChangeset for help on using the changeset viewer.