public class DocumentValidationServiceImpl extends DefaultComponent implements DocumentValidationService
DocumentValidationService.Forcing
lastModified
CTX_CREATEDOC, CTX_IMPORTDOC, CTX_MAP_KEY, CTX_SAVEDOC
Constructor and Description |
---|
DocumentValidationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
protected SchemaManager |
getSchemaManager() |
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".
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
DocumentValidationReport |
validate(DocumentModel document)
|
DocumentValidationReport |
validate(DocumentModel document,
boolean dirtyOnly)
|
DocumentValidationReport |
validate(Field field,
Object value)
Validates a value according to some
Field definition. |
DocumentValidationReport |
validate(Field field,
Object value,
boolean validateSubProperties)
Validates a value according to some
Field definition. |
DocumentValidationReport |
validate(Property property)
Validates a property according to its
Field definition. |
DocumentValidationReport |
validate(Property property,
boolean validateSubProperties)
Validates a property according to its
Field definition. |
protected List<ConstraintViolation> |
validate(Schema schema,
Field field,
Object value,
boolean validateSubProperties) |
DocumentValidationReport |
validate(String xpath,
Object value)
Validates a value according to some
Field definition. |
DocumentValidationReport |
validate(String xpath,
Object value,
boolean validateSubProperties)
Validates a value according to some
Field definition. |
applicationStarted, deactivate, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtension
public DocumentValidationServiceImpl()
protected SchemaManager getSchemaManager()
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public boolean isActivated(String context, Map<String,Serializable> contextMap)
DocumentValidationService
Example :
<extension target="org.nuxeo.ecm.core.api.DocumentValidationService" point="activations">
<validation context="CoreSession.saveDocument" activated="false" />
</extension>
Here are some available context :
isActivated
in interface DocumentValidationService
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
DocumentValidationService.CTX_MAP_KEY
for the key.public DocumentValidationReport validate(DocumentModel document)
DocumentValidationService
validate
in interface DocumentValidationService
public DocumentValidationReport validate(DocumentModel document, boolean dirtyOnly)
DocumentValidationService
validate
in interface DocumentValidationService
dirtyOnly
- If true, limit validation to dirty properties of the DocumentModel
.public DocumentValidationReport validate(Field field, Object value)
DocumentValidationService
Field
definition.validate
in interface DocumentValidationService
public DocumentValidationReport validate(Field field, Object value, boolean validateSubProperties)
DocumentValidationService
Field
definition.validate
in interface DocumentValidationService
validateSubProperties
- Tell whether the sub properties must be validated.public DocumentValidationReport validate(Property property)
DocumentValidationService
Field
definition.validate
in interface DocumentValidationService
public DocumentValidationReport validate(Property property, boolean validateSubProperties)
DocumentValidationService
Field
definition.validate
in interface DocumentValidationService
validateSubProperties
- Tell whether the sub properties must be validated.public DocumentValidationReport validate(String xpath, Object value)
DocumentValidationService
Field
definition.validate
in interface DocumentValidationService
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).public DocumentValidationReport validate(String xpath, Object value, boolean validateSubProperties) throws IllegalArgumentException
DocumentValidationService
Field
definition.validate
in interface DocumentValidationService
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.IllegalArgumentException
- If the xpath does not match any field.Copyright © 2015 Nuxeo SA. All rights reserved.