Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.storage.sql
Class Model

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.Model

public class Model
extends java.lang.Object

The Model 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

Field Summary
static java.lang.String ACL_GRANT_KEY
           
static java.lang.String ACL_GROUP_KEY
           
static java.lang.String ACL_NAME_KEY
           
static java.lang.String ACL_PERMISSION_KEY
           
static java.lang.String ACL_POS_KEY
           
static java.lang.String ACL_PROP
           
static java.lang.String ACL_TABLE_NAME
           
static java.lang.String ACL_USER_KEY
           
static java.lang.String[] ALWAYS_PREFETCHED_FRAGMENTS
          Fragments that are always prefetched.
static java.lang.String ANCESTORS_ANCESTOR_KEY
           
static java.lang.String ANCESTORS_TABLE_NAME
           
static java.lang.String CLUSTER_INVALS_FRAGMENTS_KEY
           
static java.lang.String CLUSTER_INVALS_ID_KEY
           
static java.lang.String CLUSTER_INVALS_KIND_KEY
           
static java.lang.String CLUSTER_INVALS_NODEID_KEY
           
static java.lang.String CLUSTER_INVALS_TABLE_NAME
           
static java.lang.String CLUSTER_NODES_CREATED_KEY
           
static java.lang.String CLUSTER_NODES_NODEID_KEY
           
static java.lang.String CLUSTER_NODES_TABLE_NAME
           
static java.lang.String COLL_TABLE_POS_KEY
           
static java.lang.String COLL_TABLE_VALUE_KEY
           
static java.lang.String[] COMMON_COLLECTION_FRAGMENTS
          Special (non-schema-based) collection fragments present in all types.
static java.util.List<java.lang.String> COMMON_SIMPLE_FRAGMENTS
          Special (non-schema-based) simple fragments present in all types.
static java.lang.String FIELD_TYPE_LARGETEXT
          Specified in ext. point to use CLOBs.
static java.lang.String FULLTEXT_BINARYTEXT_KEY
           
static java.lang.String FULLTEXT_BINARYTEXT_PROP
           
static java.lang.String FULLTEXT_DEFAULT_INDEX
           
static java.lang.String FULLTEXT_FULLTEXT_KEY
           
static java.lang.String FULLTEXT_FULLTEXT_PROP
           
static java.lang.String FULLTEXT_SIMPLETEXT_KEY
           
static java.lang.String FULLTEXT_SIMPLETEXT_PROP
           
static java.lang.String FULLTEXT_TABLE_NAME
           
 ModelFulltext fulltextInfo
           
static java.lang.String HIER_CHILD_ISPROPERTY_KEY
           
static java.lang.String HIER_CHILD_NAME_KEY
           
static java.lang.String HIER_CHILD_POS_KEY
           
static java.lang.String HIER_PARENT_KEY
           
static java.lang.String HIER_READ_ACL_ACL_ID
           
static java.lang.String HIER_READ_ACL_ID
           
static java.lang.String HIER_READ_ACL_TABLE_NAME
           
static java.lang.String HIER_TABLE_NAME
           
static java.lang.String LOCK_KEY
           
static java.lang.String LOCK_PROP
           
static java.lang.String LOCK_TABLE_NAME
           
static java.lang.String MAIN_BASE_VERSION_KEY
           
static java.lang.String MAIN_BASE_VERSION_PROP
           
static java.lang.String MAIN_CHECKED_IN_KEY
           
static java.lang.String MAIN_CHECKED_IN_PROP
           
static java.lang.String MAIN_IS_VERSION_KEY
           
static java.lang.String MAIN_IS_VERSION_PROP
           
static java.lang.String MAIN_KEY
           
static java.lang.String MAIN_MAJOR_VERSION_KEY
           
static java.lang.String MAIN_MAJOR_VERSION_PROP
           
static java.lang.String MAIN_MINOR_VERSION_KEY
           
static java.lang.String MAIN_MINOR_VERSION_PROP
           
static java.lang.String MAIN_PRIMARY_TYPE_KEY
           
static java.lang.String MAIN_PRIMARY_TYPE_PROP
           
