com.caucho.amber.field
Class CollectionField

java.lang.Object
  extended by com.caucho.amber.field.AbstractField
      extended by com.caucho.amber.field.CascadableField
          extended by com.caucho.amber.field.CollectionField
All Implemented Interfaces:
AmberField
Direct Known Subclasses:
AssociationField, CollectionElementField, OneToManyField

public class CollectionField
extends CascadableField

Configuration for a bean's field


Constructor Summary
CollectionField(EntityType relatedType)
           
CollectionField(EntityType relatedType, java.lang.String name, CascadeType[] cascadeTypes)
           
 
Method Summary
 AmberExpr createExpr(QueryParser parser, PathExpr parent)
          Creates the expression for the field.
 void generateCopyUpdateObject(JavaWriter out, java.lang.String dst, java.lang.String src, int updateIndex)
          Updates the cached copy.
 java.lang.String generateJoin(java.lang.String sourceTable, java.lang.String targetTable)
          Generates the linking for a join
 java.lang.String generateLoadSelect(java.lang.String id)
          Generates the select clause.
 void generatePostCascade(JavaWriter out, java.lang.String aConn, CascadeType cascadeType)
          Generates the (post) cascade operation from parent to this child.
 void generatePreCascade(JavaWriter out, java.lang.String aConn, CascadeType cascadeType)
          Generates the (pre) cascade operation from parent to this child.
 void generateStatementSet(JavaWriter out, java.lang.String pstmt, java.lang.String obj, java.lang.String index)
          Generates the set clause.
 java.lang.String generateTargetSelect(java.lang.String id)
          Generates the target select.
 void generateUpdate(JavaWriter out, java.lang.String mask, java.lang.String pstmt, java.lang.String index)
          Generates loading cache
 LinkColumns getLinkColumns()
          Gets the key columns.
 ForeignColumn getSourceColumn(AmberColumn key)
          Returns the source column for a given target key.
 java.lang.String getTableName()
          Gets the collection table.
 AmberType getTargetType()
          Returns the target type.
 void setLinkColumns(LinkColumns linkColumns)
          Sets the key columns.
 void setTable(java.lang.String table)
          Sets the collection table.
 void setType(AmberType targetType)
          Sets the target type.
 
Methods inherited from class com.caucho.amber.field.CascadableField
generateFlushCheck, generateInternalCascade, getCascadeType, isCascadable, isCascade, setCascadeType
 
Methods inherited from class com.caucho.amber.field.AbstractField
childDelete, generateCastFromObject, generateCopyLoadObject, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateEquals, generateExpire, generateGet, generateGet, generateGetterMethod, generateInsert, generateInsertColumns, generateInsertSet, generateInvalidateForeign, generateJavaSelect, generateLoad, generateLoadFromObject, generateLoadNative, generateLoadSelect, generateMergeFrom, generateNativeColumnNames, generateNull, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, generatePrologue, generateSelect, generateSet, generateSet, generateSetterMethod, generateStatementSet, generateSuperGetter, generateSuperGetterMethod, generateSuperSetter, generateSuperSetterMethod, generateUpdate, generateUpdateFromObject, generateUpdateSet, generateWhere, getBeanClass, getColumn, getCreateLoadMask, getEntitySourceType, getFieldName, getGetterMethod, getGetterName, getIndex, getJavaClass, getJavaType, getJavaTypeName, getLoadGroupIndex, getName, getPersistenceUnit, getSetterMethod, getSetterName, getSourceType, getTable, hasLoadGroup, init, isAbstract, isFieldAccess, isKey, isLazy, isOverride, isUpdateable, link, override, setColumn, setIndex, setJavaType, setLazy, setLoadGroupIndex, setName, setOverride, toObject, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionField

public CollectionField(EntityType relatedType,
                       java.lang.String name,
                       CascadeType[] cascadeTypes)
                throws ConfigException
Throws:
ConfigException

CollectionField

public CollectionField(EntityType relatedType)
Method Detail

setTable

public void setTable(java.lang.String table)
Sets the collection table.


getTableName

public java.lang.String getTableName()
Gets the collection table.


setType

public void setType(AmberType targetType)
Sets the target type.


getTargetType

public AmberType getTargetType()
Returns the target type.


setLinkColumns

public void setLinkColumns(LinkColumns linkColumns)
Sets the key columns.


getLinkColumns

public LinkColumns getLinkColumns()
Gets the key columns.


generatePreCascade

public void generatePreCascade(JavaWriter out,
                               java.lang.String aConn,
                               CascadeType cascadeType)
                        throws java.io.IOException
Generates the (pre) cascade operation from parent to this child. This field will only be cascaded first if the operation can be performed with no risk to break FK constraints.

Overrides:
generatePreCascade in class CascadableField
Throws:
java.io.IOException

generatePostCascade

public void generatePostCascade(JavaWriter out,
                                java.lang.String aConn,
                                CascadeType cascadeType)
                         throws java.io.IOException
Generates the (post) cascade operation from parent to this child. This field will only be cascaded first if the operation can be performed with no risk to break FK constraints.

Overrides:
generatePostCascade in class CascadableField
Throws:
java.io.IOException

generateStatementSet

public void generateStatementSet(JavaWriter out,
                                 java.lang.String pstmt,
                                 java.lang.String obj,
                                 java.lang.String index)
                          throws java.io.IOException
Generates the set clause.

Specified by:
generateStatementSet in interface AmberField
Overrides:
generateStatementSet in class AbstractField
Throws:
java.io.IOException

generateUpdate

public void generateUpdate(JavaWriter out,
                           java.lang.String mask,
                           java.lang.String pstmt,
                           java.lang.String index)
                    throws java.io.IOException
Generates loading cache

Specified by:
generateUpdate in interface AmberField
Overrides:
generateUpdate in class AbstractField
Throws:
java.io.IOException

generateCopyUpdateObject

public void generateCopyUpdateObject(JavaWriter out,
                                     java.lang.String dst,
                                     java.lang.String src,
                                     int updateIndex)
                              throws java.io.IOException
Updates the cached copy.

Specified by:
generateCopyUpdateObject in interface AmberField
Overrides:
generateCopyUpdateObject in class AbstractField
Throws:
java.io.IOException

generateLoadSelect

public java.lang.String generateLoadSelect(java.lang.String id)
Generates the select clause.


generateTargetSelect

public java.lang.String generateTargetSelect(java.lang.String id)
Generates the target select.


createExpr

public AmberExpr createExpr(QueryParser parser,
                            PathExpr parent)
Creates the expression for the field.

Specified by:
createExpr in interface AmberField
Overrides:
createExpr in class AbstractField

generateJoin

public java.lang.String generateJoin(java.lang.String sourceTable,
                                     java.lang.String targetTable)
Generates the linking for a join


getSourceColumn

public ForeignColumn getSourceColumn(AmberColumn key)
Returns the source column for a given target key.