Package org.nuxeo.ecm.core.schema
Class SchemaManagerImpl
java.lang.Object
org.nuxeo.ecm.core.schema.SchemaManagerImpl
- All Implemented Interfaces:
PropertyCharacteristicHandler,SchemaManager,TypeProvider
Schema Manager implementation.
Holds basic types (String, Integer, etc.), schemas, document types and facets.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<TypeConfiguration>All the registered configurations (prefetch).protected List<DocumentTypeDescriptor>All the registered document types.protected List<FacetDescriptor>All the registered facets.protected booleanEffective allowVersionWriteForDublinCore flag.protected List<ProxiesDescriptor>All the registered proxy descriptors.protected List<SchemaBindingDescriptor>All the registered schemas.static final booleanDefault used for clearComplexPropertyBeforeSet if there is no XML configuration found.booleanEffective clearComplexPropertyBeforeSet flag.Deprecated.protected booleanWhether there have been changes to the registered schemas, facets or document types that require recomputation of the effective ones.protected Map<String,DocumentTypeImpl> Effective document types.Effective facets.protected PrefetchInfoEffective prefetch info.protected Map<String,Map<String, PropertyDescriptor>> Map holding property characteristics with: schema -> path -> characteristic.Effective proxy schema names.Effective proxy schemas.Deprecated.since 11.1, usepropertyCharacteristicsinsteadEffective schemas.static final Stringprotected static final StringBasic type registry.Fields inherited from interface org.nuxeo.ecm.core.schema.SchemaManager
PATH_INDEX_PATTERN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddRuntimeMessage(RuntimeMessage.Level level, String message) voidChecks if something has to be recomputed if a dynamic register/unregister happened.protected booleancheckPropertyCharacteristic(String schema, String path, Predicate<PropertyDescriptor> predicate) protected StringDeprecated.since 2021.32 useSchemaManager.normalizePath(String)instead.protected voidprotected voidprotected voidprotected voidvoidgetAllowedSubTypes(String typeName) Returns the types of the children that can be created inside a giventypetype.booleanWhether we allow to write the dublincore schema on a version.booleanWhether or not to ignore any previous values when setting complex properties.Deprecated.since 11.1, usePropertyCharacteristicHandlermethods insteadgetDeprecatedProperties(String schema) The returned paths are not Nuxeo xpath as they don't have the schema prefix.getDocumentType(String name) Gets a document type.getDocumentTypeNamesExtending(String docTypeName) Return the names of all document types extending the given one, which is included.Returns the names of all document types that have given facet.Gets the list of document types.intGets a facet.getFacetDescriptor(String name) Gets the list of facets.getFallback(String schema, String path) Returns the fallback associated to this property if exist.Returns the field with given xpath, or null if not found.Returns the field with given parent field and sub name, or null if not found.protected FieldgetIndexedProperties(String schema) Returns the indexed property paths.Finds which facets are configured as no-per-instance-query.protected <R> Set<R>getPropertyCharacteristics(String schema, Predicate<PropertyDescriptor> predicate, Function<PropertyDescriptor, R> function) getProxySchemas(String docType) Gets the schemas on a proxy for a document of the given type.Deprecated.since 11.1, usePropertyCharacteristicHandlermethods insteadgetRemovedProperties(String schema) The returned paths are not Nuxeo xpath as they don't have the schema prefix.The returned paths are not Nuxeo xpath as they don't have the schema prefix.getRetainableProperties(String schema) The returned paths are not Nuxeo xpath as they don't have the schema prefix.Gets a schema.getSchemaFromPrefix(String schemaPrefix) getSchemaFromURI(String schemaURI) Deprecated.since 11.1, seems unusedSchema[]Gets the list of schemas.Gets the list of document types excluded from copy.protected Typeprotected Collection<Type>getTypes()getXPathSchemaName(String xpath, Set<String> docSchemas) Finds within the schemas the first matching schema having a property with the same name as the first path segment of the xpath.booleanhasSuperType(String docType, String superType) Returns true ifdocTypeis or extendssuperType, false otherwise.booleanisDeprecated(String schema, String path) Checks if the property represented by the givenschemaandpathis deprecated.booleanisProxySchema(String schema, String docType) Checks if a schema is on a proxy for a document of the given type.booleanChecks if the property represented by the givenschemaandpathis removed.booleanChecks if the property represented by the givenschemaandpathis secured.protected voidprotected DocumentTypeDescriptorprotected voidRecomputes effective registries for schemas, facets and document types.protected voidprotected DocumentTyperecomputeDocumentType(String name, Set<String> stack, Map<String, DocumentTypeDescriptor> dtds) protected DocumentTyperecomputeDocumentType(String name, DocumentTypeDescriptor dtd, DocumentType parent) protected voidvoidprotected voidprotected voidprotected voidprotected voidprotected voidvoidvoidprotected voidregisterDocumentType(DocumentTypeImpl docType) protected CompositeTyperegisterFacet(String name, Set<String> schemaNames) voidprotected voidregisterPropertyCharacteristics(List<PropertyDescriptor> descriptors) voidvoidregisterRecomputeCallback(Runnable callback) voidprotected voidregisterSchema(Schema schema) protected voidregisterType(Type type) protected FieldresolveSubField(ListType listType, String subName, boolean fallbackOnSubElement) voidvoidvoidvoidvoidunregisterRecomputeCallback(Runnable callback) void
-
Field Details
-
STARTUP_FAIL_ON_MISSING_SCHEMA_PROP
- See Also:
-
dirty
protected volatile boolean dirtyWhether there have been changes to the registered schemas, facets or document types that require recomputation of the effective ones. -
types
Basic type registry. -
allConfigurations
All the registered configurations (prefetch). -
allSchemas
All the registered schemas. -
allFacets
All the registered facets. -
allDocumentTypes
All the registered document types. -
allProxies
All the registered proxy descriptors. -
prefetchInfo
Effective prefetch info. -
clearComplexPropertyBeforeSet
public boolean clearComplexPropertyBeforeSetEffective clearComplexPropertyBeforeSet flag. -
allowVersionWriteForDublinCore
protected boolean allowVersionWriteForDublinCoreEffective allowVersionWriteForDublinCore flag. -
schemas
Effective schemas. -
disabledSchemas
-
disabledTypes
-
prefixToSchema
-
facets
Effective facets. -
noPerDocumentQueryFacets
-
disabledFacets
-
documentTypes
Effective document types. -
specialDocumentTypes
-
documentTypesExtending
-
documentTypesForFacet
-
proxySchemas
Effective proxy schemas. -
proxySchemaNames
Effective proxy schema names. -
SCHEMAS_DIR_NAME
- See Also:
-
CLEAR_COMPLEX_PROP_BEFORE_SET_DEFAULT
public static final boolean CLEAR_COMPLEX_PROP_BEFORE_SET_DEFAULTDefault used for clearComplexPropertyBeforeSet if there is no XML configuration found.- Since:
- 9.3
- See Also:
-
recomputeCallbacks
-
deprecatedProperties
Deprecated.since 11.1, usepropertyCharacteristicsinstead- Since:
- 9.2
-
removedProperties
Deprecated.since 11.1, usepropertyCharacteristicsinstead- Since:
- 9.2
-
propertyCharacteristics
Map holding property characteristics with: schema -> path -> characteristic.- Since:
- 11.1
-
-
Constructor Details
-
SchemaManagerImpl
public SchemaManagerImpl()
-
-
Method Details
-
clearSchemaDir
protected void clearSchemaDir() -
getSchemasDir
-
registerBuiltinTypes
protected void registerBuiltinTypes() -
registerType
-
getType
-
getTypes
-
registerConfiguration
-
unregisterConfiguration
-
registerSchema
-
unregisterSchema
-
registerFacet
-
unregisterFacet
-
registerDocumentType
-
unregisterDocumentType
-
getDocumentTypeDescriptor
-
getFacetDescriptor
-
recomputeDynamicFacets
public void recomputeDynamicFacets() -
registerProxies
-
unregisterProxies
-
checkDirty
public void checkDirty()Checks if something has to be recomputed if a dynamic register/unregister happened. -
recompute
protected void recompute()Recomputes effective registries for schemas, facets and document types. -
addRuntimeMessage
-
recomputeConfiguration
protected void recomputeConfiguration() -
recomputeSchemas
protected void recomputeSchemas() -
copySchema
- Throws:
IOException
-
loadSchema
protected void loadSchema(SchemaBindingDescriptor sd) throws IOException, SAXException, TypeException - Throws:
IOExceptionSAXExceptionTypeException
-
registerSchema
-
getSchemas
Description copied from interface:TypeProviderGets the list of schemas.- Specified by:
getSchemasin interfaceTypeProvider
-
getSchema
Description copied from interface:TypeProviderGets a schema.- Specified by:
getSchemain interfaceTypeProvider
-
getSchemaFromPrefix
- Specified by:
getSchemaFromPrefixin interfaceSchemaManager
-
getSchemaFromURI
Deprecated.since 11.1, seems unused- Specified by:
getSchemaFromURIin interfaceSchemaManager
-
recomputeFacets
protected void recomputeFacets() -
recomputeFacet
-
registerFacet
-
getFacets
Description copied from interface:TypeProviderGets the list of facets.- Specified by:
getFacetsin interfaceTypeProvider
-
getFacet
Description copied from interface:TypeProviderGets a facet.- Specified by:
getFacetin interfaceTypeProvider
-
getNoPerDocumentQueryFacets
Description copied from interface:TypeProviderFinds which facets are configured as no-per-instance-query.- Specified by:
getNoPerDocumentQueryFacetsin interfaceTypeProvider
-
recomputeDocumentTypes
protected void recomputeDocumentTypes() -
mergeDocumentTypeDescriptors
protected DocumentTypeDescriptor mergeDocumentTypeDescriptors(DocumentTypeDescriptor src, DocumentTypeDescriptor dst) -
recomputeDocumentType
protected DocumentType recomputeDocumentType(String name, Set<String> stack, Map<String, DocumentTypeDescriptor> dtds) -
recomputeDocumentType
protected DocumentType recomputeDocumentType(String name, DocumentTypeDescriptor dtd, DocumentType parent) -
registerDocumentType
-
getDocumentType
Description copied from interface:TypeProviderGets a document type.- Specified by:
getDocumentTypein interfaceTypeProvider
-
getDocumentTypeNamesForFacet
Description copied from interface:SchemaManagerReturns the names of all document types that have given facet.- Specified by:
getDocumentTypeNamesForFacetin interfaceSchemaManager- Returns:
- null or the names as a guaranteed non-empty set.
-
getDocumentTypeNamesExtending
Description copied from interface:SchemaManagerReturn the names of all document types extending the given one, which is included.- Specified by:
getDocumentTypeNamesExtendingin interfaceSchemaManager- Returns:
- null or the set of names.
-
getDocumentTypes
Description copied from interface:TypeProviderGets the list of document types.- Specified by:
getDocumentTypesin interfaceTypeProvider
-
getDocumentTypesCount
public int getDocumentTypesCount()- Specified by:
getDocumentTypesCountin interfaceSchemaManager
-
hasSuperType
Description copied from interface:SchemaManagerReturns true ifdocTypeis or extendssuperType, false otherwise.- Specified by:
hasSuperTypein interfaceSchemaManager
-
getAllowedSubTypes
Description copied from interface:SchemaManagerReturns the types of the children that can be created inside a giventypetype.- Specified by:
getAllowedSubTypesin interfaceSchemaManager
-
recomputeProxies
protected void recomputeProxies() -
getProxySchemas
Description copied from interface:TypeProviderGets the schemas on a proxy for a document of the given type.- Specified by:
getProxySchemasin interfaceTypeProvider
-
isProxySchema
Description copied from interface:TypeProviderChecks if a schema is on a proxy for a document of the given type.- Specified by:
isProxySchemain interfaceTypeProvider
-
getField
Description copied from interface:SchemaManagerReturns the field with given xpath, or null if not found.- Specified by:
getFieldin interfaceSchemaManager
-
getField
Description copied from interface:SchemaManagerReturns the field with given parent field and sub name, or null if not found.- Specified by:
getFieldin interfaceSchemaManager
-
getField
-
resolveSubField
-
flushPendingsRegistration
public void flushPendingsRegistration() -
registerRecomputeCallback
- Since:
- 8.10
-
unregisterRecomputeCallback
- Since:
- 8.10
-
executeRecomputeCallbacks
protected void executeRecomputeCallbacks()- Since:
- 8.10
-
getDeprecatedProperties
Deprecated.since 11.1, usePropertyCharacteristicHandlermethods instead- Specified by:
getDeprecatedPropertiesin interfaceSchemaManager- Returns:
- the deprecated properties handler
- Since:
- 9.2
-
getRemovedProperties
Deprecated.since 11.1, usePropertyCharacteristicHandlermethods instead- Specified by:
getRemovedPropertiesin interfaceSchemaManager- Returns:
- the removed properties handler
- Since:
- 9.2
-
getClearComplexPropertyBeforeSet
public boolean getClearComplexPropertyBeforeSet()Description copied from interface:SchemaManagerWhether or not to ignore any previous values when setting complex properties.- Specified by:
getClearComplexPropertyBeforeSetin interfaceSchemaManager- Returns:
trueif setting a complex property ignores any previous values
-
getAllowVersionWriteForDublinCore
public boolean getAllowVersionWriteForDublinCore()Description copied from interface:SchemaManagerWhether we allow to write the dublincore schema on a version.- Specified by:
getAllowVersionWriteForDublinCorein interfaceSchemaManager- Returns:
trueif write to the dublincore schema of a version is allowed
-
registerPropertyCharacteristics
- Since:
- 11.1
-
clearPropertyCharacteristics
protected void clearPropertyCharacteristics()- Since:
- 11.1
-
isSecured
Description copied from interface:PropertyCharacteristicHandlerChecks if the property represented by the givenschemaandpathis secured.- Specified by:
isSecuredin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema namepath- the property path to test- Returns:
- whether or not the given property is secured (ie: only administrators can edit it)
- Since:
- 11.1
-
isDeprecated
Description copied from interface:PropertyCharacteristicHandlerChecks if the property represented by the givenschemaandpathis deprecated.- Specified by:
isDeprecatedin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema name (not the prefix)path- the property path to test- Returns:
- whether or not this property is marked as deprecated
-
isRemoved
Description copied from interface:PropertyCharacteristicHandlerChecks if the property represented by the givenschemaandpathis removed.- Specified by:
isRemovedin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema name (not the prefix)path- the property path to test- Returns:
- whether or not this property is marked as removed
-
getXPathSchemaName
Description copied from interface:SchemaManagerFinds within the schemas the first matching schema having a property with the same name as the first path segment of the xpath. The xpath can be prefixed or unprefixed.- Specified by:
getXPathSchemaNamein interfaceSchemaManager- Parameters:
xpath- the prefixed or unprefixed xpathdocSchemas- the schemas to be searched- Returns:
- the first schema containing a property matching the xpath
-
getDeprecatedProperties
Description copied from interface:PropertyCharacteristicHandlerThe returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getDeprecatedPropertiesin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema name (not the prefix)- Returns:
- a
Setholding the deprecated property path
-
getRemovedProperties
Description copied from interface:PropertyCharacteristicHandlerThe returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getRemovedPropertiesin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema name (not the prefix)- Returns:
- a
Setholding the removed property path
-
getRetainableProperties
Description copied from interface:PropertyCharacteristicHandlerThe returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getRetainablePropertiesin interfacePropertyCharacteristicHandler- Returns:
- a
Setholding the retainable property path - Since:
- 2023
-
getRetainableProperties
Description copied from interface:PropertyCharacteristicHandlerThe returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getRetainablePropertiesin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema name (not the prefix)- Returns:
- a
Setholding the retainable property path - Since:
- 2023
-
getPropertyCharacteristics
protected <R> Set<R> getPropertyCharacteristics(String schema, Predicate<PropertyDescriptor> predicate, Function<PropertyDescriptor, R> function) -
getFallback
Description copied from interface:PropertyCharacteristicHandlerReturns the fallback associated to this property if exist. Fallbacks exist when property is deprecated or removed.- Specified by:
getFallbackin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema name (not the prefix)path- the property path to test- Returns:
- fallback associated to this property if exist
-
getIndexedProperties
Description copied from interface:PropertyCharacteristicHandlerReturns the indexed property paths.The returned paths are not Nuxeo xpath as they don't have the schema prefix.
- Specified by:
getIndexedPropertiesin interfacePropertyCharacteristicHandler- Parameters:
schema- the schema name (not the prefix)- Returns:
- a
Listholding the indexed property paths.
-
checkPropertyCharacteristic
protected boolean checkPropertyCharacteristic(String schema, String path, Predicate<PropertyDescriptor> predicate) -
cleanPath
Deprecated.since 2021.32 useSchemaManager.normalizePath(String)instead. -
getSpecialDocumentTypes
Description copied from interface:TypeProviderGets the list of document types excluded from copy.- Specified by:
getSpecialDocumentTypesin interfaceTypeProvider
-
propertyCharacteristicsinstead