static java.lang.String MISC_LIFECYCLE_POLICY_KEY
           
static java.lang.String MISC_LIFECYCLE_POLICY_PROP
           
static java.lang.String MISC_LIFECYCLE_STATE_KEY
           
static java.lang.String MISC_LIFECYCLE_STATE_PROP
           
static java.lang.String MISC_TABLE_NAME
           
static java.lang.String PROXY_TABLE_NAME
           
static java.lang.String PROXY_TARGET_KEY
           
static java.lang.String PROXY_TARGET_PROP
           
static java.lang.String PROXY_TYPE
           
static java.lang.String PROXY_VERSIONABLE_KEY
           
static java.lang.String PROXY_VERSIONABLE_PROP
           
static java.lang.String REPOINFO_REPONAME_KEY
           
static java.lang.String REPOINFO_TABLE_NAME
           
static java.lang.String ROOT_TYPE
           
static java.lang.String UID_MAJOR_VERSION_KEY
           
static java.lang.String UID_MINOR_VERSION_KEY
           
static java.lang.String UID_SCHEMA_NAME
           
static java.lang.String VERSION_CREATED_KEY
           
static java.lang.String VERSION_CREATED_PROP
           
static java.lang.String VERSION_DESCRIPTION_KEY
           
static java.lang.String VERSION_DESCRIPTION_PROP
           
static java.lang.String VERSION_IS_LATEST_KEY
           
static java.lang.String VERSION_IS_LATEST_MAJOR_KEY
           
static java.lang.String VERSION_IS_LATEST_MAJOR_PROP
           
static java.lang.String VERSION_IS_LATEST_PROP
           
static java.lang.String VERSION_LABEL_KEY
           
static java.lang.String VERSION_LABEL_PROP
           
static java.lang.String VERSION_TABLE_NAME
           
static java.lang.String VERSION_VERSIONABLE_KEY
           
static java.lang.String VERSION_VERSIONABLE_PROP
           
 
Constructor Summary
Model(ModelSetup modelSetup)
           
 
Method Summary
 java.io.Serializable generateNewId()
          Computes a new unique id.
 PropertyType getCollectionFragmentType(java.lang.String fragmentName)
           
 java.lang.String getCollectionOrderBy(java.lang.String fragmentName)
           
 java.util.Set<java.lang.String> getDocumentSubTypes(java.lang.String typeName)
           
 java.lang.String getDocumentSuperType(java.lang.String typeName)
           
 java.util.Set<java.lang.String> getDocumentTypeFacets(java.lang.String typeName)
           
 java.util.Map<java.lang.String,ColumnType> getFragmentKeysType(java.lang.String fragmentName)
           
 java.util.Set<java.lang.String> getFragmentNames()
           
 PropertyType getFulltextFieldType(java.lang.String fragmentName, java.lang.String fragmentKey)
          Finds out if a field is to be indexed as fulltext.
 java.lang.String getFulltextIndexSuffix(java.lang.String indexName)
           
 ModelFulltext getFulltextInfo()
           
 ModelProperty getPathPropertyInfo(java.lang.String typeName, java.lang.String path)
           
 java.util.Map<java.lang.String,java.util.Set<java.io.Serializable>> getPerFragmentIds(java.util.Map<java.io.Serializable,java.lang.String> idType)
          Given a map of id to types, returns a map of fragment names to ids.
 ModelProperty getPropertyInfo(java.lang.String propertyName)
           
 ModelProperty getPropertyInfo(java.lang.String schemaName, java.lang.String propertyName)
           
 java.util.Set<java.lang.String> getPropertyInfoNames()
           
 RepositoryDescriptor getRepositoryDescriptor()
          Gets the repository descriptor used for this model.
 Type getSpecialPropertyType(java.lang.String propertyName)
           
 java.util.Set<java.lang.String> getTypeFragments(java.lang.String typeName)
           
 java.util.Set<java.lang.String> getTypePrefetchedFragments(java.lang.String typeName)
           
 java.util.Set<java.lang.String> getTypeSimpleFragments(java.lang.String typeName)
           
 java.util.Set<java.lang.String> getTypeSimpleTextPropertyPaths(java.lang.String typeName)
           
 boolean isCollectionFragment(java.lang.String fragmentName)
           
 boolean isDocumentType(java.lang.String typeName)
           
 boolean isType(java.lang.String typeName)
           
 java.io.Serializable unHackStringId(java.lang.String id)
          Fixup an id that has been turned into a string for high-level Nuxeo APIs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_TYPE

