Learning external validation types

There are three categories of external validation: fixed type data validation, variable type data validation, and context only validation.

  • Fixed type data validation—Targets data of a typed Java™ class (for example, party object of party Java class). The data type is not changeable at deployment time or runtime, so it is called fixed type data.

    Fixed type validation can be applied using element (field) validation, which applies validation on a single field of an object; or group (cross field) validation, which applies validation on multiple fields of an object graph.

  • Variable type data validation—Targets data of a typed XML schema. For example, provide party demographics where a given demographic type is described in an XSD (defined within a spec) and store the actual demographic data for a party as XML. Another example is product data that is stored as XML based on specs described in the product's type. The data type is changeable at deployment or runtime, so it is called variable type data. For more information on specs, see Developing with specs.
    Variable type validation can be applied using:
    • XSD schema validation—This schema validation is not context sensitive. It is either executed or not executed and is equivalent to setting context to GENERAL. It can only apply to an XML leaf node and does not handle any cross node validation. XSD schema validation supports the following type constraints:
      XML type Possible type constraints
      String length, minLength, maxLength, pattern, enumeration, whiteSpace
      Boolean pattern, whiteSpace
      Decimal totalDigits, fractionDigits, pattern, whiteSpace, enumeration, maxInclusive, maxExclusive, minInclusive, minExclusive
      DateTime pattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
    • Spec validation—This spec validation uses metadata defined for a spec schema to validate both single XML node and cross XML nodes. It can have user defined functions. This spec validation can be defined as context sensitive; for example, it is executed when it is a CREATE transaction.
  • Context only validation—Does not support a group or element specification (which is in contrast to fixed type data validation method, where you must specify a group or element, such as a business object or attribute, to validate). Instead, you specify a transaction type and therefore it is expected the validator already knows the type of data that requires validation. For example, if the validation context is specific (such as the add party transaction), then the validator already knows the target data is a party business object.