S
- row class of table that is source of cascadeT
- row class of table that is target of cascadepublic class SelectCascadeOperation<S,T> extends CascadeOperation<S,T>
Constructor and Description |
---|
SelectCascadeOperation(ScalarSelectOperation<S> sourceOperation,
RowField<S,?> targetField,
Table<T> targetTable,
SelectCascade selectCascadeAnnotation)
Constructor used by
ScalarSelectOperation . |
Modifier and Type | Method and Description |
---|---|
void |
cascade(S sourceRow)
Performs cascade operation.
|
void |
close()
Cleans up by closing any JDBC resources.
|
protected void |
deriveSqlOperationAttributes()
Sets the sql operation attributes that are the same as source attributes for
all levels.
|
java.util.Map<java.lang.Class<?>,java.util.function.BiPredicate<?,java.lang.Boolean>> |
getFilterPredicateMap()
Gets a map of all filters used by this operation and lower level cascades.
|
boolean |
isSourcePrimaryKeyFields() |
boolean |
isSourceTargetFieldNames() |
boolean |
isWhereForeignKeyValueFields() |
boolean |
isWhereSourceFieldNames() |
void |
prepare()
Prepares operation by initializing JDBC statements.
|
protected void |
prepareParameterFields()
Uses reflection to get fields for each of the source class
variables that will be read from source and set as parameters on
cascade operation.
|
protected void |
prepareWhere()
Configures the
WhereTranslator to use for cascade. |
protected void |
setParameters(S sourceRow)
cascade(S) invokes this method to set parameters in cascade operation based
upon parameter fields that were created by prepareParameterFields() . |
protected T[] |
toTargetArray(java.util.Collection<T> c) |
createOperation, getDepth, getForeignKeyReferenceFieldName, getForeignKeyValueFieldNames, getKeyFieldCount, getNamedParameterMap, getRequiredCascades, getSourceOperation, getSourceRow, getSourceTable, getTargetField, getTargetForeignKeyValueFieldList, getTargetTable, isPost, prepareForeignKeyReferenceField, prepareForeignKeyValueFields, setForeignKeyFieldNames, setForeignKeyReference, setForeignKeyReference, setForeignKeyReferenceFieldName, setForeignKeyValues, setForeignKeyValues, setPost
public SelectCascadeOperation(ScalarSelectOperation<S> sourceOperation, RowField<S,?> targetField, Table<T> targetTable, SelectCascade selectCascadeAnnotation)
ScalarSelectOperation
.sourceOperation
- cascade originates on row from this tabletargetField
- cascade select operation modifies this fieldtargetTable
- cascade select operation is performed on this tableselectCascadeAnnotation
- cascade operationpublic java.util.Map<java.lang.Class<?>,java.util.function.BiPredicate<?,java.lang.Boolean>> getFilterPredicateMap()
Key is class type to filter. Value is predicate to invoke for filtering. Filter parameters are row class and boolean that indicates true/false if cascade has been performed on row class.
public void cascade(S sourceRow) throws OperationException
cascade
in class CascadeOperation<S,T>
sourceRow
- row in parent table that was source the cascadeOperationException
- if errorpublic void prepare() throws OperationException
CascadeOperation.prepareForeignKeyValueFields()
. Subclasses should override
to perform additional preparation.prepare
in class CascadeOperation<S,T>
OperationException
- if errorprotected void deriveSqlOperationAttributes()
CascadeOperation
deriveSqlOperationAttributes
in class CascadeOperation<S,T>
public boolean isSourcePrimaryKeyFields()
SelectCascade.sourceParameterFieldNames()
is "#primaryKeyFields"public boolean isSourceTargetFieldNames()
SelectCascade.sourceParameterFieldNames()
is "#targetFieldNames"public boolean isWhereSourceFieldNames()
SelectCascade.targetWhereName()
is "#sourceFieldNames"public boolean isWhereForeignKeyValueFields()
SelectCascade.targetWhereName()
is "#foreignKeyValueFields"protected void prepareParameterFields() throws OperationException
setParameters(S)
is
invoked by cascade(S)
.OperationException
- if errorprotected void setParameters(S sourceRow) throws OperationException
cascade(S)
invokes this method to set parameters in cascade operation based
upon parameter fields that were created by prepareParameterFields()
.
Override for custom parameter initialization.sourceRow
- cascade source rowOperationException
- if errorprotected void prepareWhere() throws OperationException
WhereTranslator
to use for cascade.OperationException
- if errorpublic void close() throws OperationException
close
in interface java.lang.AutoCloseable
close
in class CascadeOperation<S,T>
OperationException
- if errorprotected T[] toTargetArray(java.util.Collection<T> c) throws OperationException
OperationException