Interface DocumentValidationService
-
- All Known Implementing Classes:
DocumentValidationServiceImpl
public interface DocumentValidationServiceProvides a way to validateDocumentModelaccording to theirSchema's constraints.- Since:
- 7.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDocumentValidationService.Forcing
-
Field Summary
Fields Modifier and Type Field Description static StringCTX_CREATEDOCstatic StringCTX_IMPORTDOCstatic StringCTX_MAP_KEYstatic StringCTX_SAVEDOC
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisActivated(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".DocumentValidationReportvalidate(String xpath, Object value)Validates a value according to someFielddefinition.DocumentValidationReportvalidate(String xpath, Object value, boolean validateSubProperties)Validates a value according to someFielddefinition.DocumentValidationReportvalidate(DocumentModel document)DocumentValidationReportvalidate(DocumentModel document, boolean dirtyOnly)DocumentValidationReportvalidate(Property property)Validates a property according to itsFielddefinition.DocumentValidationReportvalidate(Property property, boolean validateSubProperties)Validates a property according to itsFielddefinition.DocumentValidationReportvalidate(Field field, Object value)Validates a value according to someFielddefinition.DocumentValidationReportvalidate(Field field, Object value, boolean validateSubProperties)Validates a value according to someFielddefinition.
-
-
-
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.Forcingfor values andCTX_MAP_KEYfor 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 someFielddefinition.- Since:
- 7.1
-
validate
DocumentValidationReport validate(Field field, Object value, boolean validateSubProperties)
Validates a value according to someFielddefinition.- Parameters:
validateSubProperties- Tell whether the sub properties must be validated.- Since:
- 7.2
-
validate
DocumentValidationReport validate(Property property)
Validates a property according to itsFielddefinition.- Since:
- 7.1
-
validate
DocumentValidationReport validate(Property property, boolean validateSubProperties)
Validates a property according to itsFielddefinition.- 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 someFielddefinition.- 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 someFielddefinition.- 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
-
-