From 65f8e2a5fc3650dd721ac7db7cb695caa56e64c7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 24 Feb 2012 16:33:58 -0500 Subject: [PATCH] Java IDL parser updated to use derived field array index The "array_position" IDL attribute is deprecated. Determine the index by field position within the XML. Signed-off-by: Bill Erickson --- Open-ILS/src/java/org/open_ils/idl/IDLParser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/java/org/open_ils/idl/IDLParser.java b/Open-ILS/src/java/org/open_ils/idl/IDLParser.java index a82b25d732..0c2f8de38d 100644 --- a/Open-ILS/src/java/org/open_ils/idl/IDLParser.java +++ b/Open-ILS/src/java/org/open_ils/idl/IDLParser.java @@ -29,6 +29,7 @@ public class IDLParser { InputStream inStream; HashMap IDLObjects; IDLObject current; + private int fieldIndex; /** If true, we retain the full set of IDL objects in memory. This is true by default. */ private boolean keepIDLObjects; @@ -39,6 +40,7 @@ public class IDLParser { IDLObjects = new HashMap(); keepIDLObjects = true; parsedObjectCount = 0; + fieldIndex = 0; } public IDLParser(String fileName) throws IOException { @@ -122,6 +124,7 @@ public class IDLParser { String localpart = reader.getLocalName(); if( "class".equals(localpart) ) { + fieldIndex = 0; current = new IDLObject(); current.setIDLClass(reader.getAttributeValue(null, "id")); current.setController(reader.getAttributeValue(null, "controller")); @@ -133,9 +136,10 @@ public class IDLParser { if( "field".equals(localpart) ) { IDLField field = new IDLField(); field.setName(reader.getAttributeValue(null, "name")); - field.setArrayPos(new Integer(reader.getAttributeValue(OILS_NS_OBJ, "array_position"))); + field.setArrayPos(fieldIndex); field.setIsVirtual("true".equals(reader.getAttributeValue(OILS_NS_PERSIST, "virtual"))); current.addField(field); + fieldIndex++; } if( "link".equals(localpart) ) { -- 2.11.0