public static final java.lang.String ROOT_TYPE
See Also:
Constant Field Values

REPOINFO_TABLE_NAME

public static final java.lang.String REPOINFO_TABLE_NAME
See Also:
Constant Field Values

REPOINFO_REPONAME_KEY

public static final java.lang.String REPOINFO_REPONAME_KEY
See Also:
Constant Field Values

MAIN_KEY

public static final java.lang.String MAIN_KEY
See Also:
Constant Field Values

CLUSTER_NODES_TABLE_NAME

public static final java.lang.String CLUSTER_NODES_TABLE_NAME
See Also:
Constant Field Values

CLUSTER_NODES_NODEID_KEY

public static final java.lang.String CLUSTER_NODES_NODEID_KEY
See Also:
Constant Field Values

CLUSTER_NODES_CREATED_KEY

public static final java.lang.String CLUSTER_NODES_CREATED_KEY
See Also:
Constant Field Values

CLUSTER_INVALS_TABLE_NAME

public static final java.lang.String CLUSTER_INVALS_TABLE_NAME
See Also:
Constant Field Values

CLUSTER_INVALS_NODEID_KEY

public static final java.lang.String CLUSTER_INVALS_NODEID_KEY
See Also:
Constant Field Values

CLUSTER_INVALS_ID_KEY

public static final java.lang.String CLUSTER_INVALS_ID_KEY
See Also:
Constant Field Values

CLUSTER_INVALS_FRAGMENTS_KEY

public static final java.lang.String CLUSTER_INVALS_FRAGMENTS_KEY
See Also:
Constant Field Values

CLUSTER_INVALS_KIND_KEY

public static final java.lang.String CLUSTER_INVALS_KIND_KEY
See Also:
Constant Field Values

MAIN_PRIMARY_TYPE_PROP

public static final java.lang.String MAIN_PRIMARY_TYPE_PROP
See Also:
Constant Field Values

MAIN_PRIMARY_TYPE_KEY

public static final java.lang.String MAIN_PRIMARY_TYPE_KEY
See Also:
Constant Field Values

MAIN_BASE_VERSION_PROP

public static final java.lang.String MAIN_BASE_VERSION_PROP
See Also:
Constant Field Values

MAIN_BASE_VERSION_KEY

public static final java.lang.String MAIN_BASE_VERSION_KEY
See Also:
Constant Field Values

MAIN_CHECKED_IN_PROP

public static final java.lang.String MAIN_CHECKED_IN_PROP
See Also:
Constant Field Values

MAIN_CHECKED_IN_KEY

public static final java.lang.String MAIN_CHECKED_IN_KEY
See Also:
Constant Field Values

MAIN_MAJOR_VERSION_PROP

public static final java.lang.String MAIN_MAJOR_VERSION_PROP
See Also:
Constant Field Values

MAIN_MAJOR_VERSION_KEY

public static final java.lang.String MAIN_MAJOR_VERSION_KEY
See Also:
Constant Field Values

MAIN_MINOR_VERSION_PROP

public static final java.lang.String MAIN_MINOR_VERSION_PROP
See Also:
Constant Field Values

MAIN_MINOR_VERSION_KEY

public static final java.lang.String MAIN_MINOR_VERSION_KEY
See Also:
Constant Field Values

MAIN_IS_VERSION_PROP

public static final java.lang.String MAIN_IS_VERSION_PROP
See Also:
Constant Field Values

MAIN_IS_VERSION_KEY

public static final java.lang.String MAIN_IS_VERSION_KEY
See Also:
Constant Field Values

UID_SCHEMA_NAME

public static final java.lang.String UID_SCHEMA_NAME
See Also:
Constant Field Values

