Nuxeo ECM Projects 5.4.3-SNAPSHOT

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

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

public class Model
extends 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 String ACL_GRANT_KEY
           
static String ACL_GROUP_KEY
           
static String ACL_NAME_KEY
           
static String ACL_PERMISSION_KEY
           
static String ACL_POS_KEY
           
static String ACL_PROP
           
static String ACL_TABLE_NAME
           
static String ACL_USER_KEY
           
static String[] ALWAYS_PREFETCHED_FRAGMENTS
          Fragments that are always prefetched.
static String ANCESTORS_ANCESTOR_KEY
           
static String ANCESTORS_TABLE_NAME
           
static String CLUSTER_INVALS_FRAGMENTS_KEY
           
static String CLUSTER_INVALS_ID_KEY
           
static String CLUSTER_INVALS_KIND_KEY
           
static String CLUSTER_INVALS_NODEID_KEY
           
static String CLUSTER_INVALS_TABLE_NAME
           
static String CLUSTER_NODES_CREATED_KEY
           
static String CLUSTER_NODES_NODEID_KEY
           
static String CLUSTER_NODES_TABLE_NAME
           
static String COLL_TABLE_POS_KEY
           
static String COLL_TABLE_VALUE_KEY
           
static String[] COMMON_COLLECTION_FRAGMENTS
          Special (non-schema-based) collection fragments present in all types.
static List<String> COMMON_SIMPLE_FRAGMENTS
          Special (non-schema-based) simple fragments present in all types.
static String FIELD_TYPE_LARGETEXT
          Specified in ext.
static String FULLTEXT_BINARYTEXT_KEY
           
static String FULLTEXT_BINARYTEXT_PROP
           
static String FULLTEXT_DEFAULT_INDEX
           
static String FULLTEXT_FULLTEXT_KEY
           
static String FULLTEXT_FULLTEXT_PROP
           
static String FULLTEXT_JOBID_KEY
           
static String FULLTEXT_JOBID_PROP
           
static String FULLTEXT_SIMPLETEXT_KEY
           
static String FULLTEXT_SIMPLETEXT_PROP
           
static String FULLTEXT_TABLE_NAME
           
 ModelFulltext fulltextInfo
           
static String HIER_CHILD_ISPROPERTY_KEY
           
static String HIER_CHILD_NAME_KEY
           
static String HIER_CHILD_POS_KEY
           
static String HIER_PARENT_KEY
           
static String HIER_READ_ACL_ACL_ID
           
static String HIER_READ_ACL_ID
           
static String HIER_READ_ACL_TABLE_NAME
           
static String HIER_TABLE_NAME
           
static String LOCK_CREATED_KEY
           
static String LOCK_CREATED_PROP
           
static String LOCK_OWNER_KEY
           
static String LOCK_OWNER_PROP
           
static String LOCK_TABLE_NAME
           
static String MAIN_BASE_VERSION_KEY
           
static String MAIN_BASE_VERSION_PROP
           
static String MAIN_CHECKED_IN_KEY
           
static String MAIN_CHECKED_IN_PROP
           
static String MAIN_IS_VERSION_KEY
           
static String MAIN_IS_VERSION_PROP
           
static String MAIN_KEY
           
static String MAIN_MAJOR_VERSION_KEY
           
static String MAIN_MAJOR_VERSION_PROP
           
static String MAIN_MINOR_VERSION_KEY
           
static String MAIN_MINOR_VERSION_PROP
           
static String MAIN_MIXIN_TYPES_KEY
           
static String MAIN_MIXIN_TYPES_PROP
           
static String MAIN_PRIMARY_TYPE_KEY
           
static String MAIN_PRIMARY_TYPE_PROP
           
static String MISC_LIFECYCLE_POLICY_KEY
           
static String MISC_LIFECYCLE_POLICY_PROP
           
static String MISC_LIFECYCLE_STATE_KEY
           
static String MISC_LIFECYCLE_STATE_PROP
           
static String MISC_TABLE_NAME
           
static String PROXY_TABLE_NAME
           
static String PROXY_TARGET_KEY
           
static String PROXY_TARGET_PROP
           
static String PROXY_TYPE
           
static String PROXY_VERSIONABLE_KEY
           
static String PROXY_VERSIONABLE_PROP
           
static String REPOINFO_REPONAME_KEY
           
static String REPOINFO_TABLE_NAME
           
static String ROOT_TYPE
           
static String UID_MAJOR_VERSION_KEY
           
static String UID_MINOR_VERSION_KEY
           
static String UID_SCHEMA_NAME
           
static String VERSION_CREATED_KEY
           
static String VERSION_CREATED_PROP
           
static String VERSION_DESCRIPTION_KEY
           
static String VERSION_DESCRIPTION_PROP
           
static String VERSION_IS_LATEST_KEY
           
static String VERSION_IS_LATEST_MAJOR_KEY
           
static String VERSION_IS_LATEST_MAJOR_PROP
           
static String VERSION_IS_LATEST_PROP
           
static String VERSION_LABEL_KEY
           
static String VERSION_LABEL_PROP
           
static String VERSION_TABLE_NAME
           
static String VERSION_VERSIONABLE_KEY
           
