Class InsertRequest.InsertMappingConsumer
java.lang.Object
org.datanucleus.store.rdbms.request.InsertRequest.InsertMappingConsumer
- All Implemented Interfaces:
MappingConsumer
- Enclosing class:
InsertRequest
Internal class to provide mapping consumption for an INSERT.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) List
<MappingCallbacks> Mappings that require callbacks calling.private final org.datanucleus.ClassLoaderResolver
private final org.datanucleus.metadata.AbstractClassMetaData
(package private) StringBuilder
(package private) StringBuilder
private StatementMappingIndex
StatementExpressionIndex for SURROGATE create-timestamp.private StatementMappingIndex
StatementExpressionIndex for SURROGATE create-user.private StatementMappingIndex
StatementExpressionIndex for discriminatorprivate StatementMappingIndex[]
private StatementMappingIndex[]
private StatementMappingIndex[]
(package private) boolean
Numbers of all fields to be inserted.private StatementMappingIndex
StatementExpressionIndex for multi-tenancy.(package private) int
Numbers of all PK fields.(package private) List
<JavaTypeMapping> Mappings that require post-set processing.Numbers of all reachable fields (with no datastore column).Numbers of all relations fields (bidir that may already be attached when persisting).private StatementMappingIndex[]
statement indexes for fields to be "retrieved".private StatementMappingIndex
StatementExpressionIndex for SURROGATE soft-delete.private StatementMappingIndex[]
one StatementExpressionIndex for each fieldprivate StatementMappingIndex
StatementExpressionIndex for SURROGATE update-timestamp.private StatementMappingIndex
StatementExpressionIndex for SURROGATE update-user.private StatementMappingIndex
StatementExpressionIndex for version -
Constructor Summary
ConstructorsConstructorDescriptionInsertMappingConsumer
(org.datanucleus.ClassLoaderResolver clr, org.datanucleus.metadata.AbstractClassMetaData cmd, int initialParamIndex) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
consumeMapping
(JavaTypeMapping m, org.datanucleus.metadata.AbstractMemberMetaData mmd) Consumes a mapping for a member.void
consumeMapping
(JavaTypeMapping m, MappingType mappingType) Consumes a (surrogate) mapping (i.e not associated to a field).void
Consumer a column without mapping.Obtain the mapping for the discriminator in the statementObtain the mapping for any external FK discriminators in the statement.Obtain the mapping for any external FKs in the statementObtain the mapping for any external indexes in the statementint[]
Accessor for the numbers of the fields to be inserted (excluding PK fields).Obtain the insert statementObtain the mapping for multitenancy in the statementint[]
Accessor for the numbers of the PK fields.int[]
Accessor for the numbers of the reachable fields (not inserted).Obtain the StatementExpressionIndex for the "reachable" fields.int[]
Accessor for the numbers of the relation fields (not inserted).Obtain the mapping for soft-delete in the statementObtain the mappings for fields in the statementObtain the mapping for the version in the statementvoid
preConsumeMapping
(int highestFieldNumber) This method is called before consuming the mappingsprivate StatementMappingIndex[]
processExternalMapping
(JavaTypeMapping mapping, StatementMappingIndex[] fieldStmtExprIndex, StatementMappingIndex[] stmtExprIndex) Convenience method to process an external mapping.
-
Field Details
-
insertFields
Numbers of all fields to be inserted. -
pkFields
Numbers of all PK fields. -
reachableFields
Numbers of all reachable fields (with no datastore column). -
relationFields
Numbers of all relations fields (bidir that may already be attached when persisting). -
columnNames
StringBuilder columnNames -
columnValues
StringBuilder columnValues -
assignedColumns
-
postSetMappings
List<JavaTypeMapping> postSetMappingsMappings that require post-set processing. -
callbackMappings
List<MappingCallbacks> callbackMappingsMappings that require callbacks calling. -
initialized
boolean initialized -
paramIndex
int paramIndex -
statementMappings
one StatementExpressionIndex for each field -
retrievedStatementMappings
statement indexes for fields to be "retrieved". -
versionStatementMapping
StatementExpressionIndex for version -
discriminatorStatementMapping
StatementExpressionIndex for discriminator -
multitenancyStatementMapping
StatementExpressionIndex for multi-tenancy. -
softDeleteStatementMapping
StatementExpressionIndex for SURROGATE soft-delete. -
createUserStatementMapping
StatementExpressionIndex for SURROGATE create-user. -
createTimestampStatementMapping
StatementExpressionIndex for SURROGATE create-timestamp. -
updateUserStatementMapping
StatementExpressionIndex for SURROGATE update-user. -
updateTimestampStatementMapping
StatementExpressionIndex for SURROGATE update-timestamp. -
externalFKStmtExprIndex
-
externalFKDiscrimStmtExprIndex
-
externalOrderStmtExprIndex
-
clr
private final org.datanucleus.ClassLoaderResolver clr -
cmd
private final org.datanucleus.metadata.AbstractClassMetaData cmd
-
-
Constructor Details
-
InsertMappingConsumer
public InsertMappingConsumer(org.datanucleus.ClassLoaderResolver clr, org.datanucleus.metadata.AbstractClassMetaData cmd, int initialParamIndex) Constructor- Parameters:
clr
- the ClassLoaderResolvercmd
- ClassMetaDatainitialParamIndex
- the initial index to use for the JDBC Parameter
-
-
Method Details
-
preConsumeMapping
public void preConsumeMapping(int highestFieldNumber) Description copied from interface:MappingConsumer
This method is called before consuming the mappings- Specified by:
preConsumeMapping
in interfaceMappingConsumer
- Parameters:
highestFieldNumber
- the highest number for the fields that are going to be provided in the consumer
-
consumeMapping
Consumes a mapping for a member.- Specified by:
consumeMapping
in interfaceMappingConsumer
- Parameters:
m
- The mapping.mmd
- MetaData for the member
-
consumeMapping
Consumes a (surrogate) mapping (i.e not associated to a field).- Specified by:
consumeMapping
in interfaceMappingConsumer
- Parameters:
m
- The mapping.mappingType
- the Mapping type
-
consumeUnmappedColumn
Consumer a column without mapping.- Specified by:
consumeUnmappedColumn
in interfaceMappingConsumer
- Parameters:
col
- The column
-
processExternalMapping
private StatementMappingIndex[] processExternalMapping(JavaTypeMapping mapping, StatementMappingIndex[] fieldStmtExprIndex, StatementMappingIndex[] stmtExprIndex) Convenience method to process an external mapping.- Parameters:
mapping
- The external mappingfieldStmtExprIndex
- The indices for the fieldsstmtExprIndex
- The current external mapping indices- Returns:
- The updated external mapping indices
-
getPostSetMappings
-
getMappingCallbacks
-
getInsertFieldNumbers
public int[] getInsertFieldNumbers()Accessor for the numbers of the fields to be inserted (excluding PK fields).- Returns:
- the array of field numbers
-
getPrimaryKeyFieldNumbers
public int[] getPrimaryKeyFieldNumbers()Accessor for the numbers of the PK fields.- Returns:
- the array of primary key field numbers
-
getReachableFieldNumbers
public int[] getReachableFieldNumbers()Accessor for the numbers of the reachable fields (not inserted).- Returns:
- the array of field numbers
-
getRelationFieldNumbers
public int[] getRelationFieldNumbers()Accessor for the numbers of the relation fields (not inserted).- Returns:
- the array of field numbers
-
getStatementMappings
Obtain the mappings for fields in the statement- Returns:
- the array of StatementMappingIndex
-
getReachableStatementMappings
Obtain the StatementExpressionIndex for the "reachable" fields.- Returns:
- the array of StatementExpressionIndex indexed by absolute field numbers
-
getVersionStatementMapping
Obtain the mapping for the version in the statement- Returns:
- the StatementMappingIndex
-
getDiscriminatorStatementMapping
Obtain the mapping for the discriminator in the statement- Returns:
- the StatementMappingIndex
-
getMultitenancyStatementMapping
Obtain the mapping for multitenancy in the statement- Returns:
- the StatementMappingIndex
-
getSoftDeleteStatementMapping
Obtain the mapping for soft-delete in the statement- Returns:
- the StatementMappingIndex
-
getCreateUserStatementMapping
-
getCreateTimestampStatementMapping
-
getUpdateUserStatementMapping
-
getUpdateTimestampStatementMapping
-
getExternalFKStatementMapping
Obtain the mapping for any external FKs in the statement- Returns:
- the StatementMappingIndex
-
getExternalFKDiscrimStatementMapping
Obtain the mapping for any external FK discriminators in the statement.- Returns:
- the StatementMappingIndex
-
getExternalOrderStatementMapping
Obtain the mapping for any external indexes in the statement- Returns:
- the StatementMappingIndex
-
getInsertStmt
Obtain the insert statement- Returns:
- the SQL statement
-