|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Specifies a constraint that may be contextual and dynamic. Regarding XML Schema, it may be considered as a programmatic extended facet.
The constraint must be declared under the element
xs:annotation/xs:appinfo/osd:otherFacets:
where<osd:constraint class="com.foo.MyConstraint" />
com.foo.MyConstraint is
the fully qualified name of the class implementing this interface.
It is also possible to set additional JavaBean properties:
where<osd:constraint class="com.foo.MyConstraint"> <param1>...</param1> <param2>...</param2> </osd:constraint>
param1 and param2 are JavaBean properties of the specified class.
For more information, read JavaBeans specification.
setParam1(...) and
setParam2(...));setup(ConstraintContext) is called on the new instance.checkOccurrence(Object, ValueContextForValidation)
is called each time an associated element or attribute has to be validated.
See checkOccurrence(Object, ValueContextForValidation).
ConstraintOnNull,
ConstraintOnTable| Method Summary | |
void |
checkOccurrence(Object aValue,
ValueContextForValidation aValidationContext)
This method checks the specified value and must add an error message if it is not valid. |
void |
setup(ConstraintContext aContext)
This method is called when the schema is loaded, for checking and preparing this instance. |
String |
toUserDocumentation(Locale userLocale,
ValueContext aContext)
Returns a final user documentation about this constraint. |
| Method Detail |
public void checkOccurrence(Object aValue,
ValueContextForValidation aValidationContext)
throws InvalidSchemaException
The value passed as an argument by the container is an occurrence. It means that if
the associated node is a simple type with an aggregated list declaration (that is, maxOccurs > 1),
this method is called for each occurrence of the element.
If this constraint is attached to a table with N records, the full validation will call this method N times.
For a table with many records, it may be necessary to optimize
the implementation. A good solution can be to implement
ConstraintOnTable interface instead of this interface.
For a single instance of this interface, this method may be called concurrently by several threads.
InvalidSchemaException - if some schema's dynamic condition prevents the execution of this method.public void setup(ConstraintContext aContext)
This method must also declare the dependencies of the constraint, if any, so that validation is notified when a value is updated.
ConstraintContext.addValueDependencyToNode(SchemaNode),
ConstraintContext.setDependencyToLocalNode()
public String toUserDocumentation(Locale userLocale,
ValueContext aContext)
throws InvalidSchemaException
The method can return null if the specified locale is not handled by
the current implementation. Indeed, the container is able to try several locales
for handling a partial internationalization of this method's implementation and/or
a mismatch between the locales declared by the associated module and the locales supported
by EBX.Platform. In such cases, locales are tried in the following order:
Session.getLocaleForSchemaNode(SchemaNode));module.xml;For a single instance of this interface, this method may be called concurrently by several threads.
InvalidSchemaException - if some schema's dynamic condition prevents the execution of this method.
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
(report a bug)
EBX.Platform 4.8.4 [0722]
Copyright Orchestra Networks 2000-2010. All rights reserved.