org.objectweb.jorm.mapper.rdb.metainfo
Class RdbTable

java.lang.Object
  extended byorg.objectweb.jorm.metainfo.lib.BasicMetaObject
      extended byorg.objectweb.jorm.metainfo.lib.BasicMappingStructure
          extended byorg.objectweb.jorm.mapper.rdb.metainfo.RdbTable
All Implemented Interfaces:
Loggable, MappingStructure, MetaObject, java.io.Serializable
Direct Known Subclasses:
RdbExternalTable

public class RdbTable
extends BasicMappingStructure

Define the mapping of primitive elements onto the columns of a table. Note that the mapping definition of the fields of a class onto the columns of a table may be sparsed between several objects of this class. This can espacially happen with inheritance with the 'extended' or 'added' rules.

Author:
S.Chassande-Barrioz
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMappingStructure
linkedMO
 
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
debug, logger, loggerFactory, parent
 
Constructor Summary
RdbTable(MetaObject parent, MetaObject linkedMO, java.lang.String name)
           
 
Method Summary
 RdbPrimitiveElementMapping createPrimitiveElementMapping(PrimitiveElement pe, java.lang.String columnName)
          Creates and registers a primitive element mapping, that is how a primitive element is mapped onto a column of the table.
 RdbPrimitiveElementMapping createPrimitiveElementMapping(PrimitiveElement pe, java.lang.String columnName, java.lang.String sqlType, boolean notNull)
          Creates and registers a primitive element mapping, that is how a primitive element is mapped onto a column of the table.
 java.util.Set getColumns()
          Gets the set of column names of the table definition
 java.lang.String getName()
           
 PrimitiveElementMapping getPrimitiveElementMappingByCol(java.lang.String columnName)
          Gets the primitive element mapping by its column name
 PrimitiveElementMapping getPrimitiveElementMappingByField(java.lang.String fieldName)
          Gets the primitive element mapping by its field name
 java.util.Collection getPrimitiveElementMappings()
           
 boolean isColocated()
          Gets the collocated attribute
 boolean isColocatedMaster()
           
 boolean isReadOnly()
           
 PrimitiveElementMapping removePrimitiveElementMapping(PrimitiveElementMapping pem)
          Removes a primitive element mapping from the table mapping definition
 void setColocated(boolean c)
          Sets the collocated attribute
 void setColocatedMaster(boolean cm)
           
 void setName(java.lang.String name)
           
 void setReadOnly(boolean readOnly)
           
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMappingStructure
getLinkedMO, getMapperName, getProjectName, setLinkedMO
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
getChildren, getLogger, getLoggerFactory, getManager, getParent, setLogger, setLoggerFactory, setLoggingOnChild, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.MetaObject
getParent, setParent
 

Constructor Detail

RdbTable

public RdbTable(MetaObject parent,
                MetaObject linkedMO,
                java.lang.String name)
Method Detail

isReadOnly

public boolean isReadOnly()

setReadOnly

public void setReadOnly(boolean readOnly)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getPrimitiveElementMappings

public java.util.Collection getPrimitiveElementMappings()

createPrimitiveElementMapping

public RdbPrimitiveElementMapping createPrimitiveElementMapping(PrimitiveElement pe,
                                                                java.lang.String columnName,
                                                                java.lang.String sqlType,
                                                                boolean notNull)
                                                         throws PException
Creates and registers a primitive element mapping, that is how a primitive element is mapped onto a column of the table. It implictly defines a new column name in the table, the type and the 'not-null' property being passed as parameters.

Parameters:
pe - the primitive element
columnName - the name of the column onto the primitive element is mapped
sqlType - the SQL type of the column
notNull - if true the column cannot have null values
Returns:
a new primitive element registered with this table mapping
Throws:
PException - if a primitive element is already mapped to the column

createPrimitiveElementMapping

public RdbPrimitiveElementMapping createPrimitiveElementMapping(PrimitiveElement pe,
                                                                java.lang.String columnName)
                                                         throws PException
Creates and registers a primitive element mapping, that is how a primitive element is mapped onto a column of the table. It implictly defines a new column name in the table, the type being undefined and the 'not-null' property being set to false.

Parameters:
pe - the primitive element
columnName - the name of the column onto the primitive element is mapped
Returns:
a new primitive element registered with this table mapping
Throws:
PException - if a primitive element is already mapped to the column

removePrimitiveElementMapping

public PrimitiveElementMapping removePrimitiveElementMapping(PrimitiveElementMapping pem)
Removes a primitive element mapping from the table mapping definition

Parameters:
pem - the primitive element mapping to remove
Returns:
null if the pem was not part of the table mapping definition, the pem itself otherwise

getPrimitiveElementMappingByCol

public PrimitiveElementMapping getPrimitiveElementMappingByCol(java.lang.String columnName)
Gets the primitive element mapping by its column name

Parameters:
columnName - the name of the column
Returns:
the primitive element mapping definition on this column

getPrimitiveElementMappingByField

public PrimitiveElementMapping getPrimitiveElementMappingByField(java.lang.String fieldName)
Gets the primitive element mapping by its field name

Parameters:
fieldName - the name of the field
Returns:
the primitive element mapping definition of this field

getColumns

public java.util.Set getColumns()
Gets the set of column names of the table definition

Returns:
the set of column names of the table definition (String)

isColocated

public boolean isColocated()
Gets the collocated attribute

Returns:
the collocated attribute

setColocated

public void setColocated(boolean c)
Sets the collocated attribute

Parameters:
c - true if the table is collocated

isColocatedMaster

public boolean isColocatedMaster()

setColocatedMaster

public void setColocatedMaster(boolean cm)