Package org.nuxeo.ecm.core.storage.sql
Class Model
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.Model
-
public class Model extends Object
TheModel
is the link between high-level types and SQL-level objects (entity tables, collections). It defines all policies relating to the choice of structure (what schema are grouped together in for optimization) and names in the SQL database (table names, column names), and to what entity names (type name, field name) they correspond.A Nuxeo schema or type is mapped to a SQL-level table. Several types can be aggregated in the same table. In theory, a type could even be split into different tables.
- Author:
- Florent Guillaume
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Model.IdType
Type of ids as seen by the VCS Java layer.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Model(ModelSetup modelSetup)
-
Method Summary
-
-
-
Field Detail
-
ROOT_TYPE
public static final String ROOT_TYPE
- See Also:
- Constant Field Values
-
REPOINFO_TABLE_NAME
public static final String REPOINFO_TABLE_NAME
- See Also:
- Constant Field Values
-
REPOINFO_REPONAME_KEY
public static final String REPOINFO_REPONAME_KEY
- See Also:
- Constant Field Values
-
MAIN_KEY
public static final String MAIN_KEY
- See Also:
- Constant Field Values
-
CLUSTER_NODES_TABLE_NAME
public static final String CLUSTER_NODES_TABLE_NAME
- See Also:
- Constant Field Values
-
CLUSTER_NODES_NODEID_KEY
public static final String CLUSTER_NODES_NODEID_KEY
- See Also:
- Constant Field Values
-
CLUSTER_NODES_CREATED_KEY
public static final String CLUSTER_NODES_CREATED_KEY
- See Also:
- Constant Field Values
-
CLUSTER_INVALS_TABLE_NAME
public static final String CLUSTER_INVALS_TABLE_NAME
- See Also:
- Constant Field Values
-
CLUSTER_INVALS_NODEID_KEY
public static final String CLUSTER_INVALS_NODEID_KEY
- See Also:
- Constant Field Values
-
CLUSTER_INVALS_ID_KEY
public static final String CLUSTER_INVALS_ID_KEY
- See Also:
- Constant Field Values
-
CLUSTER_INVALS_FRAGMENTS_KEY
public static final String CLUSTER_INVALS_FRAGMENTS_KEY
- See Also:
- Constant Field Values
-
CLUSTER_INVALS_KIND_KEY
public static final String CLUSTER_INVALS_KIND_KEY
- See Also:
- Constant Field Values
-
MAIN_PRIMARY_TYPE_PROP
public static final String MAIN_PRIMARY_TYPE_PROP
- See Also:
- Constant Field Values
-
MAIN_PRIMARY_TYPE_KEY
public static final String MAIN_PRIMARY_TYPE_KEY
- See Also:
- Constant Field Values
-
MAIN_MIXIN_TYPES_PROP
public static final String MAIN_MIXIN_TYPES_PROP
- See Also:
- Constant Field Values
-
MAIN_MIXIN_TYPES_KEY
public static final String MAIN_MIXIN_TYPES_KEY
- See Also:
- Constant Field Values
-
MAIN_IS_RECORD_PROP
public static final String MAIN_IS_RECORD_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
MAIN_IS_FLEXIBLE_RECORD_PROP
public static final String MAIN_IS_FLEXIBLE_RECORD_PROP
- Since:
- 2023.1
- See Also:
- Constant Field Values
-
MAIN_IS_RECORD_KEY
public static final String MAIN_IS_RECORD_KEY
- Since:
- 11.1
- See Also:
- Constant Field Values
-
MAIN_IS_FLEXIBLE_RECORD_KEY
public static final String MAIN_IS_FLEXIBLE_RECORD_KEY
- Since:
- 2023.1
- See Also:
- Constant Field Values
-
MAIN_RETAINED_PROPS_PROP
public static final String MAIN_RETAINED_PROPS_PROP
- Since:
- 2021.32
- See Also:
- Constant Field Values
-
MAIN_RETAINED_PROPS_KEY
public static final String MAIN_RETAINED_PROPS_KEY
- Since:
- 2021.32
- See Also:
- Constant Field Values
-
MAIN_RETAIN_UNTIL_PROP
public static final String MAIN_RETAIN_UNTIL_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
MAIN_RETAIN_UNTIL_KEY
public static final String MAIN_RETAIN_UNTIL_KEY
- Since:
- 11.1
- See Also:
- Constant Field Values
-
MAIN_HAS_LEGAL_HOLD_PROP
public static final String MAIN_HAS_LEGAL_HOLD_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
MAIN_HAS_LEGAL_HOLD_KEY
public static final String MAIN_HAS_LEGAL_HOLD_KEY
- Since:
- 11.1
- See Also:
- Constant Field Values
-
MAIN_IS_RETENTION_ACTIVE_PROP
@Deprecated public static final String MAIN_IS_RETENTION_ACTIVE_PROP
Deprecated.since 11.1- See Also:
- Constant Field Values
-
MAIN_IS_RETENTION_ACTIVE_KEY
@Deprecated public static final String MAIN_IS_RETENTION_ACTIVE_KEY
Deprecated.since 11.1- See Also:
- Constant Field Values
-
MAIN_BASE_VERSION_PROP
public static final String MAIN_BASE_VERSION_PROP
- See Also:
- Constant Field Values
-
MAIN_BASE_VERSION_KEY
public static final String MAIN_BASE_VERSION_KEY
- See Also:
- Constant Field Values
-
MAIN_CHECKED_IN_PROP
public static final String MAIN_CHECKED_IN_PROP
- See Also:
- Constant Field Values
-
MAIN_CHECKED_IN_KEY
public static final String MAIN_CHECKED_IN_KEY
- See Also:
- Constant Field Values
-
MAIN_MAJOR_VERSION_PROP
public static final String MAIN_MAJOR_VERSION_PROP
- See Also:
- Constant Field Values
-
MAIN_MAJOR_VERSION_KEY
public static final String MAIN_MAJOR_VERSION_KEY
- See Also:
- Constant Field Values
-
MAIN_MINOR_VERSION_PROP
public static final String MAIN_MINOR_VERSION_PROP
- See Also:
- Constant Field Values
-
MAIN_MINOR_VERSION_KEY
public static final String MAIN_MINOR_VERSION_KEY
- See Also:
- Constant Field Values
-
MAIN_IS_VERSION_PROP
public static final String MAIN_IS_VERSION_PROP
- See Also:
- Constant Field Values
-
MAIN_IS_VERSION_KEY
public static final String MAIN_IS_VERSION_KEY
- See Also:
- Constant Field Values
-
MAIN_SYS_CHANGE_TOKEN_PROP
public static final String MAIN_SYS_CHANGE_TOKEN_PROP
- See Also:
- Constant Field Values
-
MAIN_SYS_CHANGE_TOKEN_KEY
public static final String MAIN_SYS_CHANGE_TOKEN_KEY
- See Also:
- Constant Field Values
-
MAIN_CHANGE_TOKEN_PROP
public static final String MAIN_CHANGE_TOKEN_PROP
- See Also:
- Constant Field Values
-
MAIN_CHANGE_TOKEN_KEY
public static final String MAIN_CHANGE_TOKEN_KEY
- See Also:
- Constant Field Values
-
MAIN_IS_DELETED_PROP
public static final String MAIN_IS_DELETED_PROP
- See Also:
- Constant Field Values
-
MAIN_IS_DELETED_KEY
public static final String MAIN_IS_DELETED_KEY
- See Also:
- Constant Field Values
-
MAIN_DELETED_TIME_PROP
public static final String MAIN_DELETED_TIME_PROP
- See Also:
- Constant Field Values
-
MAIN_DELETED_TIME_KEY
public static final String MAIN_DELETED_TIME_KEY
- See Also:
- Constant Field Values
-
MAIN_IS_TRASHED_PROP
public static final String MAIN_IS_TRASHED_PROP
- Since:
- 10.1
- See Also:
- Constant Field Values
-
MAIN_IS_TRASHED_KEY
public static final String MAIN_IS_TRASHED_KEY
- Since:
- 10.1
- See Also:
- Constant Field Values
-
UID_SCHEMA_NAME
public static final String UID_SCHEMA_NAME
- See Also:
- Constant Field Values
-
UID_MAJOR_VERSION_KEY
public static final String UID_MAJOR_VERSION_KEY
- See Also:
- Constant Field Values
-
UID_MINOR_VERSION_KEY
public static final String UID_MINOR_VERSION_KEY
- See Also:
- Constant Field Values
-
HIER_TABLE_NAME
public static final String HIER_TABLE_NAME
- See Also:
- Constant Field Values
-
HIER_PARENT_KEY
public static final String HIER_PARENT_KEY
- See Also:
- Constant Field Values
-
HIER_CHILD_NAME_KEY
public static final String HIER_CHILD_NAME_KEY
- See Also:
- Constant Field Values
-
HIER_CHILD_POS_KEY
public static final String HIER_CHILD_POS_KEY
- See Also:
- Constant Field Values
-
HIER_CHILD_ISPROPERTY_KEY
public static final String HIER_CHILD_ISPROPERTY_KEY
- See Also:
- Constant Field Values
-
ANCESTORS_TABLE_NAME
public static final String ANCESTORS_TABLE_NAME
- See Also:
- Constant Field Values
-
ANCESTORS_ANCESTOR_KEY
public static final String ANCESTORS_ANCESTOR_KEY
- See Also:
- Constant Field Values
-
COLL_TABLE_POS_KEY
public static final String COLL_TABLE_POS_KEY
- See Also:
- Constant Field Values
-
COLL_TABLE_VALUE_KEY
public static final String COLL_TABLE_VALUE_KEY
- See Also:
- Constant Field Values
-
MISC_TABLE_NAME
public static final String MISC_TABLE_NAME
- See Also:
- Constant Field Values
-
MISC_LIFECYCLE_POLICY_PROP
public static final String MISC_LIFECYCLE_POLICY_PROP
- See Also:
- Constant Field Values
-
MISC_LIFECYCLE_POLICY_KEY
public static final String MISC_LIFECYCLE_POLICY_KEY
- See Also:
- Constant Field Values
-
MISC_LIFECYCLE_STATE_PROP
public static final String MISC_LIFECYCLE_STATE_PROP
- See Also:
- Constant Field Values
-
MISC_LIFECYCLE_STATE_KEY
public static final String MISC_LIFECYCLE_STATE_KEY
- See Also:
- Constant Field Values
-
ACL_TABLE_NAME
public static final String ACL_TABLE_NAME
- See Also:
- Constant Field Values
-
ACL_PROP
public static final String ACL_PROP
- See Also:
- Constant Field Values
-
ACL_POS_KEY
public static final String ACL_POS_KEY
- See Also:
- Constant Field Values
-
ACL_NAME_KEY
public static final String ACL_NAME_KEY
- See Also:
- Constant Field Values
-
ACL_GRANT_KEY
public static final String ACL_GRANT_KEY
- See Also:
- Constant Field Values
-
ACL_PERMISSION_KEY
public static final String ACL_PERMISSION_KEY
- See Also:
- Constant Field Values
-
ACL_CREATOR_KEY
public static final String ACL_CREATOR_KEY
- See Also:
- Constant Field Values
-
ACL_BEGIN_KEY
public static final String ACL_BEGIN_KEY
- See Also:
- Constant Field Values
-
ACL_END_KEY
public static final String ACL_END_KEY
- See Also:
- Constant Field Values
-
ACL_STATUS_KEY
public static final String ACL_STATUS_KEY
- See Also:
- Constant Field Values
-
ACL_USER_KEY
public static final String ACL_USER_KEY
- See Also:
- Constant Field Values
-
ACL_GROUP_KEY
public static final String ACL_GROUP_KEY
- See Also:
- Constant Field Values
-
VERSION_TABLE_NAME
public static final String VERSION_TABLE_NAME
- See Also:
- Constant Field Values
-
VERSION_VERSIONABLE_PROP
public static final String VERSION_VERSIONABLE_PROP
- See Also:
- Constant Field Values
-
VERSION_VERSIONABLE_KEY
public static final String VERSION_VERSIONABLE_KEY
- See Also:
- Constant Field Values
-
VERSION_CREATED_PROP
public static final String VERSION_CREATED_PROP
- See Also:
- Constant Field Values
-
VERSION_CREATED_KEY
public static final String VERSION_CREATED_KEY
- See Also:
- Constant Field Values
-
VERSION_LABEL_PROP
public static final String VERSION_LABEL_PROP
- See Also:
- Constant Field Values
-
VERSION_LABEL_KEY
public static final String VERSION_LABEL_KEY
- See Also:
- Constant Field Values
-
VERSION_DESCRIPTION_PROP
public static final String VERSION_DESCRIPTION_PROP
- See Also:
- Constant Field Values
-
VERSION_DESCRIPTION_KEY
public static final String VERSION_DESCRIPTION_KEY
- See Also:
- Constant Field Values
-
VERSION_IS_LATEST_PROP
public static final String VERSION_IS_LATEST_PROP
- See Also:
- Constant Field Values
-
VERSION_IS_LATEST_KEY
public static final String VERSION_IS_LATEST_KEY
- See Also:
- Constant Field Values
-
VERSION_IS_LATEST_MAJOR_PROP
public static final String VERSION_IS_LATEST_MAJOR_PROP
- See Also:
- Constant Field Values
-
VERSION_IS_LATEST_MAJOR_KEY
public static final String VERSION_IS_LATEST_MAJOR_KEY
- See Also:
- Constant Field Values
-
PROXY_TYPE
public static final String PROXY_TYPE
- See Also:
- Constant Field Values
-
PROXY_TABLE_NAME
public static final String PROXY_TABLE_NAME
- See Also:
- Constant Field Values
-
PROXY_TARGET_PROP
public static final String PROXY_TARGET_PROP
- See Also:
- Constant Field Values
-
PROXY_TARGET_KEY
public static final String PROXY_TARGET_KEY
- See Also:
- Constant Field Values
-
PROXY_VERSIONABLE_PROP
public static final String PROXY_VERSIONABLE_PROP
- See Also:
- Constant Field Values
-
PROXY_VERSIONABLE_KEY
public static final String PROXY_VERSIONABLE_KEY
- See Also:
- Constant Field Values
-
LOCK_TABLE_NAME
public static final String LOCK_TABLE_NAME
- See Also:
- Constant Field Values
-
LOCK_OWNER_PROP
public static final String LOCK_OWNER_PROP
- See Also:
- Constant Field Values
-
LOCK_OWNER_KEY
public static final String LOCK_OWNER_KEY
- See Also:
- Constant Field Values
-
LOCK_CREATED_PROP
public static final String LOCK_CREATED_PROP
- See Also:
- Constant Field Values
-
LOCK_CREATED_KEY
public static final String LOCK_CREATED_KEY
- See Also:
- Constant Field Values
-
FULLTEXT_DEFAULT_INDEX
public static final String FULLTEXT_DEFAULT_INDEX
- See Also:
- Constant Field Values
-
FULLTEXT_TABLE_NAME
public static final String FULLTEXT_TABLE_NAME
- See Also:
- Constant Field Values
-
FULLTEXT_JOBID_PROP
public static final String FULLTEXT_JOBID_PROP
- See Also:
- Constant Field Values
-
FULLTEXT_JOBID_KEY
public static final String FULLTEXT_JOBID_KEY
- See Also:
- Constant Field Values
-
FULLTEXT_FULLTEXT_PROP
public static final String FULLTEXT_FULLTEXT_PROP
- See Also:
- Constant Field Values
-
FULLTEXT_FULLTEXT_KEY
public static final String FULLTEXT_FULLTEXT_KEY
- See Also:
- Constant Field Values
-
FULLTEXT_SIMPLETEXT_PROP
public static final String FULLTEXT_SIMPLETEXT_PROP
- See Also:
- Constant Field Values
-
FULLTEXT_SIMPLETEXT_KEY
public static final String FULLTEXT_SIMPLETEXT_KEY
- See Also:
- Constant Field Values
-
FULLTEXT_BINARYTEXT_PROP
public static final String FULLTEXT_BINARYTEXT_PROP
- See Also:
- Constant Field Values
-
FULLTEXT_BINARYTEXT_KEY
public static final String FULLTEXT_BINARYTEXT_KEY
- See Also:
- Constant Field Values
-
HIER_READ_ACL_TABLE_NAME
public static final String HIER_READ_ACL_TABLE_NAME
- See Also:
- Constant Field Values
-
HIER_READ_ACL_ID
public static final String HIER_READ_ACL_ID
- See Also:
- Constant Field Values
-
HIER_READ_ACL_ACL_ID
public static final String HIER_READ_ACL_ACL_ID
- See Also:
- Constant Field Values
-
ACLR_USER_MAP_TABLE_NAME
public static final String ACLR_USER_MAP_TABLE_NAME
- See Also:
- Constant Field Values
-
ACLR_USER_MAP_USER_ID
public static final String ACLR_USER_MAP_USER_ID
- See Also:
- Constant Field Values
-
ACLR_USER_MAP_ACL_ID
public static final String ACLR_USER_MAP_ACL_ID
- See Also:
- Constant Field Values
-
FIELD_TYPE_LARGETEXT
public static final String FIELD_TYPE_LARGETEXT
Specified in ext. point to use CLOBs.- See Also:
- Constant Field Values
-
FIELD_TYPE_ARRAY
public static final String FIELD_TYPE_ARRAY
Specified in ext. point to use array instead of collection table.- See Also:
- Constant Field Values
-
FIELD_TYPE_ARRAY_LARGETEXT
public static final String FIELD_TYPE_ARRAY_LARGETEXT
Specified in ext. point to use CLOB array instead of collection table.- See Also:
- Constant Field Values
-
NO_SUCH_LONG_ID
public static final Long NO_SUCH_LONG_ID
-
INITIAL_CHANGE_TOKEN
public static final Long INITIAL_CHANGE_TOKEN
-
INITIAL_SYS_CHANGE_TOKEN
public static final Long INITIAL_SYS_CHANGE_TOKEN
-
softDeleteEnabled
protected final boolean softDeleteEnabled
-
proxiesEnabled
protected final boolean proxiesEnabled
-
changeTokenEnabled
protected final boolean changeTokenEnabled
-
idType
protected final Model.IdType idType
-
idPropertyType
protected final PropertyType idPropertyType
-
idCoreType
protected final Type idCoreType
-
miscInHierarchy
protected final boolean miscInHierarchy
If true, the misc columns are added to hierarchy, not to a separate misc table.
-
repositoryDescriptor
protected final RepositoryDescriptor repositoryDescriptor
-
documentTypesMixins
protected final Map<String,Set<String>> documentTypesMixins
Map of doctype to mixins, for search.
-
typeFragments
protected final Map<String,Set<String>> typeFragments
Map of doctype/complextype to simple+collection fragments.
-
mixinFragments
protected final Map<String,Set<String>> mixinFragments
Map of mixin to simple+collection fragments.
-
docTypePrefetchedFragments
protected final Map<String,Set<String>> docTypePrefetchedFragments
Map of doctype to prefetched fragments.
-
schemaComplexChildren
protected final Map<String,Map<String,String>> schemaComplexChildren
Map of schema to child name to type.
-
typeComplexChildren
protected final Map<String,Map<String,String>> typeComplexChildren
Map of doctype/complextype to child name to type.
-
mixinComplexChildren
protected final Map<String,Map<String,String>> mixinComplexChildren
Map of mixin to child name to type.
-
documentSuperTypes
protected final Map<String,String> documentSuperTypes
Map of doctype to its supertype, for search.
-
documentSubTypes
protected final Map<String,Set<String>> documentSubTypes
Map of doctype to its subtypes (including itself), for search.
-
fieldFragment
protected final Map<String,String> fieldFragment
Map of field name to fragment holding it. Used for prefetch.
-
fulltextConfiguration
protected final FulltextConfiguration fulltextConfiguration
-
fulltextInfoByFragment
protected final Map<String,PropertyType> fulltextInfoByFragment
Map of fragment -> info about whether there's a fulltext text field (PropertyType.STRING), binary field (PropertyType.BINARY), or both (PropertyType.BOOLEAN).
-
-
Constructor Detail
-
Model
public Model(ModelSetup modelSetup)
-
-
Method Detail
-
getRepositoryDescriptor
public RepositoryDescriptor getRepositoryDescriptor()
Gets the repository descriptor used for this model.- Returns:
- the repository descriptor
-
idFromString
public Serializable idFromString(String id)
Fixup an id that has been turned into a string for high-level Nuxeo APIs.- Parameters:
id
- the id to fixup- Returns:
- the fixed up id
-
idToString
public String idToString(Serializable id)
Turns an id that may be a String or a Long into a String for high-level Nuxeo APIs.- Parameters:
id
- the serializable id- Returns:
- the string
-
getPropertyInfo
public ModelProperty getPropertyInfo(String typeName, String propertyName)
Get doctype/complextype property info.
-
getMixinPropertyInfos
public Map<String,ModelProperty> getMixinPropertyInfos(String mixin)
-
getProxySchemasPropertyInfo
public ModelProperty getProxySchemasPropertyInfo(String propertyName)
-
getMixinPropertyInfo
public ModelProperty getMixinPropertyInfo(String mixin, String propertyName)
-
getPropertyInfo
public ModelProperty getPropertyInfo(String propertyName)
-
getPathPropertyInfo
public ModelProperty getPathPropertyInfo(String xpath)
Gets the model of the property for the given path. Returns something withModelProperty.isIntermediateSegment()
= true for an intermediate segment of a complex property.
-
getPathPropertyInfo
public ModelProperty getPathPropertyInfo(String primaryType, String[] mixinTypes, String path)
-
getSimpleTextPropertyPaths
public Set<String> getSimpleTextPropertyPaths(String primaryType, String[] mixinTypes)
-
isProxySchemaPath
public boolean isProxySchemaPath(String xpath)
Checks if the given xpath, when resolved on a proxy, points to a proxy-specific schema instead of the target document.
-
getFulltextConfiguration
public FulltextConfiguration getFulltextConfiguration()
-
getFulltextFieldType
public PropertyType getFulltextFieldType(String fragmentName, String fragmentKey)
Finds out if a field is to be indexed as fulltext.- Parameters:
fragmentKey
- the key ornull
for a collection- Returns:
PropertyType.STRING
orPropertyType.BINARY
if this field is to be indexed as fulltext
-
getFulltextInfoForFragment
public PropertyType getFulltextInfoForFragment(String fragmentName)
Checks if a fragment has any field indexable as fulltext.- Returns:
- PropertyType.STRING, PropertyType.BINARY, or PropertyType.BOOLEAN for both.
-
getCollectionFragmentType
public PropertyType getCollectionFragmentType(String fragmentName)
-
isCollectionFragment
public boolean isCollectionFragment(String fragmentName)
-
getFragmentKeysType
public Map<String,ColumnType> getFragmentKeysType(String fragmentName)
-
isType
public boolean isType(String typeName)
Checks if we have a type (doctype or complex type).
-
getPerFragmentIds
public Map<String,Set<Serializable>> getPerFragmentIds(Map<Serializable,RowMapper.IdWithTypes> idToTypes)
Given a map of id to types, returns a map of fragment names to ids.
-
getTypeFragments
public Set<String> getTypeFragments(RowMapper.IdWithTypes typeInfo)
Gets the type fragments for a primary type and mixin types. Hierarchy is included.
-
-