UID_MAJOR_VERSION_KEY

public static final java.lang.String UID_MAJOR_VERSION_KEY
See Also:
Constant Field Values

UID_MINOR_VERSION_KEY

public static final java.lang.String UID_MINOR_VERSION_KEY
See Also:
Constant Field Values

HIER_TABLE_NAME

public static final java.lang.String HIER_TABLE_NAME
See Also:
Constant Field Values

HIER_PARENT_KEY

public static final java.lang.String HIER_PARENT_KEY
See Also:
Constant Field Values

HIER_CHILD_NAME_KEY

public static final java.lang.String HIER_CHILD_NAME_KEY
See Also:
Constant Field Values

HIER_CHILD_POS_KEY

public static final java.lang.String HIER_CHILD_POS_KEY
See Also:
Constant Field Values

HIER_CHILD_ISPROPERTY_KEY

public static final java.lang.String HIER_CHILD_ISPROPERTY_KEY
See Also:
Constant Field Values

ANCESTORS_TABLE_NAME

public static final java.lang.String ANCESTORS_TABLE_NAME
See Also:
Constant Field Values

ANCESTORS_ANCESTOR_KEY

public static final java.lang.String ANCESTORS_ANCESTOR_KEY
See Also:
Constant Field Values

COLL_TABLE_POS_KEY

public static final java.lang.String COLL_TABLE_POS_KEY
See Also:
Constant Field Values

COLL_TABLE_VALUE_KEY

public static final java.lang.String COLL_TABLE_VALUE_KEY
See Also:
Constant Field Values

MISC_TABLE_NAME

public static final java.lang.String MISC_TABLE_NAME
See Also:
Constant Field Values

MISC_LIFECYCLE_POLICY_PROP

public static final java.lang.String MISC_LIFECYCLE_POLICY_PROP
See Also:
Constant Field Values

MISC_LIFECYCLE_POLICY_KEY

public static final java.lang.String MISC_LIFECYCLE_POLICY_KEY
See Also:
Constant Field Values

MISC_LIFECYCLE_STATE_PROP

public static final java.lang.String MISC_LIFECYCLE_STATE_PROP
See Also:
Constant Field Values

MISC_LIFECYCLE_STATE_KEY

public static final java.lang.String MISC_LIFECYCLE_STATE_KEY
See Also:
Constant Field Values

ACL_TABLE_NAME

public static final java.lang.String ACL_TABLE_NAME
See Also:
Constant Field Values

ACL_PROP

public static final java.lang.String ACL_PROP
See Also:
Constant Field Values

ACL_POS_KEY

public static final java.lang.String ACL_POS_KEY
See Also:
Constant Field Values

ACL_NAME_KEY

public static final java.lang.String ACL_NAME_KEY
See Also:
Constant Field Values

ACL_GRANT_KEY

public static final java.lang.String ACL_GRANT_KEY
See Also:
Constant Field Values

ACL_PERMISSION_KEY

public static final java.lang.String ACL_PERMISSION_KEY
See Also:
Constant Field Values

ACL_USER_KEY

public static final java.lang.String ACL_USER_KEY
See Also:
Constant Field Values

ACL_GROUP_KEY

public static final java.lang.String ACL_GROUP_KEY
See Also:
Constant Field Values

VERSION_TABLE_NAME

public static final java.lang.String VERSION_TABLE_NAME
See Also:
Constant Field Values

VERSION_VERSIONABLE_PROP

public static final java.lang.String VERSION_VERSIONABLE_PROP
See Also:
Constant Field Values

VERSION_VERSIONABLE_KEY

public static final java.lang.String VERSION_VERSIONABLE_KEY
See Also:
Constant Field Values

VERSION_CREATED_PROP

public static final java.lang.String VERSION_CREATED_PROP
See Also:
Constant Field Values

VERSION_CREATED_KEY

public static final java.lang.String VERSION_CREATED_KEY
See Also:
Constant Field Values

VERSION_LABEL_PROP

public static final java.lang.String VERSION_LABEL_PROP
See Also:
Constant Field Values

