Class DocumentValidationServiceImpl
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.core.api.validation.DocumentValidationServiceImpl
- All Implemented Interfaces:
DocumentValidationService
,Adaptable
,Component
,Extensible
,TimestampedService
public class DocumentValidationServiceImpl
extends DefaultComponent
implements DocumentValidationService
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.api.validation.DocumentValidationService
DocumentValidationService.Forcing
-
Field Summary
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
Fields inherited from interface org.nuxeo.ecm.core.api.validation.DocumentValidationService
CTX_CREATEDOC, CTX_IMPORTDOC, CTX_MAP_KEY, CTX_SAVEDOC
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(ComponentContext context) Activates the component.protected SchemaManager
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) Validates a value according to someField
definition.Validates a value according to someField
definition.validate
(DocumentModel document) validate
(DocumentModel document, boolean dirtyOnly) Validates a property according to itsField
definition.Validates a property according to itsField
definition.Validates a value according to someField
definition.Validates a value according to someField
definition.protected List<ValidationViolation>
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Constructor Details
-
DocumentValidationServiceImpl
public DocumentValidationServiceImpl()
-
-
Method Details
-
getSchemaManager
-
activate
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContribution
in classDefaultComponent
-
isActivated
Description copied from interface:DocumentValidationService
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
- Specified by:
isActivated
in interfaceDocumentValidationService
- 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 andDocumentValidationService.CTX_MAP_KEY
for the key.- Returns:
- true if validation is activated in the specified context, false otherwise.
-
validate
Description copied from interface:DocumentValidationService
- Specified by:
validate
in interfaceDocumentValidationService
-
validate
Description copied from interface:DocumentValidationService
- Specified by:
validate
in interfaceDocumentValidationService
dirtyOnly
- If true, limit validation to dirty properties of theDocumentModel
.
-
validate
Description copied from interface:DocumentValidationService
Validates a value according to someField
definition.- Specified by:
validate
in interfaceDocumentValidationService
-
validate
Description copied from interface:DocumentValidationService
Validates a value according to someField
definition.- Specified by:
validate
in interfaceDocumentValidationService
validateSubProperties
- Tell whether the sub properties must be validated.
-
validate
Description copied from interface:DocumentValidationService
Validates a property according to itsField
definition.- Specified by:
validate
in interfaceDocumentValidationService
-
validate
Description copied from interface:DocumentValidationService
Validates a property according to itsField
definition.- Specified by:
validate
in interfaceDocumentValidationService
validateSubProperties
- Tell whether the sub properties must be validated.
-
validate
Description copied from interface:DocumentValidationService
Validates a value according to someField
definition.- Specified by:
validate
in interfaceDocumentValidationService
- 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).
-
validate
public DocumentValidationReport validate(String xpath, Object value, boolean validateSubProperties) throws IllegalArgumentException Description copied from interface:DocumentValidationService
Validates a value according to someField
definition.- Specified by:
validate
in interfaceDocumentValidationService
- 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.
-
validate
protected List<ValidationViolation> validate(Schema schema, Field field, Object value, boolean validateSubProperties)
-