} }
DataEvent toFire; if (e instanceof DeleteEvent) { if (m_before) { toFire = new BeforeDeleteEvent(obj); } else { toFire = new AfterDeleteEvent(obj); } } else { if (m_before) { toFire = new BeforeSaveEvent(obj); } else { toFire = new AfterSaveEvent(obj); } }
        public void flush() {            Set objs = new HashSet();            List events = new LinkedList();            for (int i = m_events.size() - 1; i >= 0; i--) {                Event e = (Event) m_events.get(i);                DataObjectImpl obj = (DataObjectImpl) e.getObject();                if (!objs.contains(obj)) {                    events.add(0, e);                    objs.add(obj);                }            }            for (Iterator it = events.iterator(); it.hasNext(); ) {                Event e = (Event) it.next();                DataObjectImpl obj = (DataObjectImpl) e.getObject();                if (e instanceof DeleteEvent) {                    if (m_before) {                        fireEvent(new BeforeDeleteEvent(obj));                    } else {                        fireEvent(new AfterDeleteEvent(obj));                    }                } else {                    if (m_before) {                        fireEvent(new BeforeSaveEvent(obj));                    } else {                        fireEvent(new AfterSaveEvent(obj));                    }                }            }            m_events.clear();        }