Changeset 12165
- Timestamp:
- 2006-07-12T11:20:03+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java
r12131 r12165 47 47 import org.w3c.dom.*; 48 48 49 /** This class provides either access to a pseudo-G3 document, or parses a collect.cfg file in such a way as to provide an xml-type view of its content. This later version is useful as it allows the manipulation and free form editing of a legacycollect.cfg file while still allowing the various CDM data managers to base themselves directly on this model (whereas they used to be independant ListModels which clobbered the ordering of unparsed commands).49 /** This class provides access to an xml-type view of the collect.cfg file. This is useful as it allows the manipulation and free form editing of a collect.cfg file while still allowing the various CDM data managers to base themselves directly on this model (whereas they used to be independant ListModels which clobbered the ordering of unparsed commands). 50 50 * @author John Thompson, Greenstone Digital Library, University of Waikato 51 51 * @version 2.3d … … 731 731 static private String levelsToString(Element command_element) { 732 732 StringBuffer text = new StringBuffer(""); 733 if( !command_element.getAttribute(ASSIGNED_ATTRIBUTE).equals(TRUE_STR)) {733 if(command_element.getAttribute(ASSIGNED_ATTRIBUTE).equals(FALSE_STR)) { 734 734 text.append("#"); 735 735 } … … 829 829 * note we are ignoring 2.39 compatibility now. */ 830 830 private void parse(File collect_cfg_file) { 831 // hack for pre 2.71 compatibility - we need to add in a 832 // build type if there is not one there 833 boolean search_types_parsed = false; 834 boolean build_types_parsed = false; 831 835 try { 832 836 … … 904 908 if(command_element == null && (command_type.equals(COLLECTIONMETADATA_PUBLIC_STR) || command_type.equals(COLLECTIONMETADATA_CREATOR_STR) || command_type.equals(COLLECTIONMETADATA_MAINTAINER_STR) || command_type.equals(BUILDTYPE_STR))) { 905 909 command_element = parseMetadataSpecial(command_str); 910 // pre 2.71 hack 911 if (command_type.equals(BUILDTYPE_STR)) { 912 build_types_parsed = true; 913 } 906 914 } 907 915 if(command_element == null && command_type.equals(PLUGIN_STR)) { … … 911 919 if(command_element == null && command_type.equals(SEARCHTYPE_STR)) { 912 920 command_element = parseSearchType(command_str); 921 // pre 2.71 hack 922 search_types_parsed = true; 923 913 924 } 914 925 if(command_element == null && command_type.equals(SUBCOLLECTION_STR)) { … … 941 952 //} 942 953 } 943 954 if (!build_types_parsed) { 955 String buildtype_type = BuildTypeManager.BUILD_TYPE_MG; 956 if (search_types_parsed) { 957 buildtype_type = BuildTypeManager.BUILD_TYPE_MGPP; 958 } 959 Element command_element = parseMetadataSpecial(BUILDTYPE_STR+" "+buildtype_type); 960 Node target_node = findInsertionPoint(command_element); 961 if(target_node != null) { 962 collect_cfg_element.insertBefore(command_element, target_node); 963 } 964 else { 965 collect_cfg_element.appendChild(command_element); 966 } 967 968 } 944 969 } 945 970 catch(Exception exception) { … … 949 974 } 950 975 976 951 977 private Element parseClassify(String command_str) { 952 978 Element command_element = null; … … 1382 1408 } 1383 1409 value = Codec.transform(value, Codec.GREENSTONE_TO_DOM); 1384 XMLTools.setValue(command_element, value); 1385 1410 XMLTools.setValue(command_element, value); 1386 1411 } 1387 1412 }
Note:
See TracChangeset
for help on using the changeset viewer.