org.objectweb.speedo.generation.jorm
Class OneTableRdbJormIMappingBuilder

org.objectweb.speedo.generation.jorm.OneTableRdbJormIMappingBuilder
All Implemented Interfaces:
JormMIMappingBuilder, SpeedoProperties

public class OneTableRdbJormIMappingBuilder
implements JormMIMappingBuilder, SpeedoProperties

This class is an implementation of the JormMIMappingBuilder for the mapper rdb and its sub mappers. It defines a simple mapping where each persistent objects (generic class included) are mapped over one table.

Author:
S.Chassande-Barrioz

Fields inherited from interface org.objectweb.speedo.api.SpeedoProperties
CACHE_SIZE, COMPILED_QUERY_POOL_MAX, COMPILED_QUERY_POOL_MIN, FIELD_CONVERTER, JOIN_TABLE, MANAGED, NO_LIMIT, PM_POOL_MAX, PM_POOL_MIN, QUERY_POOL_MAX, QUERY_POOL_MIN, REVERSE_FIELD, SOURCE_FK, SQL_NAME, TARGET_FK, VENDOR_NAME
 
Constructor Summary
OneTableRdbJormIMappingBuilder()
           
 
Method Summary
 org.objectweb.jorm.metainfo.api.ClassMapping createClassMapping(org.objectweb.jorm.metainfo.api.Class clazz, SpeedoClass sc, org.objectweb.jorm.metainfo.api.Mapping mapping)
          It builds a RdbClassMultiMapping and creates the main table.
 org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe, SpeedoField sf, org.objectweb.jorm.metainfo.api.HelperClassMapping cm)
          The column name is built with the field name.
 org.objectweb.jorm.metainfo.api.GenClassMapping createGenClassMapping(org.objectweb.jorm.metainfo.api.GenClassRef gcr, SpeedoField sf, org.objectweb.jorm.metainfo.api.Mapping mapping)
          It builds a RdbClassMultiMapping and creates the table.
 void createNameDefMapping(org.objectweb.jorm.metainfo.api.HelperClassMapping cm, org.objectweb.jorm.metainfo.api.NameDef nd, SpeedoClass sc, boolean isIdentifier, boolean isInGenClass)
          It creates the mapping of a name def (reference or identifier).
 org.objectweb.util.monolog.api.Logger getLogger()
           
 org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
           
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
           
 void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
           
 

Constructor Detail

OneTableRdbJormIMappingBuilder

public OneTableRdbJormIMappingBuilder()
Method Detail

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()

getLoggerFactory

public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)

setLoggerFactory

public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)

createClassMapping

public org.objectweb.jorm.metainfo.api.ClassMapping createClassMapping(org.objectweb.jorm.metainfo.api.Class clazz,
                                                                       SpeedoClass sc,
                                                                       org.objectweb.jorm.metainfo.api.Mapping mapping)
                                                                throws org.objectweb.jorm.api.PException
It builds a RdbClassMultiMapping and creates the main table. The name of the table is built with the short class name.
Specified by:
createClassMapping in interface JormMIMappingBuilder
Parameters:
clazz - is the Jorm meta object representing the class which the ClassMapping must be built.
mapping - is the Mapping instance which will host the ClassMapping.
Returns:
the ClassMapping instance built by the method (never null).
Throws:
PException - if it is not possible to build the ClassMapping

createGenClassMapping

public org.objectweb.jorm.metainfo.api.GenClassMapping createGenClassMapping(org.objectweb.jorm.metainfo.api.GenClassRef gcr,
                                                                             SpeedoField sf,
                                                                             org.objectweb.jorm.metainfo.api.Mapping mapping)
                                                                      throws org.objectweb.jorm.api.PException
It builds a RdbClassMultiMapping and creates the table. the table is build with the generic class identifier ("A/f1" ==> "A_f1")
Specified by:
createGenClassMapping in interface JormMIMappingBuilder
Parameters:
gcr - is the Jorm meta object representing the gen class which the GenClassMapping must be built.
mapping - is the Mapping instance which will host the GenClassMapping.
Returns:
the GenClassMapping instance built by the method (never null).
Throws:
PException - if it is not possible to build the GenClassMapping

createFieldMapping

public org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
                                                                                  SpeedoField sf,
                                                                                  org.objectweb.jorm.metainfo.api.HelperClassMapping cm)
                                                                           throws org.objectweb.jorm.api.PException
The column name is built with the field name.
Specified by:
createFieldMapping in interface JormMIMappingBuilder
Parameters:
pe - is the Jorm meta object representing a primitive field
cm - is the MappingStructure which will host the mapping of the field
Returns:
a PrimitiveElementMapping corresponding to the given primitive field.
Throws:
PException - if it is not possible to build the mapping of the primitive field.

createNameDefMapping

public void createNameDefMapping(org.objectweb.jorm.metainfo.api.HelperClassMapping cm,
                                 org.objectweb.jorm.metainfo.api.NameDef nd,
                                 SpeedoClass sc,
                                 boolean isIdentifier,
                                 boolean isInGenClass)
                          throws org.objectweb.jorm.api.PException,
                                 SpeedoException
It creates the mapping of a name def (reference or identifier).
Specified by:
createNameDefMapping in interface JormMIMappingBuilder
Parameters:
cm - is the MappingStructure which will host the mapping of the fields of the name def
nd - is the NameDef which must be mapped.
Throws:
PException - if it is not possible to build the mapping of the field.