Ignore:
Timestamp:
2011-12-13T10:01:05+13:00 (12 years ago)
Author:
sjm84
Message:

Adjusted how metadata names (to return) are aquired

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java

    r24867 r24889  
    2121abstract public class Action
    2222{
     23
    2324    /** the system set up variables */
    2425    protected HashMap config_params = null;
     
    8990    {
    9091        return true;
     92    }
     93
     94    protected void getRequiredMetadataNames(Element format, HashSet meta_names)
     95    {
     96        extractMetadataNames(format, meta_names);
     97        addLinkMetadataNames(format, meta_names);
    9198    }
    9299
     
    124131            meta_names.add(metadata.toString());
    125132        }
    126 
     133    }
     134
     135    protected void addLinkMetadataNames(Element format, HashSet meta_names)
     136    {
    127137        // The XSL tranform for
    128138        //   gsf:link type="source"
     
    144154        // so that we can build up the equivlink from the metadata components it needs
    145155        link_nodes = format.getElementsByTagName("gsf:equivlinkgs3");
    146         if (link_nodes != null)
    147         {
    148 
     156        if (link_nodes.getLength() > 0)
     157        {
    149158            String[] equivlink_metanames = { "equivDocIcon", "equivDocLink", "/equivDocLink" };
    150159
     
    163172                metadata.append(equivlink_metanames[i]);
    164173                meta_names.add(metadata.toString());
     174            }
     175        }
     176       
     177        NodeList image_nodes = format.getElementsByTagName("gsf:image");
     178        for(int i = 0; i < image_nodes.getLength(); i++)
     179        {
     180            if(format.getElementsByTagName("gsf:image").getLength() > 0)
     181            {
     182                meta_names.add("Thumb");
     183                meta_names.add("Screen");
     184                meta_names.add("SourceFile");
    165185            }
    166186        }
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/BrowseAction.java

    r19984 r24889  
    128128
    129129        page_response.appendChild(new_format);
    130         extractMetadataNames(new_format, metadata_names);
     130        getRequiredMetadataNames(new_format, metadata_names);
    131131        }
    132132    }
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java

    r24813 r24889  
    186186        boolean get_structure = false;
    187187        boolean get_structure_info = false;
    188         if (document_type.equals("paged"))
     188        if (document_type.equals(GSXML.DOC_TYPE_PAGED))
    189189        {
    190190            get_structure_info = true;
     191
     192            if (expand_contents)
     193            {
     194                ds_param = this.doc.createElement(GSXML.PARAM_ELEM);
     195                ds_param_list.appendChild(ds_param);
     196                ds_param.setAttribute(GSXML.NAME_ATT, "structure");
     197                ds_param.setAttribute(GSXML.VALUE_ATT, "entire");
     198            }
     199
    191200            // get teh info needed for paged naviagtion
    192201            ds_param = this.doc.createElement(GSXML.PARAM_ELEM);
     
    203212            ds_param.setAttribute(GSXML.VALUE_ATT, "siblingPosition");
    204213
    205         }
    206         else if (document_type.equals("hierarchy"))
     214            if (get_siblings)
     215            {
     216                ds_param = this.doc.createElement(GSXML.PARAM_ELEM);
     217                ds_param_list.appendChild(ds_param);
     218                ds_param.setAttribute(GSXML.NAME_ATT, "structure");
     219                ds_param.setAttribute(GSXML.VALUE_ATT, "siblings");
     220            }
     221
     222        }
     223        else if (document_type.equals(GSXML.DOC_TYPE_HIERARCHY))
    207224        {
    208225            get_structure = true;
     
    330347        if (format_elem != null)
    331348        {
    332             extractMetadataNames(format_elem, meta_names);
     349            getRequiredMetadataNames(format_elem, meta_names);
    333350        }
    334351
     
    391408        }
    392409        doc_list.appendChild(doc_node);
     410
    393411        Element dm_response_message = (Element) this.mr.process(dm_message);
    394412        if (processErrorElements(dm_response_message, page_response))
     
    671689     * ends in query). should this action do the query or should it send a
    672690     * message to the query action? but that will involve lots of extra stuff.
    673      * also doesn't handle phrases properly - just highlights all the terms found
    674      * in the text.
     691     * also doesn't handle phrases properly - just highlights all the terms
     692     * found in the text.
    675693     */
    676694    protected Element highlightQueryTerms(Element request, Element dc_response_doc_content)
     
    860878        }
    861879
    862         System.err.println(query_term_variants + " *** " + phrase_query_term_variants_hierarchy);
    863880        return highlightQueryTermsInternal(content, query_term_variants, phrase_query_term_variants_hierarchy);
    864881    }
     
    897914           
    898915            boolean is_character_letter_or_digit = Character.isLetterOrDigit(content_characters[i]);
    899 
     916           
    900917            // Has a word just started?
    901918            if (in_word == false && is_character_letter_or_digit == true)
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java

    r24393 r24889  
    334334   
    335335    protected void extractMetadataNames(Element new_format, HashSet doc_meta_names, HashSet class_meta_names) {
    336 
     336   
    337337    NodeList templates = new_format.getElementsByTagName("gsf:template");
    338338    for (int i=0; i<templates.getLength(); i++) {
     
    340340        String match = template.getAttribute("match");
    341341        if (match.equals("documentNode")) {
    342         extractMetadataNames(template, doc_meta_names);
     342            getRequiredMetadataNames(template, doc_meta_names);
    343343        } else if (match.equals("classifierNode")) {
    344         extractMetadataNames(template, class_meta_names);
     344            getRequiredMetadataNames(template, class_meta_names);
    345345        }
    346346    }
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/QueryAction.java

    r24583 r24889  
    175175        // for now just add to the response
    176176        page_response.appendChild(this.doc.importNode(format_elem, true));
    177         extractMetadataNames(format_elem, metadata_names);
     177        getRequiredMetadataNames(format_elem, metadata_names);
    178178    }
    179179   
Note: See TracChangeset for help on using the changeset viewer.