Changeset 29284 for main/trunk/gli

Show
Ignore:
Timestamp:
15.09.2014 14:38:50 (5 years ago)
Author:
kjdon
Message:

working on getting GLI not to discard the new elements in COllectionConfig.xml - security, importOption, buildOption

Files:
1 modified

Legend:

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

    r29221 r29284  
    5656 
    5757    // a list of all known top level elements 
    58     static final private String known_element_names_array[] = { StaticStrings.METADATALIST_STR, StaticStrings.DISPLAYITEMLIST_STR, StaticStrings.FORMAT_STR, StaticStrings.SEARCH_STR, StaticStrings.INFODB_STR, StaticStrings.BROWSE_STR, StaticStrings.IMPORT_STR, StaticStrings.DISPLAY_STR, StaticStrings.REPLACELISTREF_STR, StaticStrings.REPLACELIST_STR, StaticStrings.SERVICE_RACK_LIST_ELEMENT }; 
     58  static final private String known_element_names_array[] = { StaticStrings.SECURITY_STR, StaticStrings.METADATALIST_STR, StaticStrings.DISPLAYITEMLIST_STR, StaticStrings.FORMAT_STR, StaticStrings.SEARCH_STR, StaticStrings.INFODB_STR, StaticStrings.BROWSE_STR, StaticStrings.IMPORT_STR, StaticStrings.IMPORT_OPTION_STR, StaticStrings.BUILD_OPTION_STR, StaticStrings.DISPLAY_STR, StaticStrings.REPLACELISTREF_STR, StaticStrings.REPLACELIST_STR, StaticStrings.SERVICE_RACK_LIST_ELEMENT }; 
    5959    static final private Set known_element_names = new HashSet(Arrays.asList(known_element_names_array)); 
    6060 
     
    600600 
    601601    // Transform plugins (pluginListNode) of collectionConfig.xml into the internal structure (i.e. Document to) 
    602     static private void doPlugin(Document to, Node pluginListNode) 
     602    static private void doPlugins(Document to, Node pluginListNode) 
    603603    { 
    604604        Element toElement = to.getDocumentElement(); 
     
    14141414    } 
    14151415 
     1416  static private void convertSecurity(Document from, Document to) 
     1417    { 
     1418      Node security = XMLTools.getChildByTagNameIndexed(from.getDocumentElement(), StaticStrings.SECURITY_STR, 0); 
     1419      if (security != null) 
     1420        { 
     1421          Element to_element = XMLTools.duplicateElement(to, (Element) security, true); 
     1422          to.getDocumentElement().appendChild(to_element); 
     1423         
     1424        } 
     1425    } 
    14161426    static private void convertMetadataList(Document from, Document to) 
    14171427    { 
     
    15991609 
    16001610    // Convert plugins in the internal(i.e. Document from) to collectionconfig.xml (i.e. Document to) 
    1601     static private void convertPlugin(Document from, Document to) 
     1611    static private void convertPlugins(Document from, Document to) 
    16021612    { 
    16031613        Element import_element = to.createElement(StaticStrings.IMPORT_STR); 
     
    26582668        Element toElement = dOc.getDocumentElement(); 
    26592669 
     2670        // security element. For now, we just save as is, as you can't edit this in GLI. 
     2671        Node securityNode = XMLTools.getChildByTagNameIndexed(fromElement, StaticStrings.SECURITY_STR,0); 
     2672        // just save for now 
     2673        if (securityNode != null) { 
     2674          Element to_element = XMLTools.duplicateElement(dOc, (Element) securityNode, true); 
     2675          toElement.appendChild(to_element); 
     2676        } 
    26602677        // It's deliberately set that 'creator', 'maintainer', and 'public' are only in English (as they are just names). 
    26612678        // So the following ArrayList have only one element. 
     
    27032720            { 
    27042721 
    2705                 doPlugin(dOc, pluginListNode); 
     2722                doPlugins(dOc, pluginListNode); 
    27062723            } 
    27072724 
     
    27482765        } 
    27492766 
    2750         if(buildtype_value.equalsIgnoreCase("solr")) { 
     2767        if(buildtype_value.equalsIgnoreCase("solr") || buildtype_value.equalsIgnoreCase("lucene")) { 
    27512768            doSolrFacetsAndSorts(dOc, searchNode); // <facet><displayItem /></facet> and <sort><displayItem /></sort> 
     2769            // lucene will only have sort elements 
    27522770        } 
    27532771 
     
    28462864        Document skeleton = XMLTools.parseXMLFile("xml/CollectionConfig.xml", true); 
    28472865        //Element internal = dOc.getDocumentElement(); 
     2866        convertSecurity(dOc, skeleton); 
    28482867        convertMetadataList(dOc, skeleton); 
    28492868        convertDisplayItemList(dOc, skeleton); 
     
    28532872        convertIndex(dOc, skeleton); 
    28542873        convertSolrFacetsAndSorts(dOc, skeleton); 
    2855         convertPlugin(dOc, skeleton);//also do the plugout element 
     2874        convertPlugins(dOc, skeleton);//also do the plugout element 
    28562875        convertClassifier(dOc, skeleton); 
    28572876        convertSubcollectionIndexes(dOc, skeleton);