VERSION_LABEL_KEY

public static final java.lang.String VERSION_LABEL_KEY
See Also:
Constant Field Values

VERSION_DESCRIPTION_PROP

public static final java.lang.String VERSION_DESCRIPTION_PROP
See Also:
Constant Field Values

VERSION_DESCRIPTION_KEY

public static final java.lang.String VERSION_DESCRIPTION_KEY
See Also:
Constant Field Values

VERSION_IS_LATEST_PROP

public static final java.lang.String VERSION_IS_LATEST_PROP
See Also:
Constant Field Values

VERSION_IS_LATEST_KEY

public static final java.lang.String VERSION_IS_LATEST_KEY
See Also:
Constant Field Values

VERSION_IS_LATEST_MAJOR_PROP

public static final java.lang.String VERSION_IS_LATEST_MAJOR_PROP
See Also:
Constant Field Values

VERSION_IS_LATEST_MAJOR_KEY

public static final java.lang.String VERSION_IS_LATEST_MAJOR_KEY
See Also:
Constant Field Values

PROXY_TYPE

public static final java.lang.String PROXY_TYPE
See Also:
Constant Field Values

PROXY_TABLE_NAME

public static final java.lang.String PROXY_TABLE_NAME
See Also:
Constant Field Values

PROXY_TARGET_PROP

public static final java.lang.String PROXY_TARGET_PROP
See Also:
Constant Field Values

PROXY_TARGET_KEY

public static final java.lang.String PROXY_TARGET_KEY
See Also:
Constant Field Values

PROXY_VERSIONABLE_PROP

public static final java.lang.String PROXY_VERSIONABLE_PROP
See Also:
Constant Field Values

PROXY_VERSIONABLE_KEY

public static final java.lang.String PROXY_VERSIONABLE_KEY
See Also:
Constant Field Values

LOCK_TABLE_NAME

public static final java.lang.String LOCK_TABLE_NAME
See Also:
Constant Field Values

LOCK_PROP

public static final java.lang.String LOCK_PROP
See Also:
Constant Field Values

LOCK_KEY

public static final java.lang.String LOCK_KEY
See Also:
Constant Field Values

FULLTEXT_DEFAULT_INDEX

public static final java.lang.String FULLTEXT_DEFAULT_INDEX
See Also:
Constant Field Values

FULLTEXT_TABLE_NAME

public static final java.lang.String FULLTEXT_TABLE_NAME
See Also:
Constant Field Values

FULLTEXT_FULLTEXT_PROP

public static final java.lang.String FULLTEXT_FULLTEXT_PROP
See Also:
Constant Field Values

FULLTEXT_FULLTEXT_KEY

public static final java.lang.String FULLTEXT_FULLTEXT_KEY
See Also:
Constant Field Values

FULLTEXT_SIMPLETEXT_PROP

public static final java.lang.String FULLTEXT_SIMPLETEXT_PROP
See Also:
Constant Field Values

FULLTEXT_SIMPLETEXT_KEY

public static final java.lang.String FULLTEXT_SIMPLETEXT_KEY
See Also:
Constant Field Values

FULLTEXT_BINARYTEXT_PROP

public static final java.lang.String FULLTEXT_BINARYTEXT_PROP
See Also:
Constant Field Values

FULLTEXT_BINARYTEXT_KEY

public static final java.lang.String FULLTEXT_BINARYTEXT_KEY
See Also:
Constant Field Values

HIER_READ_ACL_TABLE_NAME

public static final java.lang.String HIER_READ_ACL_TABLE_NAME
See Also:
Constant Field Values

HIER_READ_ACL_ID

public static final java.lang.String HIER_READ_ACL_ID
See Also:
Constant Field Values

HIER_READ_ACL_ACL_ID

public static final java.lang.String HIER_READ_ACL_ACL_ID
See Also:
Constant Field Values

FIELD_TYPE_LARGETEXT

public static final java.lang.String FIELD_TYPE_LARGETEXT
Specified in ext. point to use CLOBs.

See Also:
Constant Field Values

COMMON_SIMPLE_FRAGMENTS

