How do we tell DbForms when to invoke which Interface implementation?
This information is provided in the dbForms XML configuration file. Similar to the granted-privileges security-constraint, (described in the security chapter) the XML tag which defines an Interceptor has to be placed inside a <table> element.
Example 15.2. interceptor in dbforms-config.xml
<table name="customer"> <field name="id" fieldType="int" isKey="true"/> <field name="firstname" fieldType="char" /> <field name="lastname" fieldType="char" /> <field name="address" fieldType="char" /> <field name="pcode" fieldType="char" /> <field name="city" fieldType="char" /> <interceptor className = "com.foo.bar.CustomerValidatonChecker"/> <interceptor className = "com.foo.bar.TransactionLogger"/> </table>
The semantics of these declarations could be described as follows:
Invoke
com.foo.bar.CustomerValidatonChecker
and
com.foo.bar.TransactionLogger
, if the user is about to read, insert, update or delete data from table
customer and call the appropriate methods on those objects
Interceptors can also be configured in dbforms-config.xml
globally.
<dbforms-config> <interceptors> <interceptor className = "com.foo.bar.CustomerValidatonChecker"/> </interceptors> </dbforms-config>
If both ways are used, then theTable by Table interceptor will be processed first, and the Global interceptor will be processed after that. This means of course that changes to your FieldValues
in the Table by Table interceptor get passed to the Global interceptor.