Changeset 24889 for main/trunk/greenstone3
- Timestamp:
- 2011-12-13T10:01:05+13:00 (12 years ago)
- 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 21 21 abstract public class Action 22 22 { 23 23 24 /** the system set up variables */ 24 25 protected HashMap config_params = null; … … 89 90 { 90 91 return true; 92 } 93 94 protected void getRequiredMetadataNames(Element format, HashSet meta_names) 95 { 96 extractMetadataNames(format, meta_names); 97 addLinkMetadataNames(format, meta_names); 91 98 } 92 99 … … 124 131 meta_names.add(metadata.toString()); 125 132 } 126 133 } 134 135 protected void addLinkMetadataNames(Element format, HashSet meta_names) 136 { 127 137 // The XSL tranform for 128 138 // gsf:link type="source" … … 144 154 // so that we can build up the equivlink from the metadata components it needs 145 155 link_nodes = format.getElementsByTagName("gsf:equivlinkgs3"); 146 if (link_nodes != null) 147 { 148 156 if (link_nodes.getLength() > 0) 157 { 149 158 String[] equivlink_metanames = { "equivDocIcon", "equivDocLink", "/equivDocLink" }; 150 159 … … 163 172 metadata.append(equivlink_metanames[i]); 164 173 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"); 165 185 } 166 186 } -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
r19984 r24889 128 128 129 129 page_response.appendChild(new_format); 130 extractMetadataNames(new_format, metadata_names);130 getRequiredMetadataNames(new_format, metadata_names); 131 131 } 132 132 } -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r24813 r24889 186 186 boolean get_structure = false; 187 187 boolean get_structure_info = false; 188 if (document_type.equals( "paged"))188 if (document_type.equals(GSXML.DOC_TYPE_PAGED)) 189 189 { 190 190 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 191 200 // get teh info needed for paged naviagtion 192 201 ds_param = this.doc.createElement(GSXML.PARAM_ELEM); … … 203 212 ds_param.setAttribute(GSXML.VALUE_ATT, "siblingPosition"); 204 213 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)) 207 224 { 208 225 get_structure = true; … … 330 347 if (format_elem != null) 331 348 { 332 extractMetadataNames(format_elem, meta_names);349 getRequiredMetadataNames(format_elem, meta_names); 333 350 } 334 351 … … 391 408 } 392 409 doc_list.appendChild(doc_node); 410 393 411 Element dm_response_message = (Element) this.mr.process(dm_message); 394 412 if (processErrorElements(dm_response_message, page_response)) … … 671 689 * ends in query). should this action do the query or should it send a 672 690 * 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 found674 * in the text.691 * also doesn't handle phrases properly - just highlights all the terms 692 * found in the text. 675 693 */ 676 694 protected Element highlightQueryTerms(Element request, Element dc_response_doc_content) … … 860 878 } 861 879 862 System.err.println(query_term_variants + " *** " + phrase_query_term_variants_hierarchy);863 880 return highlightQueryTermsInternal(content, query_term_variants, phrase_query_term_variants_hierarchy); 864 881 } … … 897 914 898 915 boolean is_character_letter_or_digit = Character.isLetterOrDigit(content_characters[i]); 899 916 900 917 // Has a word just started? 901 918 if (in_word == false && is_character_letter_or_digit == true) -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java
r24393 r24889 334 334 335 335 protected void extractMetadataNames(Element new_format, HashSet doc_meta_names, HashSet class_meta_names) { 336 336 337 337 NodeList templates = new_format.getElementsByTagName("gsf:template"); 338 338 for (int i=0; i<templates.getLength(); i++) { … … 340 340 String match = template.getAttribute("match"); 341 341 if (match.equals("documentNode")) { 342 extractMetadataNames(template, doc_meta_names);342 getRequiredMetadataNames(template, doc_meta_names); 343 343 } else if (match.equals("classifierNode")) { 344 extractMetadataNames(template, class_meta_names);344 getRequiredMetadataNames(template, class_meta_names); 345 345 } 346 346 } -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r24583 r24889 175 175 // for now just add to the response 176 176 page_response.appendChild(this.doc.importNode(format_elem, true)); 177 extractMetadataNames(format_elem, metadata_names);177 getRequiredMetadataNames(format_elem, metadata_names); 178 178 } 179 179
Note:
See TracChangeset
for help on using the changeset viewer.