public static final java.util.List<java.lang.String> COMMON_SIMPLE_FRAGMENTS
Special (non-schema-based) simple fragments present in all types. FULLTEXT_TABLE_NAME is added to it if not disabled.


COMMON_COLLECTION_FRAGMENTS

public static final java.lang.String[] COMMON_COLLECTION_FRAGMENTS
Special (non-schema-based) collection fragments present in all types.


ALWAYS_PREFETCHED_FRAGMENTS

public static final java.lang.String[] ALWAYS_PREFETCHED_FRAGMENTS
Fragments that are always prefetched.


fulltextInfo

public final ModelFulltext fulltextInfo
Constructor Detail

Model

public Model(ModelSetup modelSetup)
      throws StorageException
Throws:
StorageException
Method Detail

getRepositoryDescriptor

public RepositoryDescriptor getRepositoryDescriptor()
Gets the repository descriptor used for this model.

Returns:
the repository descriptor

generateNewId

public java.io.Serializable generateNewId()
Computes a new unique id.

If actual ids are computed by the database, this will be a temporary id, otherwise the final one.

Returns:
a new id, which may be temporary

unHackStringId

public java.io.Serializable unHackStringId(java.lang.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

getPropertyInfo

public ModelProperty getPropertyInfo(java.lang.String schemaName,
                                     java.lang.String propertyName)

getPropertyInfo

public ModelProperty getPropertyInfo(java.lang.String propertyName)

getPropertyInfoNames

public java.util.Set<java.lang.String> getPropertyInfoNames()

getPathPropertyInfo

public ModelProperty getPathPropertyInfo(java.lang.String typeName,
                                         java.lang.String path)

getTypeSimpleTextPropertyPaths

public java.util.Set<java.lang.String> getTypeSimpleTextPropertyPaths(java.lang.String typeName)

getFulltextInfo

public ModelFulltext getFulltextInfo()

getFulltextFieldType

public PropertyType getFulltextFieldType(java.lang.String fragmentName,
                                         java.lang.String fragmentKey)
Finds out if a field is to be indexed as fulltext.

Parameters:
fragmentName -
fragmentKey - the key or null for a collection
Returns:
PropertyType.STRING or PropertyType.BINARY if this field is to be indexed as fulltext

getSpecialPropertyType

public Type getSpecialPropertyType(java.lang.String propertyName)

getCollectionFragmentType

public PropertyType getCollectionFragmentType(java.lang.String fragmentName)

isCollectionFragment

public boolean isCollectionFragment(java.lang.String fragmentName)

getCollectionOrderBy

public java.lang.String getCollectionOrderBy(java.lang.String fragmentName)

getFragmentNames

public java.util.Set<java.lang.String> getFragmentNames()

getFragmentKeysType

public java.util.Map<java.lang.String,ColumnType> getFragmentKeysType(java.lang.String fragmentName)

getTypeSimpleFragments

public java.util.Set<java.lang.String> getTypeSimpleFragments(java.lang.String typeName)

getTypeFragments

public java.util.Set<java.lang.String> getTypeFragments(java.lang.String typeName)

getTypePrefetchedFragments

public java.util.Set<java.lang.String> getTypePrefetchedFragments(java.lang.String typeName)

isType

public boolean isType(java.lang.String typeName)

isDocumentType

public boolean isDocumentType(java.lang.String typeName)

getDocumentSuperType

public java.lang.String getDocumentSuperType(java.lang.String typeName)

getDocumentSubTypes

public java.util.Set<java.lang.String> getDocumentSubTypes(java.lang.String typeName)

getDocumentTypeFacets

public java.util.Set<java.lang.String> getDocumentTypeFacets(java.lang.String typeName)

getPerFragmentIds

public java.util.Map<java.lang.String,java.util.Set<java.io.Serializable>> getPerFragmentIds(java.util.Map<java.io.Serializable,java.lang.String> idType)
Given a map of id to types, returns a map of fragment names to ids.


getFulltextIndexSuffix

public java.lang.String getFulltextIndexSuffix(java.lang.String indexName)

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.