Changeset 22381
- Timestamp:
- 2010-07-13T12:08:12+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfigXMLReadWrite.java
r22346 r22381 874 874 Element toElement = to.getDocumentElement (); 875 875 876 Node replace_element = XMLTools.getChildByTagName (from, StaticStrings.REPLACELISTREF_STR); 877 if (replace_element == null) { 878 return; // such an element not found 879 } 880 881 Element to_element = XMLTools.duplicateElement (to, (Element)replace_element, true); 882 toElement.appendChild (to_element); 876 NodeList replace_elements = from.getElementsByTagName(StaticStrings.REPLACELISTREF_STR); 877 int num_elems = replace_elements.getLength(); 878 if (num_elems < 1) { 879 return; 880 } 881 for (int i=0; i<num_elems; i++) { 882 Element to_element = XMLTools.duplicateElement (to, (Element)replace_elements.item(i), true); 883 toElement.appendChild (to_element); 884 } 883 885 } 884 886 static private void convertReplaceListRef (Document from, Document to) { 885 887 Element toElement = to.getDocumentElement (); 886 888 887 Node replace_element = XMLTools.getChildByTagName (from.getDocumentElement (), StaticStrings.REPLACELISTREF_STR); 888 if (replace_element == null) { 889 NodeList replace_elements = from.getDocumentElement().getElementsByTagName(StaticStrings.REPLACELISTREF_STR); 890 int num_elems = replace_elements.getLength(); 891 if (num_elems < 1) { 892 return; 893 } 894 for (int i=0; i<num_elems; i++) { 895 Element to_element = XMLTools.duplicateElement (to, (Element)replace_elements.item(i), true); 896 toElement.appendChild (to_element); 897 } 898 } 899 900 /** serviceRackList is currently not editable in GLI - just copy it in from config file and write it out again. */ 901 static private void doServiceRackList (Document to, Element from) { 902 Element toElement = to.getDocumentElement (); 903 904 Node srl_element = XMLTools.getChildByTagName (from, StaticStrings.SERVICE_RACK_LIST_ELEMENT); 905 if (srl_element == null) { 889 906 return; // such an element not found 890 907 } 891 908 892 Element to_element = XMLTools.duplicateElement (to, (Element) replace_element, true);909 Element to_element = XMLTools.duplicateElement (to, (Element)srl_element, true); 893 910 toElement.appendChild (to_element); 894 911 } 895 static private void doOAIElement (Document to, Element from) {912 static private void convertServiceRackList (Document from, Document to) { 896 913 Element toElement = to.getDocumentElement (); 897 914 898 Node oai_element = XMLTools.getChildByTagName (from, StaticStrings.OAI_ELEMENT);899 if ( oai_element == null) {915 Node srl_element = XMLTools.getChildByTagName (from.getDocumentElement (), StaticStrings.SERVICE_RACK_LIST_ELEMENT); 916 if (srl_element == null) { 900 917 return; // such an element not found 901 918 } 902 919 903 Element to_element = XMLTools.duplicateElement (to, (Element)oai_element, true); 904 toElement.appendChild (to_element); 905 } 906 static private void convertOAIElement (Document from, Document to) { 907 Element toElement = to.getDocumentElement (); 908 909 Node oai_element = XMLTools.getChildByTagName (from.getDocumentElement (), StaticStrings.OAI_ELEMENT); 910 if (oai_element == null) { 911 return; // such an element not found 912 } 913 914 Element to_element = XMLTools.duplicateElement (to, (Element)oai_element, true); 920 Element to_element = XMLTools.duplicateElement (to, (Element)srl_element, true); 915 921 toElement.appendChild (to_element); 916 922 } … … 2026 2032 doDisplayFormat (dOc, fromElement); 2027 2033 doReplaceListRef (dOc, fromElement); 2028 do OAIElement (dOc, fromElement);2034 doServiceRackList (dOc, fromElement); 2029 2035 2030 2036 } … … 2062 2068 convertDisplayFormat (dOc, skeleton); 2063 2069 convertReplaceListRef (dOc, skeleton); 2064 convert OAIElement(dOc, skeleton);2070 convertServiceRackList(dOc, skeleton); 2065 2071 2066 2072 return skeleton;
Note:
See TracChangeset
for help on using the changeset viewer.