This class implements the BPS table field validator. More...
Public Types | |
| enum | Status { StatusOK = 0 , StatusMissing = 1 , StatusInvalid = 2 , StatusDuplicate = 3 , StatusBadRef = 4 } |
| Return status from check function. More... | |
Public Member Functions | |
| Boolean | checkDelete (Object aRecord) |
| Checks if the record data is valid for delete. More... | |
| Boolean | checkInsert (Object aRecord) |
| Checks if the record data is valid for insert. More... | |
| Boolean | checkUpdate (Object aRecord) |
| Checks if the record data is valid for update. More... | |
| FieldValidator (Datastore aDatastore, String aTable) | |
| String | message (Status aStatus) |
| Get standard message for a status. More... | |
Properties | |
| String | lastColumn |
| Column on which the the last error occurred. More... | |
| Status | lastStatus |
| The status set by the recent called check method. More... | |
This class implements the BPS table field validator.
The validator must be registered in the central system settings: In folder Validators there must be a key/value pair where the key is the table name, and the value the path to the validation script.
Check out the standard validators in directory [bpsdir]/scripts/validators as reference how to implement a validator.
Example usage:
Return status from check function.
| aDatastore | The datastore connection to use. |
| aTable | The name of the table to validate for. |
| Boolean bps::FieldValidator::checkDelete | ( | Object | aRecord | ) |
Checks if the record data is valid for delete.
Stops on first fail and sets the values for lastStatus() and lastColumn().
| aRecord | The record to check, where the properties hold the column values. |
| Boolean bps::FieldValidator::checkInsert | ( | Object | aRecord | ) |
Checks if the record data is valid for insert.
Stops on first fail and sets the values for lastStatus() and lastColumn().
| aRecord | The record to check, where the properties hold the column values. |
| Boolean bps::FieldValidator::checkUpdate | ( | Object | aRecord | ) |
Checks if the record data is valid for update.
Stops on first fail and sets the values for lastStatus() and lastColumn().
| aRecord | The record to check, where the properties hold the column values. |
Get standard message for a status.
| aStatus | The status to get the message for. |
|
read |
Column on which the the last error occurred.
Empty in case last check passed.
|
read |
The status set by the recent called check method.