Class SecondaryTable

  • All Implemented Interfaces:
    DatastoreClass, SecondaryDatastoreClass, Table, org.datanucleus.store.schema.table.Table

    public class SecondaryTable
    extends AbstractClassTable
    implements SecondaryDatastoreClass
    Representation of a secondary table for a class. Has a primary table that manages the main fields for that class and some fields are defined (using <field table="...">) to be stored in the secondary table. Many of the methods in this class defer to the equivalent method in the primary table.
    • Method Detail

      • preInitialize

        public void preInitialize​(org.datanucleus.ClassLoaderResolver clr)
        Pre initilize. For things that must be initialized right after constructor
        Specified by:
        preInitialize in interface Table
        Overrides:
        preInitialize in class TableImpl
        Parameters:
        clr - the ClassLoaderResolver
      • initialize

        public void initialize​(org.datanucleus.ClassLoaderResolver clr)
        Method to initialise the table. This will initialise the primary key columns for the table. Any other columns are added via the addFieldMapping() method.
        Specified by:
        initialize in interface Table
        Parameters:
        clr - The ClassLoaderResolver
      • postInitialize

        public void postInitialize​(org.datanucleus.ClassLoaderResolver clr)
        Post initilize. For things that must be set after all classes have been initialized before
        Specified by:
        postInitialize in interface Table
        Overrides:
        postInitialize in class TableImpl
        Parameters:
        clr - the ClassLoaderResolver
      • getPrimaryKey

        public PrimaryKey getPrimaryKey()
        Accessor for the primary key for this table. Overrides the method in TableImpl to add on any specification of PK name in the metadata.
        Overrides:
        getPrimaryKey in class TableImpl
        Returns:
        The primary key.
      • getJoinMetaData

        public org.datanucleus.metadata.JoinMetaData getJoinMetaData()
        Accessor for the JoinMetaData which is used to join to the primary DatastoreClass.
        Specified by:
        getJoinMetaData in interface SecondaryDatastoreClass
        Returns:
        JoinMetaData
      • getIdentityType

        public org.datanucleus.metadata.IdentityType getIdentityType()
        Accessor for the identity-type. Simply returns the same as the primary table
        Specified by:
        getIdentityType in interface DatastoreClass
        Specified by:
        getIdentityType in class AbstractClassTable
        Returns:
        identity-type tag value
      • getType

        public String getType()
        Accessor for the main type represented here.
        Specified by:
        getType in interface DatastoreClass
        Returns:
        Name of the principal class represented
      • isBaseDatastoreClass

        public boolean isBaseDatastoreClass()
        Whether this table is the base in the inheritance hierarchy.
        Specified by:
        isBaseDatastoreClass in interface DatastoreClass
        Returns:
        true if this table is a root table
      • getBaseDatastoreClass

        public DatastoreClass getBaseDatastoreClass()
        Description copied from interface: DatastoreClass
        Accessor for the base datastore class. Returns this object if it has no superclass table, otherwise goes up to the superclass etc.
        Specified by:
        getBaseDatastoreClass in interface DatastoreClass
        Returns:
        The base datastore class
      • getBaseDatastoreClassWithMember

        public DatastoreClass getBaseDatastoreClassWithMember​(org.datanucleus.metadata.AbstractMemberMetaData mmd)
        Convenience accessor for the base table for this table which has the specified member.
        Specified by:
        getBaseDatastoreClassWithMember in interface DatastoreClass
        Parameters:
        mmd - MetaData for this member
        Returns:
        The base table which has the member specified
      • isSuperDatastoreClass

        public boolean isSuperDatastoreClass​(DatastoreClass table)
        Accessor whether the supplied DatastoreClass is a supertable of this table.
        Specified by:
        isSuperDatastoreClass in interface DatastoreClass
        Parameters:
        table - The DatastoreClass to check
        Returns:
        Whether it is a supertable (somewhere up the inheritance tree)
      • managesClass

        public boolean managesClass​(String className)
        Accessor for whether this table manages the specified class.
        Specified by:
        managesClass in interface DatastoreClass
        Parameters:
        className - Name of the class
        Returns:
        Whether it is managed by this table
      • getManagedClasses

        public String[] getManagedClasses()
        Description copied from interface: DatastoreClass
        Accessor for the names of all classes managed by this table.
        Specified by:
        getManagedClasses in interface DatastoreClass
        Returns:
        Names of the classes managed (stored) here
      • getExpectedForeignKeys

        protected List<ForeignKey> getExpectedForeignKeys()
        Accessor for the expected foreign keys for this table.
        Returns:
        The expected foreign keys.
      • getMemberMapping

        public JavaTypeMapping getMemberMapping​(org.datanucleus.metadata.AbstractMemberMetaData mmd)
        Accessor for the member Mapping. Returns the mapping if it is present in this table.
        Specified by:
        getMemberMapping in interface DatastoreClass
        Specified by:
        getMemberMapping in interface Table
        Parameters:
        mmd - MetaData for this member
        Returns:
        the Mapping for the member
      • getMemberMappingInDatastoreClass

        public JavaTypeMapping getMemberMappingInDatastoreClass​(org.datanucleus.metadata.AbstractMemberMetaData mmd)
        Accessor for the mapping for the specified member only in this datastore class.
        Specified by:
        getMemberMappingInDatastoreClass in interface DatastoreClass
        Parameters:
        mmd - Metadata of the member
        Returns:
        The Mapping for the member (or null if not present here)
      • getMemberMapping

        public JavaTypeMapping getMemberMapping​(String memberName)
        Accessor for the mapping for the specified member. TODO Use of this is discouraged since the memberName is not fully qualified and if a superclass-table inheritance is used we could have 2 members of that name here.
        Specified by:
        getMemberMapping in interface DatastoreClass
        Parameters:
        memberName - Name of the member
        Returns:
        The mapping for the member
      • getIdMapping

        public JavaTypeMapping getIdMapping()
        Accessor for the ID mapping for this table.
        Specified by:
        getIdMapping in interface Table
        Returns:
        The ID mapping
      • provideExternalMappings

        public void provideExternalMappings​(MappingConsumer consumer,
                                            MappingType mappingType)
        Description copied from interface: DatastoreClass
        Instruction to provide all external mappings to the passed consumer.
        Specified by:
        provideExternalMappings in interface DatastoreClass
        Parameters:
        consumer - The consumer for the mappings
        mappingType - Type of external mapping to provide
      • provideUnmappedColumns

        public void provideUnmappedColumns​(MappingConsumer consumer)
        Method to provide all unmapped columns to the consumer.
        Specified by:
        provideUnmappedColumns in interface DatastoreClass
        Parameters:
        consumer - Consumer of information
      • getExternalMapping

        public JavaTypeMapping getExternalMapping​(org.datanucleus.metadata.AbstractMemberMetaData fmd,
                                                  MappingType mappingType)
        Description copied from interface: DatastoreClass
        Accessor for the external mapping for the specified member of the specified mapping type. An external mapping is a mapping for which there is no field in the actual class to represent it (part of a relation). The type can be FK, FK discriminator, order, etc
        Specified by:
        getExternalMapping in interface DatastoreClass
        Parameters:
        fmd - MetaData for the (external) field/property
        mappingType - The type of mapping
        Returns:
        The external mapping
      • getMetaDataForExternalMapping

        public org.datanucleus.metadata.AbstractMemberMetaData getMetaDataForExternalMapping​(JavaTypeMapping mapping,
                                                                                             MappingType mappingType)
        Description copied from interface: DatastoreClass
        Accessor for the owner field metadata for the specified external mapping of the specified type
        Specified by:
        getMetaDataForExternalMapping in interface DatastoreClass
        Parameters:
        mapping - The external mapping
        mappingType - The type of mapping
        Returns:
        Field MetaData in the owner class