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

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

public class RdbGenColumn
extends java.lang.Object

This class contains all required information related to a column to which some field of a JORM class is mapped.

Author:
P. Dechamboux

Field Summary
 boolean columnInPK
          Tells if this column belongs to the table primary key.
 java.lang.String columnName
          The name of the RDB column.
 boolean columnNotNull
          Tells if this column may store null values.
 int columnScale
           
 int columnSize
          The size of the RDB column in case of string, serialized, [byte|char]array...
 java.lang.String columnSqlType
          the sql type of the column.
 PType columnType
          The JORM type associated with this mapped field.
 java.lang.String constant
          Contains the constant as a String in the case is this field is a constant field, otherwise (not a constant field) null.
 java.lang.String fieldName
          The name of the field that is mapped to this column.
 boolean hiddenField
          Tells is this field is an hidden one.
 RdbGenColumn joinCol
          references a column in the main table in case of this column participates in the join with the main table.
 java.util.List joins
          contains the association between a RdbGenJoin and a primitive element.
 java.util.List pes
           
 RdbGenTable table
          The table descrption which this column belongs to.
 
Constructor Summary
RdbGenColumn()
           
 
Method Summary
 boolean columnInPK()
           
 boolean equals(RdbGenColumn rgc)
           
 java.lang.String getAccessorValue(RdbGenInfos genInfos, boolean isSpecific)
           
 java.lang.String getAccessorValue(RdbGenInfos genInfos, boolean isSpecific, RdbGenJoin rgj)
           
 java.lang.String getAdapterGet(PType type)
           
 java.lang.String getAdapterSet(PType type)
           
 java.lang.String getColumnInPK()
           
 java.lang.String getColumnName()
           
 java.lang.String getColumnName(java.lang.String tableSuffix)
           
 java.lang.String getColumnNotNull()
           
 java.lang.String getColumnSqlType()
           
 PType getColumnType()
           
 java.lang.String getConstant()
           
 java.lang.String getFieldName()
           
 java.lang.String getFieldName(RdbGenJoin rgj)
           
 RdbGenColumn getJoinCol()
           
 java.util.List getJoins()
           
 java.lang.String getNullValue()
           
 java.lang.String getRefValue(RdbGenInfos genInfos, boolean isSpecific)
           
 java.lang.String getRefValue(RdbGenInfos genInfos, boolean isSpecific, RdbGenJoin rgj)
           
 java.lang.String getSqlGet(java.lang.String adapter, java.lang.String resultset, java.lang.String pos, java.lang.String nullValue)
          Constructs the string that defines the way to access to the relevant result part into a particular ResultSet.
 java.lang.String getSqlSet(java.lang.String adapter, java.lang.String pstmt, java.lang.String value, int pos)
          Constructs the string that defines the way to assign to the relevant query parameter into a particular prepared statement through the adapter.
 java.lang.String getSqlType(java.lang.String adapter)
          Gets the SQL type associated with this column into the database for which we define the mapping.
 java.lang.String getSqlTypeCode(PType pt)
           
 RdbGenTable getTable()
           
 boolean isColumnInPK()
           
 boolean isColumnNotNull()
           
 boolean isHiddenField()
           
 boolean isInJoin(RdbGenJoin rgj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldName

public java.lang.String fieldName
The name of the field that is mapped to this column.


hiddenField

public boolean hiddenField
Tells is this field is an hidden one.


constant

public java.lang.String constant
Contains the constant as a String in the case is this field is a constant field, otherwise (not a constant field) null.


columnName

public java.lang.String columnName
The name of the RDB column.


columnSize

public int columnSize
The size of the RDB column in case of string, serialized, [byte|char]array...


columnScale

public int columnScale

columnType

public PType columnType
The JORM type associated with this mapped field.


columnNotNull

public boolean columnNotNull
Tells if this column may store null values.


columnInPK

public boolean columnInPK
Tells if this column belongs to the table primary key.


table

public RdbGenTable table
The table descrption which this column belongs to.


columnSqlType

public java.lang.String columnSqlType
the sql type of the column. A null value means to use the value of the choosen by the adapter.


joinCol

public RdbGenColumn joinCol
references a column in the main table in case of this column participates in the join with the main table. In other case this field is null.


joins

public java.util.List joins
contains the association between a RdbGenJoin and a primitive element. This field is null is the current column is a column of the main table, because no join is needed of course.


pes

public java.util.List pes
Constructor Detail

RdbGenColumn

public RdbGenColumn()
Method Detail

getJoinCol

public RdbGenColumn getJoinCol()

getColumnSqlType

public java.lang.String getColumnSqlType()

getFieldName

public java.lang.String getFieldName()

getFieldName

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

getConstant

public java.lang.String getConstant()

getJoins

public java.util.List getJoins()

isHiddenField

public boolean isHiddenField()

getColumnName

public java.lang.String getColumnName()

getColumnType

public PType getColumnType()

isColumnNotNull

public boolean isColumnNotNull()

isColumnInPK

public boolean isColumnInPK()

getTable

public RdbGenTable getTable()

getColumnNotNull

public java.lang.String getColumnNotNull()

getColumnInPK

public java.lang.String getColumnInPK()

columnInPK

public boolean columnInPK()

getSqlType

public java.lang.String getSqlType(java.lang.String adapter)
                            throws PException
Gets the SQL type associated with this column into the database for which we define the mapping.

Returns:
The string containing the name of the relevant SQL type.
Throws:
PException

getSqlGet

public java.lang.String getSqlGet(java.lang.String adapter,
                                  java.lang.String resultset,
                                  java.lang.String pos,
                                  java.lang.String nullValue)
                           throws PException
Constructs the string that defines the way to access to the relevant result part into a particular ResultSet.

Parameters:
adapter - The name of the RdbAdaptervariable used to set the given query parameter.
resultset - The name of the ResultSet variable used to get the query result.
pos - The position of the result to get.
Returns:
The string defining the access to the relevant result part into a particular ResultSet.
Throws:
PException - example: "adapter.getBoolean(pstmt, 4); example: "adapter.getDate(pstmt, 4, "TIME");

getNullValue

public java.lang.String getNullValue()

getSqlSet

public java.lang.String getSqlSet(java.lang.String adapter,
                                  java.lang.String pstmt,
                                  java.lang.String value,
                                  int pos)
                           throws PException
Constructs the string that defines the way to assign to the relevant query parameter into a particular prepared statement through the adapter.

Parameters:
adapter - The name of the RdbAdaptervariable used to set the given query parameter.
pstmt - The name of the PreparedStatement variable used to set the given query parameter.
pos - The position of the query parameter to be assigned.
value - is the String value which must be assigned into the prepared statment.
Returns:
The string defining the assignement of the relevant query parameter into a particular PreparedStatement throught the rdb adapter.
Throws:
PException - example: "adapter.setBoolean(pstmt, 4, true); example: "adapter.setDate(pstmt, 4, ((java.util.Date) fieldVal), "TIME");

getAdapterGet

public java.lang.String getAdapterGet(PType type)

getAdapterSet

public java.lang.String getAdapterSet(PType type)

getSqlTypeCode

public java.lang.String getSqlTypeCode(PType pt)
                                throws PException
Throws:
PException

getAccessorValue

public java.lang.String getAccessorValue(RdbGenInfos genInfos,
                                         boolean isSpecific)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getAccessorValue

public java.lang.String getAccessorValue(RdbGenInfos genInfos,
                                         boolean isSpecific,
                                         RdbGenJoin rgj)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getRefValue

public java.lang.String getRefValue(RdbGenInfos genInfos,
                                    boolean isSpecific)
                             throws java.lang.Exception
Throws:
java.lang.Exception

getRefValue

public java.lang.String getRefValue(RdbGenInfos genInfos,
                                    boolean isSpecific,
                                    RdbGenJoin rgj)
                             throws java.lang.Exception
Throws:
java.lang.Exception

getColumnName

public java.lang.String getColumnName(java.lang.String tableSuffix)

isInJoin

public boolean isInJoin(RdbGenJoin rgj)

equals

public boolean equals(RdbGenColumn rgc)