When your application creates a marker, the only information you are required to provide is a value to the key
property. You may prefer that your markers conform to stricter standards; for example, that all markers must have a key
value at least six characters long. Or, your validation requirements may be based on application-specific business logic that is unrelated to marker properties. Create a validation class that enforces the validation standards appropriate for your markers.
The validation standards you define might vary based on the type of marker: markers with key
X must have a value for key
and value
, whereas markers with key
Y must have a Date value for expirationDate
, which is a custom property. You must match each validation component to a key
; there is no way to create one validation component for all markers created by a given marker manager.
Follow these steps to define new validation standards:
Create a class for each set of validation standards. This class should implement the
atg.markers.MarkerValidatorContainer
interface. Create a component of each class.Update the marker manager
markerValidators
map property to use each validation component you defined. Set the key to the markerkey
value and thevalue
to a validation component. For example:
markerValidators=X=/atg/KeyXValidator,Y=/atg/KeyYValidator
Set the marker manager
alwaysValidate
property totrue
only if you have defined a validation component for each possiblekey
. If not, keep this set tofalse
: those markers that are mapped to validation components will use them regardless.If your validation standards require marker properties in addition to
key
,value
, anddata
to be populated, add those property names to the marker manager componentrequiredExtendedProperties
property.