Interface DocumentValidationService

All Known Implementing Classes:
DocumentValidationServiceImpl

public interface DocumentValidationService
Provides a way to validate DocumentModel according to their Schema's constraints.
Since:
7.1
  • Field Details

  • Method Details

    • 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. see DocumentValidationService.Forcing for values and CTX_MAP_KEY for the key.
      Returns:
      true if validation is activated in the specified context, false otherwise.
      Since:
      7.1
    • validate

      Validates all Field of all Schema of a DocumentModel. Including no dirty properties.
      Since:
      7.1
    • validate

      DocumentValidationReport validate(DocumentModel document, boolean dirtyOnly)
      Validates all Field of all Schema of a DocumentModel.
      Parameters:
      dirtyOnly - If true, limit validation to dirty properties of the DocumentModel.
      Since:
      7.1
    • validate

      DocumentValidationReport validate(Field field, Object value)
      Validates a value according to some Field definition.
      Since:
      7.1
    • validate

      DocumentValidationReport validate(Field field, Object value, boolean validateSubProperties)
      Validates a value according to some Field definition.
      Parameters:
      validateSubProperties - Tell whether the sub properties must be validated.
      Since:
      7.2
    • validate

      DocumentValidationReport validate(Property property)
      Validates a property according to its Field definition.
      Since:
      7.1
    • validate

      DocumentValidationReport validate(Property property, boolean validateSubProperties)
      Validates a property according to its Field 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 some Field 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 some Field 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