To validate child beans or child repository items, use the bean-property tag:

<schema id="id1">
  <bean class="atg.my.TestBean"/>
  <property name="stringOne" required="true"/>
  <bean-property name="childBean">
    <property name="intOne">
      <validator-instance class="IntegerValidator">
        <param name="allowNegative" value="false"/>
      </validator-instance>
    </property>
    <property name="intTwo" writable="false"/>
  </bean-property>
</schema>

The bean-property tags support the nesting of both the property and bean-property tags. The validator-instance tag allows you to override the default validator class instance and to set properties on the validator instance once it is created. The param value supports both nucleus: and class: prefixes, which allows the tag to use a Nucleus value or a new class instance.

Use the Dynamo Server Admin to access the PayloadSchemaRegistry to introspect the validation configuration and test validation. If introspection fails for a bean property, use a nested bean or item-descriptor tag to override the results of the default introspection and continue with the specified class or repository item type.

You can use the following method to access BeanValidator, which validates a dynamic bean’s sub-properties, by ID:

public BeanValidator getBeanValidatorById(String pId)

Note that the PayloadSchemaRegistry and the framework are not directly exposed as endpoints. The PayloadSchemaRegistry creates the following default validators for tags that can contain property and bean-property tags:

XML Tag

Default Validator Class

validator

ValidatorManager

bean-validator

ValidatorManager

switch

SwitchingUpdatingValidator

case

ValidatorManager

Note that these validators can be overridden by sub-classes that include customized logic to handle creating target items, adding additional constraints, or other similar actions.


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