public class ClassTable extends AbstractClassTable implements DatastoreClass
Modifier and Type | Field and Description |
---|---|
protected String |
managingClassCurrent
Name of class currently being processed in manageClass (if any).
|
protected boolean |
runCallbacksAfterManageClass
Flag to run the callbacks after the current class is managed fully.
|
datastoreIDMapping, discriminatorMapping, discriminatorMetaData, highestMemberNumber, idMapping, memberMappingsMap, pkMappings, tenantMapping, versionMapping, versionMetaData
columns, columnsByName, dba, existsInDatastore, identifier, state, storeMgr, TABLE_STATE_INITIALIZED, TABLE_STATE_INITIALIZED_MODIFIED, TABLE_STATE_NEW, TABLE_STATE_PK_INITIALIZED, TABLE_STATE_VALIDATED
Constructor and Description |
---|
ClassTable(DatastoreIdentifier tableName,
RDBMSStoreManager storeMgr,
org.datanucleus.metadata.ClassMetaData cmd)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DatastoreClass |
getBaseDatastoreClass()
Accessor for the base datastore class.
|
DatastoreClass |
getBaseDatastoreClassWithMember(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Convenience accessor for the base table for this table which has the specified field.
|
org.datanucleus.metadata.ClassMetaData |
getClassMetaData()
Accessor for the (primary) class MetaData.
|
JavaTypeMapping |
getDiscriminatorMapping(boolean allowSuperclasses)
Accessor for the discriminator mapping specified .
|
org.datanucleus.metadata.DiscriminatorMetaData |
getDiscriminatorMetaData()
Accessor for Discriminator MetaData
|
protected List |
getExpectedCandidateKeys()
Accessor for the expected candidate keys for this table.
|
List |
getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
Accessor for the expected foreign keys for this table.
|
protected Set |
getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
Accessor for the indices for this table.
|
JavaTypeMapping |
getExternalMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd,
int mappingType)
Accessor for an external mapping for the specified field of the required type.
|
org.datanucleus.metadata.IdentityType |
getIdentityType()
Accessor for the identity-type.
|
JavaTypeMapping |
getIdMapping()
Accessor for a mapping for the ID (persistable) for this table.
|
String[] |
getManagedClasses()
Accessor for the names of all classes managed by this table.
|
JavaTypeMapping |
getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Accessor for the field mapping for the specified field.
|
JavaTypeMapping |
getMemberMapping(String memberName)
Accessor for the field mapping for the named field.
|
JavaTypeMapping |
getMemberMappingInDatastoreClass(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Accessor for the mapping for the specified field only in this datastore class.
|
org.datanucleus.metadata.AbstractMemberMetaData |
getMetaDataForExternalMapping(JavaTypeMapping mapping,
int mappingType)
Accessor for the MetaData for the (owner) field that an external mapping corresponds to.
|
PrimaryKey |
getPrimaryKey()
Accessor for the primary key for this table.
|
Collection |
getSecondaryDatastoreClasses()
Accessor for any secondary tables for this table.
|
protected List |
getSQLCreateStatements(Properties props)
Accessor for the CREATE statements for this table.
|
protected List |
getSQLDropStatements()
Accessor for the DROP statements for this table.
|
DatastoreClass |
getSuperDatastoreClass()
Accessor for the supertable for this table.
|
ClassTable |
getTableManagingMapping(JavaTypeMapping mapping) |
ClassTable |
getTableWithDiscriminator()
Convenience method to return the root table with a discriminator in this inheritance tree.
|
String |
getType()
Accessor for the main class represented.
|
JavaTypeMapping |
getVersionMapping(boolean allowSuperclasses)
Accessor for the version mapping specified .
|
org.datanucleus.metadata.VersionMetaData |
getVersionMetaData()
Accessor for versionMetaData
|
boolean |
hasExternalFkMappings() |
void |
initialize(org.datanucleus.ClassLoaderResolver clr)
Method to initialise the table.
|
protected void |
initializePK(org.datanucleus.ClassLoaderResolver clr)
Method to initialise the table primary key field(s).
|
boolean |
isBaseDatastoreClass()
Whether this table is the base table in the inheritance hierarchy.
|
boolean |
isObjectIdDatastoreAttributed()
Whether this table or super table has id (primary key) attributed by the datastore
|
boolean |
isSuperDatastoreClass(DatastoreClass table)
Accessor whether the supplied DatastoreClass is a supertable of this table.
|
void |
manageClass(org.datanucleus.metadata.AbstractClassMetaData theCmd,
org.datanucleus.ClassLoaderResolver clr)
Method that adds the specified class to be managed by this table.
|
boolean |
managesClass(String className)
Accessor for whether this table manages the specified class
|
void |
postInitialize(org.datanucleus.ClassLoaderResolver clr)
Post initilize.
|
void |
preInitialize(org.datanucleus.ClassLoaderResolver clr)
Pre-initialize.
|
void |
provideExternalMappings(MappingConsumer consumer,
int mappingType)
Provide the mappings to the consumer for all external fields mapped to this table
of the specified type
|
void |
provideMappingsForMembers(MappingConsumer consumer,
org.datanucleus.metadata.AbstractMemberMetaData[] fieldMetaData,
boolean includeSecondaryTables)
Provide the mappings to the consumer for all absolute field Numbers in this table
that are container in the fieldNumbers parameter.
|
void |
providePrimaryKeyMappings(MappingConsumer consumer)
Provide the mappings to the consumer for all primary-key fields mapped to
this table.
|
void |
provideUnmappedColumns(MappingConsumer consumer)
Method to provide all unmapped columns to the consumer.
|
boolean |
validateConstraints(Connection conn,
boolean autoCreate,
Collection autoCreateErrors,
org.datanucleus.ClassLoaderResolver clr)
Method to validate the constraints of this table.
|
addMemberMapping, addMultitenancyMapping, getDatastoreIdColumn, getDatastoreIdMapping, getDiscriminatorColumn, getMappingForMemberName, getMultitenancyColumn, getMultitenancyMapping, getPrimaryTable, getVersionColumn, managesMapping, managesMember, provideDatastoreIdMappings, provideDiscriminatorMappings, provideMultitenancyMapping, provideNonPrimaryKeyMappings, provideVersionMappings
createConstraints, dropConstraints, getSQLAddCandidateKeyStatements, getSQLAddFKStatements, getSQLCreateIndexStatements, initializeColumnInfoForPrimaryKeyColumns, initializeColumnInfoFromDatastore, logMapping, validate, validateColumns, validatePrimaryKey
addColumn, addColumnInternal, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getColumn, getColumnForName, getColumnForPosition, getColumns, getDatastoreIdentifierFullyQualified, getIdentifier, getMemberColumnMappingForEmbeddedMember, getMemberColumnMappingForMember, getMemberColumnMappings, getName, getNumberOfColumns, getSchemaName, getStoreManager, hasColumn, hasColumnName, hashCode, isInitialized, isInitializedModified, isPKInitialized, isValidated, tableExistsInDatastore, toString
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getDatastoreIdMapping, managesMapping, provideDatastoreIdMappings, provideDiscriminatorMappings, provideMultitenancyMapping, provideNonPrimaryKeyMappings, provideVersionMappings, toString
addColumn, create, drop, exists, getColumn, getIdentifier, getMultitenancyMapping, getStoreManager, hasColumn, isInitialized, isInitializedModified, isValidated, validate
getCatalogName, getColumnForName, getColumnForPosition, getColumns, getDatastoreIdColumn, getDiscriminatorColumn, getMemberColumnMappingForEmbeddedMember, getMemberColumnMappingForMember, getMemberColumnMappings, getMultitenancyColumn, getName, getNumberOfColumns, getSchemaName, getVersionColumn
protected transient String managingClassCurrent
protected boolean runCallbacksAfterManageClass
public ClassTable(DatastoreIdentifier tableName, RDBMSStoreManager storeMgr, org.datanucleus.metadata.ClassMetaData cmd)
tableName
- Table name SQL identifierstoreMgr
- Store Manager to manage this tablecmd
- MetaData for the class.public void preInitialize(org.datanucleus.ClassLoaderResolver clr)
preInitialize
in class TableImpl
clr
- the ClassLoaderResolverpublic void initialize(org.datanucleus.ClassLoaderResolver clr)
clr
- The ClassLoaderResolverpublic void postInitialize(org.datanucleus.ClassLoaderResolver clr)
postInitialize
in class TableImpl
clr
- the ClassLoaderResolverpublic void manageClass(org.datanucleus.metadata.AbstractClassMetaData theCmd, org.datanucleus.ClassLoaderResolver clr)
theCmd
- ClassMetaData for the class to be managedclr
- The ClassLoaderResolverpublic String[] getManagedClasses()
getManagedClasses
in interface DatastoreClass
public boolean managesClass(String className)
managesClass
in interface DatastoreClass
className
- Name of the classprotected void initializePK(org.datanucleus.ClassLoaderResolver clr)
initializePK
in class AbstractClassTable
clr
- The ClassLoaderResolverpublic String getType()
getType
in interface DatastoreClass
public org.datanucleus.metadata.IdentityType getIdentityType()
getIdentityType
in interface DatastoreClass
getIdentityType
in class AbstractClassTable
public final org.datanucleus.metadata.VersionMetaData getVersionMetaData()
getVersionMetaData
in class AbstractTable
public final org.datanucleus.metadata.DiscriminatorMetaData getDiscriminatorMetaData()
getDiscriminatorMetaData
in class AbstractTable
public final ClassTable getTableWithDiscriminator()
public boolean isObjectIdDatastoreAttributed()
isObjectIdDatastoreAttributed
in interface DatastoreClass
isObjectIdDatastoreAttributed
in class AbstractClassTable
public boolean isBaseDatastoreClass()
isBaseDatastoreClass
in interface DatastoreClass
public DatastoreClass getBaseDatastoreClass()
DatastoreClass
getBaseDatastoreClass
in interface DatastoreClass
public DatastoreClass getSuperDatastoreClass()
getSuperDatastoreClass
in interface DatastoreClass
public boolean isSuperDatastoreClass(DatastoreClass table)
isSuperDatastoreClass
in interface DatastoreClass
table
- The DatastoreClass to checkpublic Collection getSecondaryDatastoreClasses()
getSecondaryDatastoreClasses
in interface DatastoreClass
public JavaTypeMapping getVersionMapping(boolean allowSuperclasses)
getVersionMapping
in class AbstractClassTable
allowSuperclasses
- Whether we should return just the mapping from this table
or whether we should return it when this table has none and the supertable haspublic JavaTypeMapping getDiscriminatorMapping(boolean allowSuperclasses)
getDiscriminatorMapping
in class AbstractClassTable
allowSuperclasses
- Whether we should return just the mapping from this table
or whether we should return it when this table has none and the supertable haspublic ClassTable getTableManagingMapping(JavaTypeMapping mapping)
public DatastoreClass getBaseDatastoreClassWithMember(org.datanucleus.metadata.AbstractMemberMetaData mmd)
getBaseDatastoreClassWithMember
in interface DatastoreClass
mmd
- Field MetaData for this fieldpublic org.datanucleus.metadata.ClassMetaData getClassMetaData()
getClassMetaData
in interface org.datanucleus.store.schema.table.Table
getClassMetaData
in class AbstractTable
protected Set getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
getExpectedIndices
in class TableImpl
clr
- The ClassLoaderResolverpublic List getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
getExpectedForeignKeys
in class TableImpl
clr
- The ClassLoaderResolverprotected List getExpectedCandidateKeys()
getExpectedCandidateKeys
in class TableImpl
public PrimaryKey getPrimaryKey()
getPrimaryKey
in class TableImpl
protected List getSQLCreateStatements(Properties props)
getSQLCreateStatements
in class TableImpl
props
- Properties for creating the tableprotected List getSQLDropStatements()
getSQLDropStatements
in class TableImpl
public JavaTypeMapping getIdMapping()
public boolean hasExternalFkMappings()
public JavaTypeMapping getExternalMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd, int mappingType)
getExternalMapping
in interface DatastoreClass
mmd
- MetaData for the field/propertymappingType
- Type of mappingpublic org.datanucleus.metadata.AbstractMemberMetaData getMetaDataForExternalMapping(JavaTypeMapping mapping, int mappingType)
getMetaDataForExternalMapping
in interface DatastoreClass
mapping
- The mappingmappingType
- The mapping typepublic JavaTypeMapping getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
getMemberMapping
in interface DatastoreClass
mmd
- MetaData for this field/propertypublic JavaTypeMapping getMemberMappingInDatastoreClass(org.datanucleus.metadata.AbstractMemberMetaData mmd)
getMemberMappingInDatastoreClass
in interface DatastoreClass
mmd
- Metadata of the field/propertypublic JavaTypeMapping getMemberMapping(String memberName)
getMemberMapping
in interface DatastoreClass
memberName
- Name of field/propertyNoSuchPersistentFieldException
- Thrown when the field/property is not foundpublic void providePrimaryKeyMappings(MappingConsumer consumer)
providePrimaryKeyMappings
in interface DatastoreClass
providePrimaryKeyMappings
in class AbstractClassTable
consumer
- Consumer for the mappingspublic final void provideExternalMappings(MappingConsumer consumer, int mappingType)
provideExternalMappings
in interface DatastoreClass
consumer
- Consumer for the mappingsmappingType
- Type of external mappingpublic void provideMappingsForMembers(MappingConsumer consumer, org.datanucleus.metadata.AbstractMemberMetaData[] fieldMetaData, boolean includeSecondaryTables)
provideMappingsForMembers
in interface DatastoreClass
provideMappingsForMembers
in class AbstractClassTable
consumer
- Consumer for the mappingsfieldMetaData
- MetaData for the fields to provide mappings forincludeSecondaryTables
- Whether to provide fields in secondary tablespublic void provideUnmappedColumns(MappingConsumer consumer)
provideUnmappedColumns
in interface DatastoreClass
consumer
- Consumer of informationpublic boolean validateConstraints(Connection conn, boolean autoCreate, Collection autoCreateErrors, org.datanucleus.ClassLoaderResolver clr) throws SQLException
validateConstraints
in class TableImpl
conn
- Connection to use in validationautoCreate
- Whether to auto create the constraintsautoCreateErrors
- Whether to log a warning only on errors during "auto create"clr
- The ClassLoaderResolverSQLException
- Thrown when an error occurs in validationCopyright © 2015. All rights reserved.