[open-ils-commits] r7753 - trunk/Open-ILS/src/java/org/open_ils

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Aug 30 15:17:08 EDT 2007


Author: erickson
Date: 2007-08-30 15:11:05 -0400 (Thu, 30 Aug 2007)
New Revision: 7753

Added:
   trunk/Open-ILS/src/java/org/open_ils/Event.java
Log:
created an event class for modeling ILS events

Added: trunk/Open-ILS/src/java/org/open_ils/Event.java
===================================================================
--- trunk/Open-ILS/src/java/org/open_ils/Event.java	                        (rev 0)
+++ trunk/Open-ILS/src/java/org/open_ils/Event.java	2007-08-30 19:11:05 UTC (rev 7753)
@@ -0,0 +1,33 @@
+package org.open_ils;
+
+import java.util.Map;
+import java.util.HashMap;
+
+public class Event extends HashMap<String, Object> {
+
+    public Event() {
+    }
+
+    public Event(Map<String, Object> map) {
+        super(map);
+    }
+
+    public static Event parseEvent(Object map) {
+        if( map != null && map instanceof Map) {
+            Map m = (Map) map;
+            if( m.containsKey("ilsevent") && m.containsKey("textcode")) 
+                return new Event(m);
+        }
+        
+        return null;
+    }
+
+    public String getTextCode() {
+        return (String) get("textcode");
+    }
+
+    public int getCode() {
+        return Integer.parseInt((String) get("ilsevent"));
+    }
+}
+



More information about the open-ils-commits mailing list