22.4. Override the default event classes

The declarative event configuration system let developers change the default event classes with custom ones. In this manner, every table element uses those event classes instead of the default ones.

22.4.1. global overriding

To override a default event class in a global way, it is sufficient to:

  • declare a new database-event or navigation-event element

  • set the value of its type attribute with a suppored event type value

  • set the value of its className attribute with the full qualified class name of your custom event class

Example:

  
  <events>
    <database-events>
      <database-event type="update" className="org.foo.bar.MyUpdateEvent"/> 
    </database-events>
  </events>
        

This configuration overrides the default update event class with the custom org.foo.bar.MyUpdateEvent one.

All the table elements will use the custom org.foo.bar.MyUpdateEvent class instead of the default one (org.dbforms.event.UpdateEvent).

22.4.2. Log information about event override

DbForms logs any information regarding the event class override procedure.

Here's an example log statement that shows that the custom "org.foo.bar.MyUpdateEvent" update event class overrides the default "org.dbforms.event.UpdateEvent" one.

  ::addEventInfo - the event information having id, class [update, org.foo.bar.MyUpdateEvent] 
                   overrides the event class [org.dbforms.event.UpdateEvent]