static String VERSION_VERSIONABLE_PROP
           
 
Constructor Summary
Model(ModelSetup modelSetup)
           
 
Method Summary
 Serializable generateNewId()
          Computes a new unique id.
 Set<String> getAllSchemas(String primaryType, String[] mixinTypes)
           
 Map<String,List<String>> getBinaryPropertyInfos()
           
 PropertyType getCollectionFragmentType(String fragmentName)
           
 String getCollectionOrderBy(String fragmentName)
           
 Set<String> getDocumentSubTypes(String typeName)
           
 String getDocumentSuperType(String typeName)
           
 Set<String> getDocumentTypeFacets(String typeName)
           
 Set<String> getDocumentTypes()
           
 Map<String,ColumnType> getFragmentKeysType(String fragmentName)
           
 Set<String> getFragmentNames()
           
 PropertyType getFulltextFieldType(String fragmentName, String fragmentKey)
          Finds out if a field is to be indexed as fulltext.
 String getFulltextIndexSuffix(String indexName)
           
 ModelFulltext getFulltextInfo()
           
 Set<String> getMixinDocumentTypes(String mixin)
           
 Set<String> getMixinFragments(String mixin)
           
 ModelProperty getMixinPropertyInfo(String mixin, String propertyName)
           
 Map<String,ModelProperty> getMixinPropertyInfos(String mixin)
           
 ModelProperty getPathPropertyInfo(String xpath)
          returns ModelProperty.NONE if legal prefix
 ModelProperty getPathPropertyInfo(String primaryType, String[] mixinTypes, String path)
           
 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.
 ModelProperty getPropertyInfo(String propertyName)
           
 ModelProperty getPropertyInfo(String typeName, String propertyName)
           
 Set<String> getPropertyInfoNames()
           
 RepositoryDescriptor getRepositoryDescriptor()
          Gets the repository descriptor used for this model.
 Set<String> getSimpleTextPropertyPaths(String primaryType, String[] mixinTypes)
           
 Type getSpecialPropertyType(String propertyName)
           
 Set<String> getTypeFragments(RowMapper.IdWithTypes typeInfo)
          Gets the type fragments for a primary type and mixin types.
 Set<String> getTypeFragments(String typeName)
           
 Set<String> getTypePrefetchedFragments(String typeName)
           
 boolean isCollectionFragment(String fragmentName)
           
 boolean isDocumentType(String typeName)
           
 boolean isType(String typeName)
           
 Serializable unHackStringId(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 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_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

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_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

FIELD_TYPE_LARGETEXT

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

See Also:
Constant Field Values

COMMON_SIMPLE_FRAGMENTS

public static final List<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 String[] COMMON_COLLECTION_FRAGMENTS
Special (non-schema-based) collection fragments present in all types.


ALWAYS_PREFETCHED_FRAGMENTS

public static final 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 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 Serializable unHackStringId(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(String typeName,
                                     String propertyName)

getMixinPropertyInfos

public Map<String,ModelProperty> getMixinPropertyInfos(String mixin)

getMixinPropertyInfo

public ModelProperty getMixinPropertyInfo(String mixin,
                                          String propertyName)

getPropertyInfo

public ModelProperty getPropertyInfo(String propertyName)

getPathPropertyInfo

public ModelProperty getPathPropertyInfo(String xpath)
returns ModelProperty.NONE if legal prefix


getPropertyInfoNames

public Set<String> getPropertyInfoNames()

getPathPropertyInfo

public ModelProperty getPathPropertyInfo(String primaryType,
                                         String[] mixinTypes,
                                         String path)

getSimpleTextPropertyPaths

public Set<String> getSimpleTextPropertyPaths(String primaryType,
                                              String[] mixinTypes)

getAllSchemas

public Set<String> getAllSchemas(String primaryType,
                                 String[] mixinTypes)

getFulltextInfo

public ModelFulltext getFulltextInfo()

getFulltextFieldType

public PropertyType getFulltextFieldType(String fragmentName,
                                         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(String propertyName)

getCollectionFragmentType

public PropertyType getCollectionFragmentType(String fragmentName)

isCollectionFragment

public boolean isCollectionFragment(String fragmentName)

getCollectionOrderBy

public String getCollectionOrderBy(String fragmentName)

getFragmentNames

public Set<String> getFragmentNames()

getFragmentKeysType

public Map<String,ColumnType> getFragmentKeysType(String fragmentName)

getBinaryPropertyInfos

public Map<String,List<String>> getBinaryPropertyInfos()

getTypeFragments

public Set<String> getTypeFragments(String typeName)

getMixinFragments

public Set<String> getMixinFragments(String mixin)

getTypePrefetchedFragments

public Set<String> getTypePrefetchedFragments(String typeName)

isType

public boolean isType(String typeName)

isDocumentType

public boolean isDocumentType(String typeName)

getDocumentSuperType

public String getDocumentSuperType(String typeName)

getDocumentSubTypes

public Set<String> getDocumentSubTypes(String typeName)

getDocumentTypes

public Set<String> getDocumentTypes()

getDocumentTypeFacets

public Set<String> getDocumentTypeFacets(String typeName)

getMixinDocumentTypes

public Set<String> getMixinDocumentTypes(String mixin)

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.


getFulltextIndexSuffix

public String getFulltextIndexSuffix(String indexName)

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.