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
Constructors Constructor Description DocumentValidationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(ComponentContext context)Activates the component.protected SchemaManagergetSchemaManager()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".voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)voidunregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)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.protected List<ValidationViolation>validate(Schema schema, Field field, Object value, boolean validateSubProperties)-
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
applicationStarted, getApplicationStartedOrder
-
-
-
-
Constructor Detail
-
DocumentValidationServiceImpl
public DocumentValidationServiceImpl()
-
-
Method Detail
-
getSchemaManager
protected SchemaManager getSchemaManager()
-
activate
public void activate(ComponentContext context)
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContributionin classDefaultComponent
-
isActivated
public boolean isActivated(String context, Map<String,Serializable> contextMap)
Description copied from interface:DocumentValidationServiceTo 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:
isActivatedin 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.Forcingfor values andDocumentValidationService.CTX_MAP_KEYfor the key.- Returns:
- true if validation is activated in the specified context, false otherwise.
-
validate
public DocumentValidationReport validate(DocumentModel document)
Description copied from interface:DocumentValidationService- Specified by:
validatein interfaceDocumentValidationService
-
validate
public DocumentValidationReport validate(DocumentModel document, boolean dirtyOnly)
Description copied from interface:DocumentValidationService- Specified by:
validatein interfaceDocumentValidationServicedirtyOnly- If true, limit validation to dirty properties of theDocumentModel.
-
validate
public DocumentValidationReport validate(Field field, Object value)
Description copied from interface:DocumentValidationServiceValidates a value according to someFielddefinition.- Specified by:
validatein interfaceDocumentValidationService
-
validate
public DocumentValidationReport validate(Field field, Object value, boolean validateSubProperties)
Description copied from interface:DocumentValidationServiceValidates a value according to someFielddefinition.- Specified by:
validatein interfaceDocumentValidationServicevalidateSubProperties- Tell whether the sub properties must be validated.
-
validate
public DocumentValidationReport validate(Property property)
Description copied from interface:DocumentValidationServiceValidates a property according to itsFielddefinition.- Specified by:
validatein interfaceDocumentValidationService
-
validate
public DocumentValidationReport validate(Property property, boolean validateSubProperties)
Description copied from interface:DocumentValidationServiceValidates a property according to itsFielddefinition.- Specified by:
validatein interfaceDocumentValidationServicevalidateSubProperties- Tell whether the sub properties must be validated.
-
validate
public DocumentValidationReport validate(String xpath, Object value)
Description copied from interface:DocumentValidationServiceValidates a value according to someFielddefinition.- Specified by:
validatein 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:DocumentValidationServiceValidates a value according to someFielddefinition.- Specified by:
validatein 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.
-
-