Author: kwin
Date: Mon Mar 6 15:20:04 2017
New Revision: 1785662
URL: http://svn.apache.org/viewvc?rev=1785662&view=rev
Log:
add more information about how to set the validator's severity
Modified:
sling/site/trunk/content/documentation/bundles/validation.mdtext
Modified: sling/site/trunk/content/documentation/bundles/validation.mdtext
URL:
http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/validation.mdtext?rev=1785662&r1=1785661&r2=1785662&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/validation.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/validation.mdtext Mon Mar 6
15:20:04 2017
@@ -56,7 +56,7 @@ The `ValidationResult` indicates whether
1. validation model (per use case of a `Validator`)
1. severity defined on the `Validator`
-1. the default severity (may be set through the OSGi configuration for PID
"org.apache.sling.validation.impl.ValidationServiceImpl", is 0 by default)
+1. the default severity (may be set through the OSGi configuration for PID
`org.apache.sling.validation.impl.ValidationServiceImpl`, is 0 by default)
You have to use a `ResourceBundle` ([Internationalization Support]({{
refs.internationalization-support-i18n.path }})) to resolve the message for a
specific locale. By default Sling Validation comes only with English failure
messages.
@@ -132,7 +132,9 @@ To write a validator one needs to implem
That interface defines the method `validate`. That is called for each property
which is bound to the validator through the validation model.
Each validator needs to specify one type parameter which defines upon which
classes the validator can act (usually `String`). Array types are also
supported here. Collection types are not supported. If a property value cannot
be converted to the requested type from the validator (through
`ValueMap.get(name, type)`), validation will fail.
-In addition that OSGi service needs to expose a property called
`validation.id`. The value of this property should always start with the
providing bundle's symbolic name. Only through this value the validator can be
referenced from validation models. If multiple validators have the same
`validation.id` value the one with the highest service ranking gets chosen.
+In addition the OSGi service must expose a String property named
`validation.id`. The value of this property should always start with the
providing bundle's symbolic name. Only through this value the validator can be
referenced from validation models. If multiple validators have the same
`validation.id` value the one with the highest service ranking gets always
chosen.
+
+A validator may also expose a service property named `validation.severity`
with an Integer value. This defines the default severity of the Validator
(which may be overwritten in the validation model).
# References
1. [Apache Sling Generic Validation Framework, adaptTo
2014](http://www.slideshare.net/raducotescu/apache-sling-generic-validation-framework)