com.caucho.amber.field
Class ManyToManyField

java.lang.Object
  extended by com.caucho.amber.field.AbstractField
      extended by com.caucho.amber.field.CascadableField
          extended by com.caucho.amber.field.CollectionField
              extended by com.caucho.amber.field.AssociationField
                  extended by com.caucho.amber.field.ManyToManyField
All Implemented Interfaces:
AmberField

public class ManyToManyField
extends AssociationField

Configuration for a bean's field


Constructor Summary
ManyToManyField(EntityType relatedType)
           
ManyToManyField(EntityType relatedType, java.lang.String name)
           
ManyToManyField(EntityType relatedType, java.lang.String name, CascadeType[] cascadeTypes)
           
ManyToManyField(EntityType relatedType, java.lang.String name, ManyToManyField source, CascadeType[] cascadeTypes)
           
 
Method Summary
 AmberExpr createExpr(QueryParser parser, PathExpr parent)
          Creates the expression for the field.
 void generateAmberAdd(JavaWriter out)
          Generates the set property.
 void generateAmberRemove(JavaWriter out)
          Generates the remove property.
 void generateAmberRemoveTargetAll(JavaWriter out)
          Generates the remove property.
 void generateCopyLoadObject(JavaWriter out, java.lang.String dst, java.lang.String src, int loadIndex)
          Updates from the cached copy.
 void generateExpire(JavaWriter out)
          Generates code for the object expire
 void generateGetterMethod(JavaWriter out)
          Generates the set property.
 void generateInvalidateForeign(JavaWriter out)
          Generates code for foreign entity create/delete
 java.lang.String generateLoadSelect(java.lang.String id)
          Generates the select clause.
 void generateMergeFrom(JavaWriter out, java.lang.String dst, java.lang.String src)
          Updates the cached copy.
 void generatePostCascade(JavaWriter out, java.lang.String aConn, CascadeType cascadeType)
          Generates the (post) cascade operation from parent to this child.
 int generatePostLoadSelect(JavaWriter out, int index)
          Generates loading code after the basic fields.
 void generateSetterMethod(JavaWriter out)
          Generates the set property.
 void generateStatementSet(JavaWriter out, java.lang.String pstmt, java.lang.String obj, java.lang.String index)
          Generates the set clause.
 java.lang.String generateTargetLoadSelect(java.lang.String id)
          Generates the select clause.
 java.lang.String generateTargetSelect(java.lang.String id)
          Generates the target select.
 AmberTable getAssociationTable()
          Returns the association table
 java.lang.String getMapKey()
          Gets the map key.
 EntityType getRelatedType()
          Returns the source type as entity or mapped-superclass.
 LinkColumns getSourceLink()
          Returns the source link.
 LinkColumns getTargetLink()
          Returns the target link.
 EntityType getTargetType()
          Returns the target type.
 void init()
          Initializes the field.
 void setAssociationTable(AmberTable table)
          Sets the association table
 void setMapKey(java.lang.String mapKey)
          Sets the map key.
 void setOrderBy(java.util.ArrayList<java.lang.String> orderByFields, java.util.ArrayList<java.lang.Boolean> orderByAscending)
          Sets the order by.
 void setSourceLink(LinkColumns link)
          Adds a column from the association table to the source side.
 void setTargetLink(LinkColumns link)
          Adds a column from the association table to the target side.
 void setType(AmberType targetType)
          Sets the target type.
 
Methods inherited from class com.caucho.amber.field.AssociationField
getLinkColumns, hasInverseJoinColumns, hasJoinColumns, setInverseJoinColumns, setJoinColumns, setLinkColumns
 
Methods inherited from class com.caucho.amber.field.CollectionField
generateCopyUpdateObject, generateJoin, generatePreCascade, generateUpdate, getSourceColumn, getTableName, setTable
 
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, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateEquals, generateGet, generateGet, generateInsert, generateInsertColumns, generateInsertSet, generateJavaSelect, generateLoad, generateLoadFromObject, generateLoadNative, generateLoadSelect, generateNativeColumnNames, generateNull, generatePostConstructor, generatePostDelete, generatePreDelete, generatePrePersist, generatePrologue, generateSelect, generateSet, generateSet, 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, 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

ManyToManyField

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

ManyToManyField

public ManyToManyField(EntityType relatedType,
                       java.lang.String name)
                throws ConfigException
Throws:
ConfigException

ManyToManyField

public ManyToManyField(EntityType relatedType)

ManyToManyField

public ManyToManyField(EntityType relatedType,
                       java.lang.String name,
                       ManyToManyField source,
                       CascadeType[] cascadeTypes)
                throws ConfigException
Throws:
ConfigException
Method Detail

getMapKey

public java.lang.String getMapKey()
Gets the map key.


setMapKey

public void setMapKey(java.lang.String mapKey)
Sets the map key.


setType

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

Overrides:
setType in class CollectionField

getRelatedType

public EntityType getRelatedType()
Returns the source type as entity or mapped-superclass.


getTargetType

public EntityType getTargetType()
Returns the target type.

Overrides:
getTargetType in class CollectionField

getAssociationTable

public AmberTable getAssociationTable()
Returns the association table


setAssociationTable

public void setAssociationTable(AmberTable table)
Sets the association table


setSourceLink

public void setSourceLink(LinkColumns link)
Adds a column from the association table to the source side.


getSourceLink

public LinkColumns getSourceLink()
Returns the source link.


setTargetLink

public void setTargetLink(LinkColumns link)
Adds a column from the association table to the target side.


getTargetLink

public LinkColumns getTargetLink()
Returns the target link.


setOrderBy

public void setOrderBy(java.util.ArrayList<java.lang.String> orderByFields,
                       java.util.ArrayList<java.lang.Boolean> orderByAscending)
Sets the order by.


init

public void init()
          throws ConfigException
Initializes the field.

Specified by:
init in interface AmberField
Overrides:
init in class AbstractField
Throws:
ConfigException

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 CollectionField
Throws:
java.io.IOException

generateLoadSelect

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

Overrides:
generateLoadSelect in class CollectionField

generatePostLoadSelect

public int generatePostLoadSelect(JavaWriter out,
                                  int index)
                           throws java.io.IOException
Generates loading code after the basic fields.

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

createExpr

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

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

generateCopyLoadObject

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

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

generateMergeFrom

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

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

generateTargetSelect

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

Overrides:
generateTargetSelect in class AssociationField

generateTargetLoadSelect

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


generateGetterMethod

public void generateGetterMethod(JavaWriter out)
                          throws java.io.IOException
Generates the set property.

Specified by:
generateGetterMethod in interface AmberField
Overrides:
generateGetterMethod in class AbstractField
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 CollectionField
Throws:
java.io.IOException

generateAmberAdd

public void generateAmberAdd(JavaWriter out)
                      throws java.io.IOException
Generates the set property.

Throws:
java.io.IOException

generateAmberRemove

public void generateAmberRemove(JavaWriter out)
                         throws java.io.IOException
Generates the remove property.

Throws:
java.io.IOException

generateAmberRemoveTargetAll

public void generateAmberRemoveTargetAll(JavaWriter out)
                                  throws java.io.IOException
Generates the remove property.

Throws:
java.io.IOException

generateSetterMethod

public void generateSetterMethod(JavaWriter out)
                          throws java.io.IOException
Generates the set property.

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

generateInvalidateForeign

public void generateInvalidateForeign(JavaWriter out)
                               throws java.io.IOException
Generates code for foreign entity create/delete

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

generateExpire

public void generateExpire(JavaWriter out)
                    throws java.io.IOException
Generates code for the object expire

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