org.objectweb.jorm.mapper.rdb.generator
Class RdbGenInfos

java.lang.Object
  extended byorg.objectweb.jorm.mapper.rdb.generator.RdbGenInfos

public class RdbGenInfos
extends java.lang.Object

This is the root class that contains all the required information for generating Java code specific to the RDB mapping. It allows the support of all elaborated mapping rules.

Author:
P. Dechamboux

Field Summary
static CommonHelper commonHelper
           
 RdbGenRef genId
          The structure of the identifier of the related JORM object.
 java.util.Map genRefs
          The set of references defined by the generated class.
 java.util.Map genTables
          The set of all tables used to store the generated class.
 java.util.List readableColumns
          The set of all columns used to store the generated class.
 RdbGenTable referenceTable
          The reference table used in this mapping.
 
Constructor Summary
RdbGenInfos()
           
 
Method Summary
 boolean colInGenId(RdbGenColumn rgc)
          Verifies if the given column is used in the identifier of this class, which is defined by genId.
 int getColumnPosition(RdbGenColumn irgc)
          Gets the position (within [1..n] of the given column into the overall list defined into this RdbGenInfos.
 int getColumnPosition(RdbGenColumn irgc, RdbGenJoin rgj)
           
 java.lang.String getDeleteStatement(RdbGenJoin rgj)
           
 java.lang.String getDeleteStatement(RdbGenTable rgt)
          Constructs the string representing the SQL query used to delete the part of a JORM object stored into the given table.
 java.lang.String getExistStatement()
          Constructs the string representing the SQL query used for testing the existence of a JORM object.
 java.lang.String getExtDeleteStatement(RdbGenJoin rgj)
          Constructs the string representing the SQL query used to delete the part of a JORM object stored into the given table.
 RdbGenRef getGenId()
           
 java.lang.String getGenRefFieldName(RdbGenRef gr)
          Searches the name of the field which defines the given reference.
 RdbGenRef getGenRefOfColumn(RdbGenColumn rgc)
          Searches the RdbGenRef object, from the genRefs list, which the given column belongs to.
 RdbGenRef getGenRefOfColumn(RdbGenColumn rgc, RdbGenJoin rgj)
           
 java.util.Map getGenRefs()
           
 java.util.Map getGenTables()
           
 java.lang.String getInsertStatement(RdbGenJoin rgj)
           
 java.lang.String getInsertStatement(RdbGenTable rgt)
          Constructs the string representing the SQL query used to insert the part of a JORM object stored into the given table.
 java.lang.String getPNameIteratorStatement()
          Constructs the string representing the SQL query used to get the extent of a JORM class (the ID PName of all objects of this class).
 java.lang.String getPnFieldName(RdbGenColumn rgc)
          Searches the name of the field in the composite name associated with the identifier, which is mapped to the given column.
 java.util.List getReadableColumns()
           
 java.lang.String getReadStatement(RdbAdapter adapter)
          Constructs the string representing the SQL query used to read a JORM object.
 RdbGenTable getReferenceTable()
           
 java.util.List getTableCompositeGenRefs(RdbGenTable rgt)
          Computes the list of references (i.e., their definition) stored into this particular table.
 java.util.List getTableCompositeGenRefs(RdbGenTable rgt, RdbGenJoin rgj)
           
 java.lang.String getUpdateNullStatement(RdbGenJoin rgj)
           
 java.lang.String getUpdateNullStatement(RdbGenTable rgt)
           
 java.lang.String getUpdateStatement(RdbGenJoin rgj)
           
 java.lang.String getUpdateStatement(RdbGenTable rgt)
          Constructs the string representing the SQL query used to update the part of a JORM object stored into the given table.
 java.lang.String setIdPnParam(java.lang.String cnfn, int idx, RdbAdapter adapter, boolean isSpecific)
           
 boolean updatable(RdbGenColumn rgc)
           
 boolean updatable(RdbGenColumn rgc, RdbGenJoin rgj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

genTables

public java.util.Map genTables
The set of all tables used to store the generated class. It also contains the reference table that is supposed to hold the object identifier (see referenceTable).


referenceTable

public RdbGenTable referenceTable
The reference table used in this mapping. It entirely stores the identifier of the related JORM object, as specified by variable genId.


readableColumns

public java.util.List readableColumns
The set of all columns used to store the generated class. It defines the order with which the columns will be used within all kinds of queries. This set is the union of all columns specified with each table involved in this mapping.


genId

public RdbGenRef genId
The structure of the identifier of the related JORM object.


genRefs

public java.util.Map genRefs
The set of references defined by the generated class. There is one RdbGenRef object registered for each reference field, in association with its field name into this map.


commonHelper

public static CommonHelper commonHelper
Constructor Detail

RdbGenInfos

public RdbGenInfos()
Method Detail

getGenTables

public java.util.Map getGenTables()

getReferenceTable

public RdbGenTable getReferenceTable()

getReadableColumns

public java.util.List getReadableColumns()

getGenId

public RdbGenRef getGenId()

getGenRefs

public java.util.Map getGenRefs()

getTableCompositeGenRefs

public java.util.List getTableCompositeGenRefs(RdbGenTable rgt)
Computes the list of references (i.e., their definition) stored into this particular table.

Parameters:
rgt - The table for which to find the reference definitions.
Returns:
The computed list of definitions.

getTableCompositeGenRefs

public java.util.List getTableCompositeGenRefs(RdbGenTable rgt,
                                               RdbGenJoin rgj)

getColumnPosition

public int getColumnPosition(RdbGenColumn irgc)
Gets the position (within [1..n] of the given column into the overall list defined into this RdbGenInfos.

Parameters:
irgc - The column for which to search the position.
Returns:
Its position into the genColumns list. -1 if not found (BUG: should never appear).

getColumnPosition

public int getColumnPosition(RdbGenColumn irgc,
                             RdbGenJoin rgj)

getExistStatement

public java.lang.String getExistStatement()
Constructs the string representing the SQL query used for testing the existence of a JORM object.

Returns:
The query string.

getReadStatement

public java.lang.String getReadStatement(RdbAdapter adapter)
Constructs the string representing the SQL query used to read a JORM object.

Returns:
The query string.

getPNameIteratorStatement

public java.lang.String getPNameIteratorStatement()
Constructs the string representing the SQL query used to get the extent of a JORM class (the ID PName of all objects of this class).

Returns:
The query string.

getUpdateStatement

public java.lang.String getUpdateStatement(RdbGenTable rgt)
                                    throws PException
Constructs the string representing the SQL query used to update the part of a JORM object stored into the given table.

Parameters:
rgt - The description of the table to be modified.
Returns:
The query string.
Throws:
PException

getUpdateStatement

public java.lang.String getUpdateStatement(RdbGenJoin rgj)
                                    throws PException
Throws:
PException

getUpdateNullStatement

public java.lang.String getUpdateNullStatement(RdbGenTable rgt)
                                        throws PException
Throws:
PException

getUpdateNullStatement

public java.lang.String getUpdateNullStatement(RdbGenJoin rgj)
                                        throws PException
Throws:
PException

getInsertStatement

public java.lang.String getInsertStatement(RdbGenTable rgt)
                                    throws PException
Constructs the string representing the SQL query used to insert the part of a JORM object stored into the given table.

Parameters:
rgt - The description of the table to be modified.
Returns:
The query string.
Throws:
PException

getInsertStatement

public java.lang.String getInsertStatement(RdbGenJoin rgj)

getDeleteStatement

public java.lang.String getDeleteStatement(RdbGenTable rgt)
                                    throws PException
Constructs the string representing the SQL query used to delete the part of a JORM object stored into the given table.

Parameters:
rgt - The description of the table to be modified.
Returns:
The query string.
Throws:
PException

getDeleteStatement

public java.lang.String getDeleteStatement(RdbGenJoin rgj)
                                    throws PException
Throws:
PException

getExtDeleteStatement

public java.lang.String getExtDeleteStatement(RdbGenJoin rgj)
                                       throws PException
Constructs the string representing the SQL query used to delete the part of a JORM object stored into the given table.

Parameters:
rgj - The description of the join between the external table and the main table
Returns:
The query string.
Throws:
PException

setIdPnParam

public java.lang.String setIdPnParam(java.lang.String cnfn,
                                     int idx,
                                     RdbAdapter adapter,
                                     boolean isSpecific)
                              throws PException
Throws:
PException

getGenRefOfColumn

public RdbGenRef getGenRefOfColumn(RdbGenColumn rgc)
Searches the RdbGenRef object, from the genRefs list, which the given column belongs to.

Parameters:
rgc - The column for which to find a RdbGenRef.
Returns:
The relevant RdbGenRef or null if none found.

getGenRefOfColumn

public RdbGenRef getGenRefOfColumn(RdbGenColumn rgc,
                                   RdbGenJoin rgj)

colInGenId

public boolean colInGenId(RdbGenColumn rgc)
Verifies if the given column is used in the identifier of this class, which is defined by genId.

Parameters:
rgc - The column for which to verify its belonging to the ID.
Returns:
true if it belongs to genId.

getGenRefFieldName

public java.lang.String getGenRefFieldName(RdbGenRef gr)
Searches the name of the field which defines the given reference.

Parameters:
gr - The reference definition.
Returns:
The relevant field name.

getPnFieldName

public java.lang.String getPnFieldName(RdbGenColumn rgc)
Searches the name of the field in the composite name associated with the identifier, which is mapped to the given column.

Parameters:
rgc - The column to search.
Returns:
The name of the mapped field.

updatable

public boolean updatable(RdbGenColumn rgc)

updatable

public boolean updatable(RdbGenColumn rgc,
                         RdbGenJoin rgj)