Trigger
interface or extend the convenience class
AbstractTrigger
. Triggers have methods that fire before and after each CRUD operation. Throwing an
InvalidRequestException
on a beforeXxx method stops the request.
Trigger
interface or extend the convenience class
AbstractTrigger
. Triggers have methods that fire before and after each CRUD operation. Throwing an
InvalidRequestException
on a beforeXxx method stops the request.
The restsql.properties defines the trigger classpath and the location of the trigger properties file that maps trigger classes to SQL Resources. Following is an example:
# triggers.classpath=/absolute/path # triggers.definition=/absolute/path triggers.classpath=/opt/business/restsql/triggers triggers.definition=/etc/opt/business/restsql/triggers.properties
class=resName1,resName2,resName3,etc.
*
to indicate all SQL Resources. Following is an example of three trigger definitions:
com.company.restsql.trigger.AllFilterTrigger=* com.company.restsql.trigger.EmployeeTrigger=Employee com.company.restsql.trigger.ProjectTrigger=Project,ProjectManagement,ProjectDelta
Note that attribute validators are a lighter-weight alternative to triggers to enforce simple data type constraints. Standard validators enforce numeric ranges, string lengths and string formats (via regular expression). These are declared in the SQL Resource definition. Standard and custom attribute validators are a planned feature and not available yet. See the Core Concepts for more discussion.