Class: GeneralValidator

field_validators.GeneralValidator()

Provide the operations necessary to do field validation.

This is a descendant of FieldValidatorTools and makes use of the method setup_field_test, when getting set up. The setup method is called from the intialize method, called by the user processing clients.

Initialization attempts to take as much as it can from the configuration to set up the tests that fields will have to pass in order that a request may proceed. It takes test information from the configuration field field_set, which is a map of form identifers to objects containing fields belonging to the forms. Each field maps to a field descriptor.

The method valid is called by the 'contractual' code when new requests come in to the contractual processing.

Constructor

new GeneralValidator()

Source:

Extends

  • FieldValidatorTools

Methods

initialize(conf_obj, db, sessions)

Takes in the configuration data necessary to intialize the application_tests table in the super (FieldValidatorTools). Calls setup_tests.

Parameters:
Name Type Description
conf_obj object
db object
sessions object
Source:

setup_tests()

Sets up the validators that will look for particular fields belonging to a query object.

The field set

Source:

valid(post_body, fields) → {boolean}

The list of fields will be from the field_set of this class. The fields will be picked out by the name of a transition or operation. If the list has not been defined by configuration, then this method will default to returning true, passing the validation of data entries (format, syntax, simple semantics).

First, if the field parameter is a string, this method searches for the fields object matching the key. Given, the parameters is a string and is not in the field_set, this method will search in the local database for the field object.

If either the fields were pasts as an object or a search proved successful in finding it, the form data of the object, post_body, will be examined using the previously configured tests in the ``application_tests` table.

Parameters:
Name Type Description
post_body object
fields object | string

either a key to a list of a list.

Source:
Returns:
Type
boolean