Changeset 8978 for trunk/gli/src/org/greenstone/gatherer/gems/MSMUtils.java
- Timestamp:
- 2005-02-08T14:29:02+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gems/MSMUtils.java
r8971 r8978 75 75 } 76 76 77 /** Method to add an attribute element to the given element. This method makes use of the language_depend ant attribute of the document to not only determine if the attribute is language dependant, but also to see whether a Language element should be created if doesn't already exist.77 /** Method to add an attribute element to the given element. This method makes use of the language_dependent attribute of the document to not only determine if the attribute is language dependent, but also to see whether a Language element should be created if doesn't already exist. 78 78 * @param element_element the Element to add the attribute element to 79 79 * @param attribute_name_str the name of the new attribute to add as a String 80 80 * @param language_code_str the two letter code String of the language this attribute is to be added as 81 81 * @param value_str the String to be assigned as the attribute elements value 82 * @see org.greenstone.gatherer.msm.MSMUtils#isAttributeLanguageDepend ant82 * @see org.greenstone.gatherer.msm.MSMUtils#isAttributeLanguageDependent 83 83 * @see org.greenstone.gatherer.msm.MSMUtils#setValue(Element, String) 84 84 * @see org.greenstone.gatherer.util.StaticStrings#ATTRIBUTE_ELEMENT … … 96 96 97 97 // Start off by determining if we have to add this node in the new multilingual optimized way 98 if(isAttributeLanguageDepend ant(document, attribute_name_str)) {98 if(isAttributeLanguageDependent(document, attribute_name_str)) { 99 99 boolean found = false; 100 100 // Try to retrieve a language element for the given language code … … 428 428 * @param language_code_str the two letter code String indicating the desired language 429 429 * @see org.greenstone.gatherer.msm.MSMUtils#getValue 430 * @see org.greenstone.gatherer.msm.MSMUtils#isAttributeLanguageDepend ant430 * @see org.greenstone.gatherer.msm.MSMUtils#isAttributeLanguageDependent 431 431 * @see org.greenstone.gatherer.util.StaticStrings#ATTRIBUTE_ELEMENT 432 432 * @see org.greenstone.gatherer.util.StaticStrings#CODE_ATTRIBUTE … … 441 441 Document document = element_element.getOwnerDocument(); 442 442 // Determine if the attribute is language specific 443 if(isAttributeLanguageDepend ant(document, attribute_name_str)) {443 if(isAttributeLanguageDependent(document, attribute_name_str)) { 444 444 NodeList language_elements = element_element.getElementsByTagName(StaticStrings.LANGUAGE_ELEMENT); 445 445 for(int i = 0; !found && i < language_elements.getLength(); i++) { … … 738 738 * @param document the Document for which we wish to check the language requirements 739 739 * @param attribute_name_str the name of the attribute we a testing as a String 740 * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGEDEPEND ANT_ATTRIBUTE740 * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGEDEPENDENT_ATTRIBUTE 741 741 * Modified by Matthew Whyte 4/02/05 742 742 */ 743 static private boolean isAttributeLanguageDepend ant(Document document, String attribute_name_str)743 static private boolean isAttributeLanguageDependent(Document document, String attribute_name_str) 744 744 { 745 745 //gives a list of comma seperated language specific attributes. 746 String language_specific_attributes = document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPEND ANT_ATTRIBUTE).toLowerCase();746 String language_specific_attributes = document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDENT_ATTRIBUTE).toLowerCase(); 747 747 //System.err.println("lang_specific: " + language_specific_attributes); //debug 748 748 … … 759 759 } 760 760 761 /** Determine if the given document is a legacy MDS or a new multilingual one. The easiest way to tell is whether there is a language_depend ant attribute in the document element.761 /** Determine if the given document is a legacy MDS or a new multilingual one. The easiest way to tell is whether there is a language_dependent attribute in the document element. 762 762 * @param document the Document to test 763 763 * @return true if this is an old mds, false otherwise 764 * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGEDEPEND ANT_ATTRIBUTE764 * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGEDEPENDENT_ATTRIBUTE 765 765 * @see org.greenstone.gatherer.util.StaticStrings#EMPTY_STR 766 766 */ 767 767 static private boolean isLegacyMDS(Document document) { 768 ///ystem.err.println("isLegacyMDS(): l_d = " + document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPEND ANT_ATTRIBUTE));769 return (document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPEND ANT_ATTRIBUTE)).equals(StaticStrings.EMPTY_STR);768 ///ystem.err.println("isLegacyMDS(): l_d = " + document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDENT_ATTRIBUTE)); 769 return (document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDENT_ATTRIBUTE)).equals(StaticStrings.EMPTY_STR); 770 770 } 771 771 … … 809 809 * @param value_str the value String which also must match before we remove anything 810 810 * @return true if the desired attribute was successfully found and removed, false otherwise 811 * @see org.greenstone.gatherer.msm.MSMUtils#isAttributeLanguageDepend ant811 * @see org.greenstone.gatherer.msm.MSMUtils#isAttributeLanguageDependent 812 812 * @see org.greenstone.gatherer.msm.MSMUtils#getValue(Node) 813 813 * @see org.greenstone.gatherer.util.StaticStrings#ATTRIBUTE_ELEMENT … … 820 820 //Determine the if this is one of the language specific attributes. 821 821 //This can sometimes give a false result, if an attribute is made language specific half way through creation of a metadata set (or vice versa). 822 if(isAttributeLanguageDepend ant(element_element.getOwnerDocument(), attribute_name_str))822 if(isAttributeLanguageDependent(element_element.getOwnerDocument(), attribute_name_str)) 823 823 { 824 824 /*
Note:
See TracChangeset
for help on using the changeset viewer.