Validators are configured using an XML-combining XML file. The payloadschema.xml file defines the top-level payload-schemas and child schema tags, giving each schema tag a unique ID. Each schema tag represents a java-bean class or a repository item type and specifies the entity that validation input represents. Note that a validator can be run on inputs of other types, such as a JSONObject, as well as update other types, such as an empty HashMap.

The following table describes a few of the XML attributes from the payloadSchema.xml file that can be used during filtering and validation. For a full list, refer to the ATG Platform API Reference:

XML Attribute

Description

hidden

This attribute on the schema or bean-property elements identifies if a property is hidden from the output. The default is false. Refer to the Validating Input and Filtering Output section for instructions on using this attribute.

id

The unique ID of the schema.

include-all-simple

This attribute on the schema or bean-property elements allows you to include all simple properties. This flag also includes containers, such as collections and maps, which can be introspected to contain simple properties. Refer to the Validating Input and Filtering Output section for instructions on using this attribute.

include-schema-id

The ID of the schema from which to inherit.

include-simple-properties-from

This element allows the simple properties of a sub-property to be exposed as its own properties.

internal-property-name

This attribute on the property element allows a property to be aliased and allows the simple property of a sub-bean to be exposed as a property of its parent. Dot notation is supported.

property-customizer

This attribute on the property element allows you to declare a Nucleus component that customizes the output value. The Nucleus component must be a class that implements the atg.service.filter.bean.PropertyCustomizer interface.

switches-first

Identifies if switches should be performed before contained property and bean-property validations. May not be needed, for example, if the SwitchingUpdatingValidator subclass creates the target bean.

treat-container-as-bean

This attribute on the schema or bean-property elements identifies the container object as a normal bean. For example, if the state of the representation model is a Map, the properties defined for the schema or bean-property will correspond to the Map keys when the treat-container-as-bean property is set to true. The default is false. For additional information on this attribute, refer to the Validating Collections section.

writeable

Indicates if the schema can be used for updates. If set to false, no validator is created.

In addition to the XML attributes listed above, you can use the embedded XML tag, which determines how embedded resources filter output as part of the root resource. This element has hidden and use-schema-id attributes. The hidden attribute decides if the full embedded resource will be output. If hidden=true, only a self link for the embedded resource will display. The use-schema-id attribute indicates the schema to use when filtering the embedded resource. If an embedded resource exists for a root resource, but no corresponding embedded tag is specified in the payloadSchema.xml, there will be no output for that embedded resource.

The property and bean-property validators are executed in the order in which they appear in the XML file for a given bean. Validators created from the property tag, which represents a simple property, are executed before the validators created from bean-property tags, which represent a property that has a value of a bean that has nested properties itself. Validators that are created for switch tags are executed last, unless the switches-first attribute on the schema or bean-property tag is set to true.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices