22.5. Override the event classes on a table-by-table basis

Every table object specified by a /dbforms-config/table element uses by default the standard event configuration. A developer can choose to override the event class associated to a certain event type, by adding and configuring the events element in the dbforms-config file as shown below:

   <dbforms-config>
    ...
    <table name="MYTABLE">
      <field name="TABLEID"  fieldType="varchar" size="10" isKey="true"/>
      <field name="NAME"     fieldType="varchar" size="16"/>
      ...

      <interceptor className="foo.bar.MyInterceptor"/>

      <!--
        -  Here you can specify custom event classes that override the default ones.
        -  Event properties can be configured using "property" elements.
        -->                
      <events>1
        <event type="insert" id="insert2">

          <!-- event properties configuration -->
          <property name="sourceView"  value="VIEW_USER" />
          <property name="targetTable" value="USER" />
        </event>                
      </events>

    </table>

    ...

  </dbforms-config>
      
1

To override the event classes associated to the event types, a developer must:

  • add a new /dbforms-config/table/events element, if it does not exist yet

  • add a new /dbforms-config/table/events/event element for every event class to override

22.5.1. Event attributes

Every /dbforms-config/table/events/event element uses the following mandatory attributes:

attribute namedescription
typethe event type. Must be a supported type value.
id the event identifier. Must be equal to the identifier attribute of an event specified by a /dbforms-config/events/database-events/database-event or /dbforms-config/events/navigation-events/navigation-event element.

22.5.2. Event properties configuration

Every /dbforms-config/table/events/event can be configured using a set of properties (obviously, those properties are useful only if the event class support them). To declare the properties, the developer must add to the element a set of children elements and configure their attributes.

22.5.3. Properties attributes

Every /dbforms-config/table/events/event element uses the following mandatory attributes:

attribute namedescription
namethe name of the event property.
valuethe value of the event property.

22.5.4. Example

The following example shows how to override an update event in an alias of a table.

<dbforms-config>

	<table name="explanations" ...>
		...
	</table>

	<query name="explanations_with_custom_update" from="explanations">
    	        <interceptor className="your.package.dbi.interceptor_class_name"/>
		<events>
			<event type="update" id="update2"/>
		</events>
	</query>



	<events>
   	        <!-- define database custom events here -->
		<database-events>
			<database-event id="update2" type="update" className="your.package.pluggableEvents.MyUpdateEvent"/>
		</database-events>

	</events>

</dbforms-config>