Class ConstraintViolation
java.lang.Object
org.nuxeo.ecm.core.api.validation.ConstraintViolation
- All Implemented Interfaces:
Serializable
,ValidationViolation
A constraint violation description. Use
For each messages, you can use parameters in the message :
getMessage(Locale)
to get the constraint violation description.
You could customize constraint violation message using the following rules :
- Use "label.schema.constraint.violation" key in "messages" bundle to customize default message
- Append the constraint name to the previous key to customize the generic message to some constraint
- Append the schema and the field name to the previous key to customize the message for a specific constraint applied to some specific schema field.
For each messages, you can use parameters in the message :
- The invalid value : {0}
- The schema name : {1}
- The field name : {2}
- The constraint name : {3}
- The first constraint parameter (if exists) : {4}
- The second constraint parameter (if exists) : {5}
- ...
Examples :
- label.schema.constraint.violation=Value '{0}' for field '{1}.{2}' does not respect constraint '{3}'
- label.schema.constraint.violation.PatternConstraint='{1}.{2}' value ({0}) should match the following format : '{4}'
- label.schema.constraint.violation.PatternConstraint.myuserschema.firstname ='The firstname should not be empty'
- Since:
- 7.1
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Allows to locates some constraint violation in a document. -
Constructor Summary
ConstructorDescriptionConstraintViolation
(Schema schema, List<ConstraintViolation.PathNode> fieldPath, Constraint constraint, Object invalidValue) -
Method Summary
-
Constructor Details
-
ConstraintViolation
public ConstraintViolation(Schema schema, List<ConstraintViolation.PathNode> fieldPath, Constraint constraint, Object invalidValue)
-
-
Method Details
-
getSchema
-
getPath
-
getPathAsString
-
getConstraint
-
getInvalidValue
-
getMessage
- Specified by:
getMessage
in interfaceValidationViolation
- Returns:
- The message if it's found in message bundles, a generic message otherwise.
- Since:
- 7.1
-
toString
-
getMessageKey
- Specified by:
getMessageKey
in interfaceValidationViolation
-