Java IDL parser supports isnew/ischanged/isdeleted
authorBill Erickson <berick@esilibrary.com>
Thu, 5 Apr 2012 13:36:31 +0000 (09:36 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Fri, 14 Dec 2012 21:59:02 +0000 (16:59 -0500)
Includes changes to TestIDL.java for verification.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/java/org/open_ils/idl/IDLParser.java
Open-ILS/src/java/org/open_ils/test/TestIDL.java

index 4da147f..059aeb7 100644 (file)
@@ -159,6 +159,15 @@ public class IDLParser {
 
         if("class".equals(localpart)) {
 
+            String[] vfields = {"isnew", "ischanged", "isdeleted"};
+            for (String fieldName : vfields) {
+                IDLField field = new IDLField();
+                field.setName(fieldName);
+                field.setArrayPos(fieldIndex++);
+                field.setIsVirtual(true);
+                current.addField(field);
+            }
+
             if(keepIDLObjects)
                 IDLObjects.put(current.getIDLClass(), current);
 
index de778a9..c50ad62 100644 (file)
@@ -10,10 +10,11 @@ public class TestIDL {
         parser.parse();
         //System.out.print(parser.toXML());
 
-        /*
         OSRFObject bre = new OSRFObject("bre");
         bre.put("id", new Integer(1));
+        bre.put("isnew", new Boolean(false));
+        bre.put("isdeleted", new Boolean(true));
         System.out.println(bre);
-        */
+        System.out.println(new JSONWriter(bre).write());
     }
 }