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
Modifier 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 boolean
Effective allowVersionWriteForDublinCore flag.protected List<ProxiesDescriptor>
All the registered proxy descriptors.protected List<SchemaBindingDescriptor>
All the registered schemas.static final boolean
Default used for clearComplexPropertyBeforeSet if there is no XML configuration found.boolean
Effective clearComplexPropertyBeforeSet flag.Deprecated.protected boolean
Whether 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 PrefetchInfo
Effective 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, usepropertyCharacteristics
insteadEffective schemas.static final String
Basic type registry.Fields inherited from interface org.nuxeo.ecm.core.schema.SchemaManager
PATH_INDEX_PATTERN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks if something has to be recomputed if a dynamic register/unregister happened.protected boolean
checkPropertyCharacteristic
(String schema, String path, Predicate<PropertyDescriptor> predicate) protected String
Deprecated.since 2021.32 useSchemaManager.normalizePath(String)
instead.protected void
protected void
protected void
protected void
void
getAllowedSubTypes
(String typeName) Returns the types of the children that can be created inside a giventype
type.boolean
Whether we allow to write the dublincore schema on a version.boolean
Whether or not to ignore any previous values when setting complex properties.Deprecated.since 11.1, usePropertyCharacteristicHandler
methods 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.int
Gets 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 Field
getIndexedProperties
(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, usePropertyCharacteristicHandler
methods 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 Type
protected 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.boolean
hasSuperType
(String docType, String superType) Returns true ifdocType
is or extendssuperType
, false otherwise.boolean
isDeprecated
(String schema, String path) Checks if the property represented by the givenschema
andpath
is deprecated.boolean
isProxySchema
(String schema, String docType) Checks if a schema is on a proxy for a document of the given type.boolean
Checks if the property represented by the givenschema
andpath
is removed.boolean
Checks if the property represented by the givenschema
andpath
is secured.protected void
protected DocumentTypeDescriptor
protected void
Recomputes effective registries for schemas, facets and document types.protected void
protected DocumentType
recomputeDocumentType
(String name, Set<String> stack, Map<String, DocumentTypeDescriptor> dtds) protected DocumentType
recomputeDocumentType
(String name, DocumentTypeDescriptor dtd, DocumentType parent) protected void
void
protected void
protected void
protected void
protected void
protected void
void
void
protected void
registerDocumentType
(DocumentTypeImpl docType) protected CompositeType
registerFacet
(String name, Set<String> schemaNames) void
protected void
registerPropertyCharacteristics
(List<PropertyDescriptor> descriptors) void
void
registerRecomputeCallback
(Runnable callback) void
protected void
registerSchema
(Schema schema) protected void
registerType
(Type type) protected Field
resolveSubField
(ListType listType, String subName, boolean fallbackOnSubElement) void
void
void
void
void
unregisterRecomputeCallback
(Runnable callback) void
-
Field Details
-
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, usepropertyCharacteristics
instead- Since:
- 9.2
-
removedProperties
Deprecated.since 11.1, usepropertyCharacteristics
instead- 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. -
recomputeConfiguration
protected void recomputeConfiguration() -
recomputeSchemas
protected void recomputeSchemas() -
copySchema
- Throws:
IOException
-
loadSchema
protected void loadSchema(SchemaBindingDescriptor sd) throws IOException, SAXException, TypeException - Throws:
IOException
SAXException
TypeException
-
registerSchema
-
getSchemas
Description copied from interface:TypeProvider
Gets the list of schemas.- Specified by:
getSchemas
in interfaceTypeProvider
-
getSchema
Description copied from interface:TypeProvider
Gets a schema.- Specified by:
getSchema
in interfaceTypeProvider
-
getSchemaFromPrefix
- Specified by:
getSchemaFromPrefix
in interfaceSchemaManager
-
getSchemaFromURI
Deprecated.since 11.1, seems unused- Specified by:
getSchemaFromURI
in interfaceSchemaManager
-
recomputeFacets
protected void recomputeFacets() -
recomputeFacet
-
registerFacet
-
getFacets
Description copied from interface:TypeProvider
Gets the list of facets.- Specified by:
getFacets
in interfaceTypeProvider
-
getFacet
Description copied from interface:TypeProvider
Gets a facet.- Specified by:
getFacet
in interfaceTypeProvider
-
getNoPerDocumentQueryFacets
Description copied from interface:TypeProvider
Finds which facets are configured as no-per-instance-query.- Specified by:
getNoPerDocumentQueryFacets
in 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:TypeProvider
Gets a document type.- Specified by:
getDocumentType
in interfaceTypeProvider
-
getDocumentTypeNamesForFacet
Description copied from interface:SchemaManager
Returns the names of all document types that have given facet.- Specified by:
getDocumentTypeNamesForFacet
in interfaceSchemaManager
- Returns:
- null or the names as a guaranteed non-empty set.
-
getDocumentTypeNamesExtending
Description copied from interface:SchemaManager
Return the names of all document types extending the given one, which is included.- Specified by:
getDocumentTypeNamesExtending
in interfaceSchemaManager
- Returns:
- null or the set of names.
-
getDocumentTypes
Description copied from interface:TypeProvider
Gets the list of document types.- Specified by:
getDocumentTypes
in interfaceTypeProvider
-
getDocumentTypesCount
public int getDocumentTypesCount()- Specified by:
getDocumentTypesCount
in interfaceSchemaManager
-
hasSuperType
Description copied from interface:SchemaManager
Returns true ifdocType
is or extendssuperType
, false otherwise.- Specified by:
hasSuperType
in interfaceSchemaManager
-
getAllowedSubTypes
Description copied from interface:SchemaManager
Returns the types of the children that can be created inside a giventype
type.- Specified by:
getAllowedSubTypes
in interfaceSchemaManager
-
recomputeProxies
protected void recomputeProxies() -
getProxySchemas
Description copied from interface:TypeProvider
Gets the schemas on a proxy for a document of the given type.- Specified by:
getProxySchemas
in interfaceTypeProvider
-
isProxySchema
Description copied from interface:TypeProvider
Checks if a schema is on a proxy for a document of the given type.- Specified by:
isProxySchema
in interfaceTypeProvider
-
getField
Description copied from interface:SchemaManager
Returns the field with given xpath, or null if not found.- Specified by:
getField
in interfaceSchemaManager
-
getField
Description copied from interface:SchemaManager
Returns the field with given parent field and sub name, or null if not found.- Specified by:
getField
in 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, usePropertyCharacteristicHandler
methods instead- Specified by:
getDeprecatedProperties
in interfaceSchemaManager
- Returns:
- the deprecated properties handler
- Since:
- 9.2
-
getRemovedProperties
Deprecated.since 11.1, usePropertyCharacteristicHandler
methods instead- Specified by:
getRemovedProperties
in interfaceSchemaManager
- Returns:
- the removed properties handler
- Since:
- 9.2
-
getClearComplexPropertyBeforeSet
public boolean getClearComplexPropertyBeforeSet()Description copied from interface:SchemaManager
Whether or not to ignore any previous values when setting complex properties.- Specified by:
getClearComplexPropertyBeforeSet
in interfaceSchemaManager
- Returns:
true
if setting a complex property ignores any previous values
-
getAllowVersionWriteForDublinCore
public boolean getAllowVersionWriteForDublinCore()Description copied from interface:SchemaManager
Whether we allow to write the dublincore schema on a version.- Specified by:
getAllowVersionWriteForDublinCore
in interfaceSchemaManager
- Returns:
true
if 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:PropertyCharacteristicHandler
Checks if the property represented by the givenschema
andpath
is secured.- Specified by:
isSecured
in 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:PropertyCharacteristicHandler
Checks if the property represented by the givenschema
andpath
is deprecated.- Specified by:
isDeprecated
in 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:PropertyCharacteristicHandler
Checks if the property represented by the givenschema
andpath
is removed.- Specified by:
isRemoved
in 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:SchemaManager
Finds 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:
getXPathSchemaName
in 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:PropertyCharacteristicHandler
The returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getDeprecatedProperties
in interfacePropertyCharacteristicHandler
- Parameters:
schema
- the schema name (not the prefix)- Returns:
- a
Set
holding the deprecated property path
-
getRemovedProperties
Description copied from interface:PropertyCharacteristicHandler
The returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getRemovedProperties
in interfacePropertyCharacteristicHandler
- Parameters:
schema
- the schema name (not the prefix)- Returns:
- a
Set
holding the removed property path
-
getRetainableProperties
Description copied from interface:PropertyCharacteristicHandler
The returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getRetainableProperties
in interfacePropertyCharacteristicHandler
- Returns:
- a
Set
holding the retainable property path - Since:
- 2023
-
getRetainableProperties
Description copied from interface:PropertyCharacteristicHandler
The returned paths are not Nuxeo xpath as they don't have the schema prefix.- Specified by:
getRetainableProperties
in interfacePropertyCharacteristicHandler
- Parameters:
schema
- the schema name (not the prefix)- Returns:
- a
Set
holding 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:PropertyCharacteristicHandler
Returns the fallback associated to this property if exist. Fallbacks exist when property is deprecated or removed.- Specified by:
getFallback
in 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:PropertyCharacteristicHandler
Returns the indexed property paths.The returned paths are not Nuxeo xpath as they don't have the schema prefix.
- Specified by:
getIndexedProperties
in interfacePropertyCharacteristicHandler
- Parameters:
schema
- the schema name (not the prefix)- Returns:
- a
List
holding 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:TypeProvider
Gets the list of document types excluded from copy.- Specified by:
getSpecialDocumentTypes
in interfaceTypeProvider
-
propertyCharacteristics
instead