Skip Headers
Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers
10g (10.1.3.1.0)

Part Number B25947-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

C.1 Validation & Defaulting (Business Logic)

Table C-1 ADF Equivalents for Oracle Forms Validation and Defaulting Triggers

Forms Trigger ADF Equivalent

WHEN-VALIDATE-RECORD

Execute validation code at the record level

In the custom EntityImpl class for your entity object, write a public method returning boolean type with a method name like validateXXXX() and have it return true if the validation succeeds or false if the validation fails. Then, add a method validator for this validation method at the entity level on the "Validation" panel for your entity object. When doing that you can associate a validation failure message with the rule at that time.

WHEN-VALIDATE-ITEM

Execute validation code at the field level

In the custom EntityImpl class for your entity object, write a public method returning boolean type and accepting a single argument of the same datatype as your attribute, having a method name like validateXXXX(). Have it return true if the validation succeeds or false if the validation fails. Then, add a method validator for this validation method at the entity attribute level for the appropriate attribute on the "Validation" panel for your entity object. When doing that you can associate a validation failure message with the rule at that time.

WHEN-DATABASE-RECORD

Execute code when a row in the datablock is marked for INSERT or UPDATE

Override the addToTransactionManager() method of your entity object. Write code after calling the super.

WHEN-CREATE-RECORD

Execute code to populate complex default values when a new record in the data block is created, without changing the modification status of the record.

Override the create() method of your entity object and after calling super, use appropriate setAttrName() methods to set default values for attributes as necessary. To eagerly set a primary key attribute to the value of a sequence, construct an instance of the SequenceImpl helper class and call its getSequenceNumber() method to get the next sequence number. Assign this value to your primary key attribute. If you want to assign the sequence number lazily, but still without using a database trigger, you can use the technique above in an overridden prepareForDML() method in your entity object. If instead you want to assign the primary key from a sequence using your own BEFOREINSERTFOREACHROW database trigger, then use the special datatype called DBSequence for your primary key attribute instead of the regular Number type.

WHEN-REMOVE-RECORD

Execute code whenever a row is removed from the data block.

Override the remove() method of your entity object and write code either before or after calling super.