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 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(String xpath, Object value)
Validates a value according to someField
definition.DocumentValidationReport
validate(String xpath, Object value, boolean validateSubProperties)
Validates a value according to someField
definition.DocumentValidationReport
validate(DocumentModel document)
DocumentValidationReport
validate(DocumentModel document, boolean dirtyOnly)
DocumentValidationReport
validate(Property property)
Validates a property according to itsField
definition.DocumentValidationReport
validate(Property property, boolean validateSubProperties)
Validates a property according to itsField
definition.DocumentValidationReport
validate(Field field, Object value)
Validates a value according to someField
definition.DocumentValidationReport
validate(Field field, Object value, boolean validateSubProperties)
Validates a value according to someField
definition.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
-
-
-
-
Method Detail
-
getSchemaManager
protected SchemaManager getSchemaManager()
-
activate
public void activate(ComponentContext context)
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
public boolean isActivated(String context, Map<String,Serializable> contextMap)
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
public DocumentValidationReport validate(DocumentModel document)
Description copied from interface:DocumentValidationService
- Specified by:
validate
in interfaceDocumentValidationService
-
validate
public DocumentValidationReport validate(DocumentModel document, boolean dirtyOnly)
Description copied from interface:DocumentValidationService
- Specified by:
validate
in interfaceDocumentValidationService
dirtyOnly
- If true, limit validation to dirty properties of theDocumentModel
.
-
validate
public DocumentValidationReport validate(Field field, Object value)
Description copied from interface:DocumentValidationService
Validates a value according to someField
definition.- Specified by:
validate
in interfaceDocumentValidationService
-
validate
public DocumentValidationReport validate(Field field, Object value, boolean validateSubProperties)
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
public DocumentValidationReport validate(Property property)
Description copied from interface:DocumentValidationService
Validates a property according to itsField
definition.- Specified by:
validate
in interfaceDocumentValidationService
-
validate
public DocumentValidationReport validate(Property property, boolean validateSubProperties)
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
public DocumentValidationReport validate(String xpath, Object value)
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)
-
-