The latest JDeveloper release 12.2.1.1 came up with a new feature. Now we can define View Object level triggers just like we used to do with entities. These triggers can be used as extension points provided by the framework to interfere in the VO lifecycle with Groovy script.
There are five available trigger points at this moment:
BeforeExecute
BeforeExecute trigger fires at the very beginning of VO execute lifecycle. Basically, it is invoked by prepareRowSetForQuery method which is a good place to assign bind variable values or modify the where clause for a specific row set. The source of this trigger is VO, so we can refer to VO's methods and properties using source keyword.
Criteria
Criteria trigger fires each time whenever the framework constructs a where clause for a view critera.
The source of this trigger is VO, so the VO instance can be referred with source keyword.
CriteriaItem
CriteriaItem trigger fires each time whenever the framework constructs a where clause for a specific view critera item. So, we can specify for which VC item the trigger event should occur.
BeforeCreate
If we need to add some logic just before a new view object row is created we can use BeforeCreate trigger for that. The source of this trigger is VO row, so an instance of the VO row which is being created can be accessed with source keyword.
Modify
Whenever a VO attribute is being modified, the framework invokes Modify trigger. We can specify for which attribute the trigger should work. The source of this trigger is the VO row which is accessible with source keyword.
That's it!
There are five available trigger points at this moment:
BeforeExecute
BeforeExecute trigger fires at the very beginning of VO execute lifecycle. Basically, it is invoked by prepareRowSetForQuery method which is a good place to assign bind variable values or modify the where clause for a specific row set. The source of this trigger is VO, so we can refer to VO's methods and properties using source keyword.
Criteria
Criteria trigger fires each time whenever the framework constructs a where clause for a view critera.
The source of this trigger is VO, so the VO instance can be referred with source keyword.
CriteriaItem
CriteriaItem trigger fires each time whenever the framework constructs a where clause for a specific view critera item. So, we can specify for which VC item the trigger event should occur.
BeforeCreate
If we need to add some logic just before a new view object row is created we can use BeforeCreate trigger for that. The source of this trigger is VO row, so an instance of the VO row which is being created can be accessed with source keyword.
Modify
Whenever a VO attribute is being modified, the framework invokes Modify trigger. We can specify for which attribute the trigger should work. The source of this trigger is the VO row which is accessible with source keyword.
That's it!
No comments:
Post a Comment
Post Comment