|
From: <j_m...@us...> - 2004-02-29 12:22:16
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11268/src/org/cobricks/item Modified Files: ItemManagerImpl.java Log Message: Index: ItemManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemManagerImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ItemManagerImpl.java 21 Feb 2004 18:49:40 -0000 1.4 --- ItemManagerImpl.java 29 Feb 2004 12:04:12 -0000 1.5 *************** *** 12,15 **** --- 12,16 ---- import org.cobricks.core.OntologyClass; import org.cobricks.core.OntologyClassAttr; + import org.cobricks.core.OntologyDataType; import org.cobricks.core.db.DBAccess; import org.cobricks.core.util.LogUtil; *************** *** 84,87 **** --- 85,100 ---- private XMLDBAccess xmlDBAccess; private ItemManagerDB itemManagerDB; + /** + * This is used for setting the System Property file encoding. + * See documentation for details, be careful! + */ + private String javaEncoding = "UTF-8"; + + /** + * This has to be equivalent with the java setting. (Sometimes java encoding + * names differ from xml encoding names). + */ + + private String xmlEncoding = "UTF-8"; //private org.cobricks.item.xmldb.XMLDBAccess xmlDB; *************** *** 168,178 **** itemCache = new ItemCache(cacheSize); logger.info("Initializing the XML database"); ! xmlDBAccess = new XMLDBAccess(properties, "item", (String) properties.get("configdir") + File.separator + componentId + File.separator + "dbxml" + File.separator + "item.xml"); this.itemManagerDB = new ItemManagerDB(this, coreManager.getDBAccess(), this.xmlDBAccess); } --- 181,208 ---- itemCache = new ItemCache(cacheSize); logger.info("Initializing the XML database"); ! xmlDBAccess = new XMLDBAccess(properties, "item", (String) properties.get("configdir") + File.separator + componentId + File.separator + "dbxml" + File.separator + "item.xml"); + + /*xmlDBAccess = new XMLDBAccess(properties); + xmlDBAccess.init("item", (String) + properties.get("configdir") + File.separator + + componentId + File.separator + "dbxml" + File.separator + + "item.xml"); */ + Thread init = new Thread((Runnable) this.xmlDBAccess , "init"); + + init.start(); + this.itemManagerDB = new ItemManagerDB(this, coreManager.getDBAccess(), this.xmlDBAccess); + if (properties.getProperty("item.java.file.encoding") != null){ + this.javaEncoding = properties.getProperty("item.java.file.encoding"); + } + if (properties.getProperty("item.xml.encoding")!= null){ + this.xmlEncoding = properties.getProperty("item.xml.encoding"); + } + System.setProperty("file.encoding" , this.javaEncoding); } *************** *** 239,246 **** public final Item createItem(Map attrs) { ! //I. Handle the two itemids String globalid; ! //Default policy: This is a create Method, so there must not be a given //id - it has to be created by the system, --> no interference with //other items! --- 269,276 ---- public final Item createItem(Map attrs) { ! //I. Handle the two item ids String globalid; ! //Default policy: This is a create method, so there must not be a given //id - it has to be created by the system, --> no interference with //other items! *************** *** 257,268 **** if (attrs != null) { ! //get the correct itemclass Object (not the string name) ! OntologyClass[] itemclasses = ! ItemAttrs.getItemClasses(ontology, itemClassName); //This step ensures that in case the itemClassName is //null / incorrect, the correct name is used ! itemClassName = itemclasses[0].getName(); ! //From now on, attrs contains only correct atrributes and an itemclass //value //III. Distribute the items in the correct tables --- 287,298 ---- if (attrs != null) { ! //get the correct item class object (not the string name) ! OntologyClass itemclass = ! ItemAttrs.getItemClass(ontology, itemClassName); //This step ensures that in case the itemClassName is //null / incorrect, the correct name is used ! itemClassName = itemclass.getName(); ! //From now on, attributes contains only correct attributes and an itemclass //value //III. Distribute the items in the correct tables *************** *** 299,303 **** String ckey = (String) keys[i]; itemManagerDB.storeAttribute(attrs.get(ckey), ckey, ! itemclasses, itemid); attrs.remove(ckey); } --- 329,333 ---- String ckey = (String) keys[i]; itemManagerDB.storeAttribute(attrs.get(ckey), ckey, ! itemclass, itemid); attrs.remove(ckey); } *************** *** 519,524 **** //get the correct itemclasses (not the string name) ! OntologyClass[] itemclasses = ! ItemAttrs.getItemClasses(ontology, itemClassName); //See the differences between the attributes --- 549,554 ---- //get the correct itemclasses (not the string name) ! OntologyClass itemclass = ! ItemAttrs.getItemClass(ontology, itemClassName); //See the differences between the attributes *************** *** 536,540 **** //This step ensures that in case the itemClassName is //null / incorrect, the correct name is used ! itemClassName = itemclasses[0].getName(); //III. Distribute the items in the correct tables --- 566,570 ---- //This step ensures that in case the itemClassName is //null / incorrect, the correct name is used ! itemClassName = itemclass.getName(); //III. Distribute the items in the correct tables *************** *** 542,546 **** //remove the attributes they insert: HashMap itemCacheAtts = new HashMap(attrs); ! //dbItem=all values which are stored in the table named item //III. a) Update the attributes to the special table item, if necessary --- 572,577 ---- //remove the attributes they insert: HashMap itemCacheAtts = new HashMap(attrs); ! Item it = new Item(this, itemid, globalid, itemClassName); ! it.setFromHashMap(itemCacheAtts); //dbItem=all values which are stored in the table named item //III. a) Update the attributes to the special table item, if necessary *************** *** 575,579 **** //Remove from RDB if (!ItemAttrs.attributeIsInMainTable(next)) { ! itemManagerDB.removeAttribute(next, itemclasses, itemid); } //Remove from XMLDB --- 606,610 ---- //Remove from RDB if (!ItemAttrs.attributeIsInMainTable(next)) { ! itemManagerDB.removeAttribute(next, itemclass, itemid); } //Remove from XMLDB *************** *** 584,602 **** //III. b) update the changed attrs ite = ((Set) diff.get("updated")).iterator(); ! while (ite.hasNext()) { ! String currentName = (String) ite.next(); ! if (!ItemAttrs.attributeIsInMainTable(currentName)) { ! itemManagerDB.updateAttribute(attrs.get(currentName), ! oldAtts.get(currentName), ! currentName, ! itemclasses, ! itemid); } ! ! itemManagerDB.updateAttributeXMLDB(currentName, ! oldItem, ! item, ! itemclasses); ! logger.debug("updated: " + currentName); } --- 615,637 ---- //III. b) update the changed attrs ite = ((Set) diff.get("updated")).iterator(); + try { + while (ite.hasNext()) { + String currentName = (String) ite.next(); + if (!ItemAttrs.attributeIsInMainTable(currentName)) { + itemManagerDB.updateAttribute(attrs.get(currentName), + oldAtts.get(currentName), + currentName, + itemclass, + itemid); } ! itemManagerDB.updateAttributeXMLDB(currentName, ! oldItem, ! item, ! itemclass); ! logger.debug("updated: " + currentName); ! } ! } catch (Exception e) { ! logger.warn("Exception occured while updating single attributes" + "in xmldb."); ! this.itemManagerDB.performSafeUpdate(it); } *************** *** 608,618 **** if (!ItemAttrs.attributeIsInMainTable(currentName)) { itemManagerDB.storeAttribute(attrs.get(currentName), currentName, ! itemclasses, itemid); } itemManagerDB.insertAttributeXML(currentName, item); logger.debug("added: " + currentName); } //instantiate item for the item cache ! Item it = new Item(this, itemid, globalid, itemClassName); ! it.setFromHashMap(itemCacheAtts); itemCache.updateItem(it); } --- 643,652 ---- if (!ItemAttrs.attributeIsInMainTable(currentName)) { itemManagerDB.storeAttribute(attrs.get(currentName), currentName, ! itemclass, itemid); } itemManagerDB.insertAttributeXML(currentName, item); logger.debug("added: " + currentName); } //instantiate item for the item cache ! itemCache.updateItem(it); } *************** *** 627,650 **** /** ! * Instantiates an Object of type User, Item or Category ! * @param ontologyType HashMap consisting of: String: keyWordName, ! * String:inBrackets, String:inParanthesis, Boolean:hasBrackets, ! * Boolean:hasParanthesis * @param id The ID of the specified attribute ! * @return An Object of type User, Item or Category */ ! private Object instantiate(HashMap ontologyType, int id) { ! boolean hasBrackets = ! ((Boolean) ontologyType.get("hasBrackets")).booleanValue(); ! boolean hasParanthesis = ! ((Boolean) ontologyType.get("hasParanthesis")).booleanValue(); ! String keyWordName = (String) ontologyType.get("keyWordName"); ! String inBrackets = (String) ontologyType.get("inBrackets"); ! String inParanthesis = (String) ontologyType.get("inParanthesis"); ! logger.debug("instantiate: " + keyWordName + " with ID " + new Integer(id).toString()); ! if (keyWordName.equals("user")) { try { UserManager userManager = --- 661,677 ---- /** ! * Instantiates an object of type User, Item or Category ! * @param ontType The ontology data type * @param id The ID of the specified attribute ! * @return An object of type User, Item or Category */ ! protected Object instantiate(OntologyDataType ontType, int id) { ! String typeName = ontType.getTypeName(); ! ! logger.debug("instantiate: " + typeName + " with ID " + new Integer(id).toString()); ! if (typeName.equals("user")) { try { UserManager userManager = *************** *** 653,659 **** User user = userManager.getUser(id); ! if (hasParanthesis) { //user(userclassname) ! if (user.getObjectClass().equals(inParanthesis)) { //tbd: getObjectClass() is the wrong method //and do another check (user could be in a userclass --- 680,686 ---- User user = userManager.getUser(id); ! if (ontType.hasSubtype()) { //user(userclassname) ! if (user.getObjectClass().equals(ontType.getSubtypeName())) { //tbd: getObjectClass() is the wrong method //and do another check (user could be in a userclass *************** *** 679,683 **** return null; } ! } else if (keyWordName.equals("category")) { try { CategoryManager categoryManager = --- 706,710 ---- return null; } ! } else if (typeName.equals("category")) { try { CategoryManager categoryManager = *************** *** 686,692 **** Category category = categoryManager.getCategory(id); ! if (hasParanthesis) { //category(categoryclassname) ! if (category.getCategoryClass().equals(inParanthesis)) { //category belongs to the correct categoryclass return category; --- 713,719 ---- Category category = categoryManager.getCategory(id); ! if (ontType.hasSubtype()) { //category(categoryclassname) ! if (category.getCategoryClass().equals(ontType.getSubtypeName())) { //category belongs to the correct categoryclass return category; *************** *** 708,718 **** return null; } ! } else if (keyWordName.equals("item")) { try { Item item = this.getItem(id); ! if (hasParanthesis) { //item(itemclassname) ! if (item.getItemClass().equals(inParanthesis)) { //item belongs to the correct itemclass return item; --- 735,745 ---- return null; } ! } else if (typeName.equals("item")) { try { Item item = this.getItem(id); ! if (ontType.hasSubtype()) { //item(itemclassname) ! if (item.getItemClass().equals(ontType.getSubtypeName())) { //item belongs to the correct itemclass return item; *************** *** 735,739 **** } } else { ! logger.warn("instantiate: Illegal argument: " + keyWordName); return null; --- 762,766 ---- } } else { ! logger.warn("instantiate: Illegal argument: " + typeName); return null; *************** *** 746,774 **** * @param n Node where the information about the String or the Set of String * is stored ! * @param ontologyType HashMap consisting of: String: keyWordName, ! * String:inBrackets, String:inParanthesis, Boolean:hasBrackets, ! * Boolean:hasParanthesis ! * @param ontKeyWord String that specifies the datatype for org.w3c.dom.Node * n according to the ontology * @return String or Set of String */ ! private Object handleString(Node n, HashMap ontologyType, String ontKeyWord) { ! boolean hasBrackets = ! ((Boolean) ontologyType.get("hasBrackets")).booleanValue(); ! boolean hasParanthesis = ! ((Boolean) ontologyType.get("hasParanthesis")).booleanValue(); ! String keyWordName = (String) ontologyType.get("keyWordName"); ! String inBrackets = (String) ontologyType.get("inBrackets"); ! String inParanthesis = (String) ontologyType.get("inParanthesis"); ! if (hasBrackets) { ! if (hasParanthesis) { //error (wrong syntax) logger.warn("handleString: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); ! return null; } ! if (inBrackets.equals("$")) { //List of string LinkedList list = new LinkedList(); --- 773,791 ---- * @param n Node where the information about the String or the Set of String * is stored ! * @param ontologyType The ontology data type * n according to the ontology * @return String or Set of String */ ! private Object handleString(Node n, OntologyDataType ontologyType) ! throws java.lang.StringIndexOutOfBoundsException { ! if (ontologyType.isCollection()) { ! if (ontologyType.hasMaxLength()) { //error (wrong syntax) logger.warn("handleString: Error while processing an " ! + "ontology keyword. Check syntax of " + ontologyType.toString()); return null; } ! if (ontologyType.isList()) { //List of string LinkedList list = new LinkedList(); *************** *** 776,780 **** while (child != null) { ! Object temp = extractFromXMLNode(child, "string"); if (temp != null) { --- 793,797 ---- while (child != null) { ! Object temp = extractFromXMLNode(child, ontologyType.getCollectionElementType()); if (temp != null) { *************** *** 790,794 **** return null; } ! } else if (inBrackets.equals("")) { //Set of string HashSet set = new HashSet(); --- 807,811 ---- return null; } ! } else if (ontologyType.isSet()) { //Set of string HashSet set = new HashSet(); *************** *** 796,800 **** while (child != null) { ! Object temp = extractFromXMLNode(child, keyWordName); if (temp != null) { --- 813,818 ---- while (child != null) { ! ! Object temp = extractFromXMLNode(child, ontologyType.getCollectionElementType()); if (temp != null) { *************** *** 812,840 **** } else { //error (wrong syntax) logger.warn("handleString: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); ! ! return null; ! } ! } else if (hasParanthesis) { //string with length descriptor ! ! int length; ! ! try { ! length = Integer.parseInt(inParanthesis); ! } catch (NumberFormatException e) { ! logger.warn(LogUtil.exception("handleString: Error while " ! + "trying to get the length descriptor of " ! + ontKeyWord, e)); return null; } String value = n.getFirstChild().getNodeValue(); ! if (value.length() > length) { //string is too long logger.info("handleString: String " + value + " is too " + "long. I have to shorten it."); ! return value.substring(0, length); } else { return value; --- 830,846 ---- } else { //error (wrong syntax) logger.warn("handleString: Error while processing an " ! + "ontology keyword. Check syntax of " + ontologyType.toString()); return null; } + } else if (ontologyType.hasMaxLength()) { //string with length descriptor String value = n.getFirstChild().getNodeValue(); ! if (value.length() > ontologyType.getMaxLength()) { //string is too long logger.info("handleString: String " + value + " is too " + "long. I have to shorten it."); ! return value.substring(0, ontologyType.getMaxLength()); } else { return value; *************** *** 851,879 **** * @param n Node where the information about the Integer or the Set of * Integer is stored ! * @param ontologyType HashMap consisting of: String: keyWordName, ! * String:inBrackets, String:inParanthesis, Boolean:hasBrackets, ! * Boolean:hasParanthesis ! * @param ontKeyWord String that specifies the datatype for org.w3c.dom.Node * n according to the ontology * @return Integer or Set of Integer */ ! private Object handleInt(Node n, HashMap ontologyType, String ontKeyWord) { ! boolean hasBrackets = ! ((Boolean) ontologyType.get("hasBrackets")).booleanValue(); ! boolean hasParanthesis = ! ((Boolean) ontologyType.get("hasParanthesis")).booleanValue(); ! String keyWordName = (String) ontologyType.get("keyWordName"); ! String inBrackets = (String) ontologyType.get("inBrackets"); ! String inParanthesis = (String) ontologyType.get("inParanthesis"); ! if (hasParanthesis) { //error (wrong syntax) logger.warn("handleInt: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); return null; } ! if (hasBrackets) { ! if (inBrackets.equals("")) { //Set of Integer HashSet set = new HashSet(); --- 857,875 ---- * @param n Node where the information about the Integer or the Set of * Integer is stored ! * @param ontType The ontology data type * n according to the ontology * @return Integer or Set of Integer */ ! private Object handleInt(Node n, OntologyDataType ontType) { ! if (ontType.hasMaxLength() || ontType.hasSubtype()) { //error (wrong syntax) logger.warn("handleInt: Error while processing an " ! + "ontology keyword. Check syntax of " + ontType.toString()); return null; } ! ! if (ontType.isSet()) { //Set of Integer HashSet set = new HashSet(); *************** *** 881,885 **** while (child != null) { ! Object temp = extractFromXMLNode(child, keyWordName); if (temp != null) { --- 877,881 ---- while (child != null) { ! Object temp = extractFromXMLNode(child, ontType); if (temp != null) { *************** *** 895,904 **** return null; } ! } else { //error (wrong syntax) logger.warn("handleInt: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); return null; ! } } else { //int (->Integer) --- 891,900 ---- return null; } ! } else if(ontType.isList()) { //error (wrong syntax) logger.warn("handleInt: Error while processing an " ! + "ontology keyword. Check syntax of " + ontType.toString()); return null; ! } else { //int (->Integer) *************** *** 946,1004 **** * the handleString-method, to handle Integer it calls the method handleInt. * @param n The org.w3c.dom.Node that should be extracted ! * @param ontKeyWord String that specifies the datatype for org.w3c.dom.Node n ! * according to the ontology * @return The Object of type List of String, Set of String, Set of Integer, * Set of User, Set of Item, Set of Category, String, Integer, Boolean, User * , Category, Item, Date, Datetime if possible; otherwise null */ ! private Object extractFromXMLNode(Node n, String ontKeyWord) { if (n instanceof Element) { - // I. Splitting the keyword into separate pieces: Name, content - // of brackets and content of paranthesis - HashMap ontologyType; - - try { - ontologyType = ItemAttrs.tokenizeOntologyKeyWord(ontKeyWord); - } catch (java.lang.StringIndexOutOfBoundsException e) { - logger.warn( - "Error while parsing an ontology Keyword. Check Syntax of " - + ontKeyWord); - - return null; - } try { ! boolean hasBrackets = ! ((Boolean) ontologyType.get("hasBrackets")).booleanValue(); ! boolean hasParanthesis = ! ((Boolean) ontologyType.get("hasParanthesis")).booleanValue(); ! String keyWordName = (String) ontologyType.get("keyWordName"); ! String inBrackets = (String) ontologyType.get("inBrackets"); ! String inParanthesis = ! (String) ontologyType.get("inParanthesis"); ! ! if (keyWordName.equals("string")) { ! return handleString(n, ontologyType, ontKeyWord); ! } else if (keyWordName.equals("int")) { ! return handleInt(n, ontologyType, ontKeyWord); ! } else if ((keyWordName.equals("user")) ! || (keyWordName.equals("item")) ! || (keyWordName.equals("category"))) { ! if (hasBrackets) { ! if (inBrackets.equals("")) { //Set of user, HashSet set = new HashSet(); Node child = n.getFirstChild(); ! String argument = keyWordName; ! ! if (hasParanthesis) { //Set of user(userclassname), ! ! //item(itemclassname) or category(categoryclassname) ! argument += ("(" + inParanthesis + ")"); ! } ! while (child != null) { Object temp = ! extractFromXMLNode(child, argument); if (temp != null) { --- 942,971 ---- * the handleString-method, to handle Integer it calls the method handleInt. * @param n The org.w3c.dom.Node that should be extracted ! * @param ontType The ontology data type for org.w3c.dom.Node n * @return The Object of type List of String, Set of String, Set of Integer, * Set of User, Set of Item, Set of Category, String, Integer, Boolean, User * , Category, Item, Date, Datetime if possible; otherwise null */ ! private Object extractFromXMLNode(Node n, OntologyDataType ontType) { if (n instanceof Element) { try { ! String typeName = ontType.getTypeName(); ! if (typeName.equals("string")) { ! return handleString(n, ontType); ! } else if (typeName.equals("int")) { ! return handleInt(n, ontType); ! } else if ((typeName.equals("user")) ! || (typeName.equals("item")) ! || (typeName.equals("category"))) { ! ! if (ontType.isSet()) { //Set of user, item or category HashSet set = new HashSet(); Node child = n.getFirstChild(); ! while (child != null) { Object temp = ! extractFromXMLNode(child, ontType.getCollectionElementType()); if (temp != null) { *************** *** 1014,1025 **** return null; } ! } else { //error (wrong syntax) logger.warn( "extractFromXMLNode: Error while processing an " + "ontology keyword. Check syntax of " ! + ontKeyWord); return null; ! } } else { //user,user(userclassname),item,item(itemclassname), --- 981,992 ---- return null; } ! } else if(ontType.isList()) { //error (wrong syntax) logger.warn( "extractFromXMLNode: Error while processing an " + "ontology keyword. Check syntax of " ! + ontType.toString()); return null; ! } else { //user,user(userclassname),item,item(itemclassname), *************** *** 1028,1084 **** Integer.parseInt(((Element) n).getAttribute("id")); ! return instantiate(ontologyType, id); } ! } else if (keyWordName.equals("date")) { ! if (hasBrackets || hasParanthesis) { //error (wrong syntax) ! logger.warn( ! "extractFromXMLNode: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); return null; ! } else { //date DateFormat dateFormat = DateFormat.getDateInstance(); return dateFormat.parse(n.getFirstChild().getNodeValue()); ! } ! } else if (keyWordName.equals("datetime")) { ! if (hasBrackets || hasParanthesis) { //error (wrong syntax) ! logger.warn( ! "extractFromXMLNode: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); ! ! return null; ! } else { //datetime (->Timestamp) return Timestamp.valueOf(n.getFirstChild().getNodeValue()); ! } ! } else if ((keyWordName.equals("uri")) ! || (keyWordName.equals("text"))) { ! if (hasBrackets || hasParanthesis) { //error (wrong syntax) ! logger.warn( ! "extractFromXMLNode: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); ! ! return null; ! } else { //uri or text (->String) return (n.getFirstChild().getNodeValue()); ! } ! } else if (keyWordName.equals("boolean")) { ! if (hasBrackets || hasParanthesis) { //error (wrong syntax) ! logger.warn( ! "extractFromXMLNode: Error while processing an " ! + "ontology keyword. Check syntax of " + ontKeyWord); ! ! return null; ! } else { //boolean return Boolean.valueOf(n.getFirstChild().getNodeValue()); ! } } else { // not supported datatype logger.warn("extractFromXMLNode: Missing or not supported " ! + "datatype: " + keyWordName); return null; --- 995,1031 ---- Integer.parseInt(((Element) n).getAttribute("id")); ! return instantiate(ontType, id); } ! } else if (ontType.isCollection() || ontType.hasMaxLength() ! || ontType.hasSubtype()) { //error (wrong syntax) ! logger.warn( ! "extractFromXMLNode: Error while processing an " ! + "ontology keyword. Check syntax of " + ontType.toString()); return null; ! ! } else if (typeName.equals("date")) { //date DateFormat dateFormat = DateFormat.getDateInstance(); return dateFormat.parse(n.getFirstChild().getNodeValue()); ! ! } else if (typeName.equals("datetime")) { //datetime (->Timestamp) return Timestamp.valueOf(n.getFirstChild().getNodeValue()); ! ! } else if ((typeName.equals("uri")) ! || (typeName.equals("text"))) { //uri or text (->String) return (n.getFirstChild().getNodeValue()); ! ! } else if (typeName.equals("boolean")) { //boolean return Boolean.valueOf(n.getFirstChild().getNodeValue()); ! } else { // not supported datatype logger.warn("extractFromXMLNode: Missing or not supported " ! + "datatype: " + ontType.toString()); return null; *************** *** 1191,1195 **** // Additional attribute or attribute that // wasn't defined in the itemontology ! value = extractFromXMLNode(child, "string"); logger.info("extractFromXMLDocument: No " + "corresponding datatype found in " --- 1138,1142 ---- // Additional attribute or attribute that // wasn't defined in the itemontology ! value = extractFromXMLNode(child, new OntologyDataType("string")); logger.info("extractFromXMLDocument: No " + "corresponding datatype found in " *************** *** 1199,1205 **** } else { // Attribute was defined in the itemontology ! String datatype = ontattr.getType(); ! ! if (datatype.equals("xml")) { // Attribute is of type XML value = extractFromXMLString(xml, tag); --- 1146,1152 ---- } else { // Attribute was defined in the itemontology ! OntologyDataType datatype = ontattr.getOntologyDataType(); ! String type = datatype.getTypeName(); ! if (type.equals("xml")) { // Attribute is of type XML value = extractFromXMLString(xml, tag); *************** *** 1226,1230 **** child = child.getNextSibling(); ! } catch (NumberFormatException e) { logger.warn(LogUtil.exception( "extractFromXMLDocument: " --- 1173,1177 ---- child = child.getNextSibling(); ! } catch (java.lang.StringIndexOutOfBoundsException e) { logger.warn(LogUtil.exception( "extractFromXMLDocument: " *************** *** 1367,1369 **** --- 1314,1325 ---- permission); } + /** + * This method returns the xml encoding for all items and for all item + * attributes + * @return Encoding type according to the xml standards. + */ + public final String getXMLEncoding() { + return this.xmlEncoding; + } + } |