Changeset 26016

Show
Ignore:
Timestamp:
24.07.2012 14:39:35 (7 years ago)
Author:
kjdon
Message:

added code to look for and display a top level format element - called 'global' in GLI

Location:
main/trunk/gli/src/org/greenstone/gatherer/cdm
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfigXMLReadWrite.java

    r25779 r26016  
    349349 
    350350    } 
    351  
     351  static private void doGlobalFormat(Document to, Element from) 
     352  { 
     353    // look for a top level format element 
     354    Element fe = (Element) XMLTools.getChildByTagName(from, StaticStrings.FORMAT_STR); 
     355    to.getDocumentElement().appendChild(doFormat(to, fe, StaticStrings.GLOBAL_STR)); 
     356  } 
    352357    static private void doDisplayFormat(Document to, Element from) 
    353358    { 
     
    13871392    } 
    13881393 
     1394  // convert global format statement 
     1395    static private void convertGlobalFormat(Document from, Document to) 
     1396    { 
     1397      Element e = XMLTools.getNamedElement(from.getDocumentElement(), StaticStrings.FORMAT_STR, StaticStrings.NAME_ATTRIBUTE, StaticStrings.GLOBAL_STR); 
     1398 
     1399    to.getDocumentElement().appendChild(convertFormat(to, e)); 
     1400 
     1401    } 
     1402   
    13891403    // Convert plugins in the internal(i.e. Document from) to collectionconfig.xml (i.e. Document to) 
    13901404    static private void convertPlugin(Document from, Document to) 
     
    23612375        doSearchType(dOc, searchNode); 
    23622376        doSearchFormat(dOc, searchNode); 
     2377        doGlobalFormat(dOc, fromElement); 
    23632378        doDisplayFormat(dOc, fromElement); 
    23642379        doReplaceListRef(dOc, fromElement); 
     
    24332448        convertMetadataList(dOc, skeleton); 
    24342449        convertDisplayItemList(dOc, skeleton); 
     2450        convertGlobalFormat(dOc, skeleton); 
    24352451        convertBuildType(dOc, skeleton); 
    24362452        convertDatabaseType(dOc, skeleton); 
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/Format4gs3Manager.java

    r25709 r26016  
    6363public class Format4gs3Manager implements SharedByTwoFormatManager 
    6464{ 
     65 
     66  // The default global format 
     67  static final private String GLOBAL_FORMAT = ""; 
     68  static final private String GLOBAL = "global"; 
    6569    //The default search format 
    6670    static final private String SEARCH_FORMAT; 
     
    169173    static final private String SEARCHTYPE_FORMAT = "plain,simpleform,advancedform"; 
    170174    static final private String SEARCHTYPE = "searchType"; 
    171     static final private String[] FEATURE_NAME = { SEARCH, DISPLAY, CLASSIFIER_DEFAULT, SEARCHTYPE }; 
    172     static final private String[] FEATURE_FORMAT = { SEARCH_FORMAT, DISPLAY_FORMAT, CLASSIFIER_DEFAULT_FORMAT, SEARCHTYPE_FORMAT }; 
     175  static final private String[] FEATURE_NAME = { GLOBAL, SEARCH, DISPLAY, CLASSIFIER_DEFAULT, SEARCHTYPE }; 
     176  static final private String[] FEATURE_FORMAT = { GLOBAL_FORMAT, SEARCH_FORMAT, DISPLAY_FORMAT, CLASSIFIER_DEFAULT_FORMAT, SEARCHTYPE_FORMAT }; 
    173177 
    174178    static private HashMap default_format_map = null; 
     
    346350    private String removeSurrondingTags(String xml) 
    347351    { 
    348         return xml.replace("<ROOTELEMENT>\n", "").replace("<ROOTELEMENT>", "").replace("</ROOTELEMENT>", ""); 
     352      return xml.replace("<ROOTELEMENT>\n", "").replace("<ROOTELEMENT>", "").replace("</ROOTELEMENT>", "").replace("<ROOTELEMENT/>",""); 
    349353    } 
    350354