Interface DocumentValidationService
-
- All Known Implementing Classes:
DocumentValidationServiceImpl
public interface DocumentValidationService
Provides a way to validateDocumentModel
according to theirSchema
's constraints.- Since:
- 7.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DocumentValidationService.Forcing
-
Field Summary
Fields Modifier and Type Field Description static String
CTX_CREATEDOC
static String
CTX_IMPORTDOC
static String
CTX_MAP_KEY
static String
CTX_SAVEDOC
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isActivated(String context, Map<String,Serializable> contextMap)
To activate validation in some context, for example "CoreSession.saveDocument", you have to contribute to component "org.nuxeo.ecm.core.api.DocumentValidationService" with extension point "activations".DocumentValidationReport
validate(String xpath, Object value)
Validates a value according to someField
definition.DocumentValidationReport
validate(String xpath, Object value, boolean validateSubProperties)
Validates a value according to someField
definition.DocumentValidationReport
validate(DocumentModel document)
DocumentValidationReport
validate(DocumentModel document, boolean dirtyOnly)
DocumentValidationReport
validate(Property property)
Validates a property according to itsField
definition.DocumentValidationReport
validate(Property property, boolean validateSubProperties)
Validates a property according to itsField
definition.DocumentValidationReport
validate(Field field, Object value)
Validates a value according to someField
definition.DocumentValidationReport
validate(Field field, Object value, boolean validateSubProperties)
Validates a value according to someField
definition.
-
-
-
Field Detail
-
CTX_MAP_KEY
static final String CTX_MAP_KEY
- See Also:
- Constant Field Values
-
CTX_CREATEDOC
static final String CTX_CREATEDOC
- See Also:
- Constant Field Values
-
CTX_SAVEDOC
static final String CTX_SAVEDOC
- See Also:
- Constant Field Values
-
CTX_IMPORTDOC
static final String CTX_IMPORTDOC
- See Also:
- Constant Field Values
-
-
Method Detail
-
isActivated
boolean isActivated(String context, Map<String,Serializable> contextMap)
To activate validation in some context, for example "CoreSession.saveDocument", you have to contribute to component "org.nuxeo.ecm.core.api.DocumentValidationService" with extension point "activations".Example :
<extension target="org.nuxeo.ecm.core.api.DocumentValidationService" point="activations"> <validation context="CoreSession.saveDocument" activated="false" /> </extension>
Here are some available context :
- CoreSession.createDocument
- CoreSession.saveDocument
- CoreSession.importDocument
- Parameters:
context
- A string representation of the context, where validation service should be activated.contextMap
- if not null, search forcing flag in the context map. seeDocumentValidationService.Forcing
for values andCTX_MAP_KEY
for the key.- Returns:
- true if validation is activated in the specified context, false otherwise.
- Since:
- 7.1
-
validate
DocumentValidationReport validate(DocumentModel document)
- Since:
- 7.1
-
validate
DocumentValidationReport validate(DocumentModel document, boolean dirtyOnly)
- Parameters:
dirtyOnly
- If true, limit validation to dirty properties of theDocumentModel
.- Since:
- 7.1
-
validate
DocumentValidationReport validate(Field field, Object value)
Validates a value according to someField
definition.- Since:
- 7.1
-
validate
DocumentValidationReport validate(Field field, Object value, boolean validateSubProperties)
Validates a value according to someField
definition.- Parameters:
validateSubProperties
- Tell whether the sub properties must be validated.- Since:
- 7.2
-
validate
DocumentValidationReport validate(Property property)
Validates a property according to itsField
definition.- Since:
- 7.1
-
validate
DocumentValidationReport validate(Property property, boolean validateSubProperties)
Validates a property according to itsField
definition.- Parameters:
validateSubProperties
- Tell whether the sub properties must be validated.- Since:
- 7.10
-
validate
DocumentValidationReport validate(String xpath, Object value)
Validates a value according to someField
definition.- Parameters:
xpath
- schema:fieldName, for example dc:title - the xpath could also be a value that match a complex property field (for example, an field of a complex type in a list: schema:list:complex:field).- Throws:
IllegalArgumentException
- If the xpath does not match any field.- Since:
- 7.1
-
validate
DocumentValidationReport validate(String xpath, Object value, boolean validateSubProperties)
Validates a value according to someField
definition.- Parameters:
xpath
- schema:fieldName, for example dc:title - the xpath could also be a value that match a complex property field (for example, an field of a complex type in a list: schema:list:complex:field).validateSubProperties
- Tell whether the sub properties must be validated.- Throws:
IllegalArgumentException
- If the xpath does not match any field.- Since:
- 7.10
-
-