Class InsertRequest.InsertMappingConsumer

java.lang.Object
org.datanucleus.store.rdbms.request.InsertRequest.InsertMappingConsumer
All Implemented Interfaces:
MappingConsumer
Enclosing class:
InsertRequest

private class InsertRequest.InsertMappingConsumer extends Object implements MappingConsumer
Internal class to provide mapping consumption for an INSERT.
  • Field Details

    • insertFields

      List<Integer> insertFields
      Numbers of all fields to be inserted.
    • pkFields

      List<Integer> pkFields
      Numbers of all PK fields.
    • reachableFields

      List<Integer> reachableFields
      Numbers of all reachable fields (with no datastore column).
    • relationFields

      List<Integer> relationFields
      Numbers of all relations fields (bidir that may already be attached when persisting).
    • columnNames

      StringBuilder columnNames
    • columnValues

      StringBuilder columnValues
    • assignedColumns

      Map<String,Integer> assignedColumns
    • postSetMappings

      List<JavaTypeMapping> postSetMappings
      Mappings that require post-set processing.
    • callbackMappings

      List<MappingCallbacks> callbackMappings
      Mappings that require callbacks calling.
    • initialized

      boolean initialized
    • paramIndex

      int paramIndex
    • statementMappings

      private StatementMappingIndex[] statementMappings
      one StatementExpressionIndex for each field
    • retrievedStatementMappings

      private StatementMappingIndex[] retrievedStatementMappings
      statement indexes for fields to be "retrieved".
    • versionStatementMapping

      private StatementMappingIndex versionStatementMapping
      StatementExpressionIndex for version
    • discriminatorStatementMapping

      private StatementMappingIndex discriminatorStatementMapping
      StatementExpressionIndex for discriminator
    • multitenancyStatementMapping

      private StatementMappingIndex multitenancyStatementMapping
      StatementExpressionIndex for multi-tenancy.
    • softDeleteStatementMapping

      private StatementMappingIndex softDeleteStatementMapping
      StatementExpressionIndex for SURROGATE soft-delete.
    • createUserStatementMapping

      private StatementMappingIndex createUserStatementMapping
      StatementExpressionIndex for SURROGATE create-user.
    • createTimestampStatementMapping

      private StatementMappingIndex createTimestampStatementMapping
      StatementExpressionIndex for SURROGATE create-timestamp.
    • updateUserStatementMapping

      private StatementMappingIndex updateUserStatementMapping
      StatementExpressionIndex for SURROGATE update-user.
    • updateTimestampStatementMapping

      private StatementMappingIndex updateTimestampStatementMapping
      StatementExpressionIndex for SURROGATE update-timestamp.
    • externalFKStmtExprIndex

      private StatementMappingIndex[] externalFKStmtExprIndex
    • externalFKDiscrimStmtExprIndex

      private StatementMappingIndex[] externalFKDiscrimStmtExprIndex
    • externalOrderStmtExprIndex

      private StatementMappingIndex[] 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 ClassLoaderResolver
      cmd - ClassMetaData
      initialParamIndex - 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 interface MappingConsumer
      Parameters:
      highestFieldNumber - the highest number for the fields that are going to be provided in the consumer
    • consumeMapping

      public void consumeMapping(JavaTypeMapping m, org.datanucleus.metadata.AbstractMemberMetaData mmd)
      Consumes a mapping for a member.
      Specified by:
      consumeMapping in interface MappingConsumer
      Parameters:
      m - The mapping.
      mmd - MetaData for the member
    • consumeMapping

      public void consumeMapping(JavaTypeMapping m, MappingType mappingType)
      Consumes a (surrogate) mapping (i.e not associated to a field).
      Specified by:
      consumeMapping in interface MappingConsumer
      Parameters:
      m - The mapping.
      mappingType - the Mapping type
    • consumeUnmappedColumn

      public void consumeUnmappedColumn(Column col)
      Consumer a column without mapping.
      Specified by:
      consumeUnmappedColumn in interface MappingConsumer
      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 mapping
      fieldStmtExprIndex - The indices for the fields
      stmtExprIndex - The current external mapping indices
      Returns:
      The updated external mapping indices
    • getPostSetMappings

      public List<JavaTypeMapping> getPostSetMappings()
    • getMappingCallbacks

      public List<MappingCallbacks> 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

      public StatementMappingIndex[] getStatementMappings()
      Obtain the mappings for fields in the statement
      Returns:
      the array of StatementMappingIndex
    • getReachableStatementMappings

      public StatementMappingIndex[] getReachableStatementMappings()
      Obtain the StatementExpressionIndex for the "reachable" fields.
      Returns:
      the array of StatementExpressionIndex indexed by absolute field numbers
    • getVersionStatementMapping

      public StatementMappingIndex getVersionStatementMapping()
      Obtain the mapping for the version in the statement
      Returns:
      the StatementMappingIndex
    • getDiscriminatorStatementMapping

      public StatementMappingIndex getDiscriminatorStatementMapping()
      Obtain the mapping for the discriminator in the statement
      Returns:
      the StatementMappingIndex
    • getMultitenancyStatementMapping

      public StatementMappingIndex getMultitenancyStatementMapping()
      Obtain the mapping for multitenancy in the statement
      Returns:
      the StatementMappingIndex
    • getSoftDeleteStatementMapping

      public StatementMappingIndex getSoftDeleteStatementMapping()
      Obtain the mapping for soft-delete in the statement
      Returns:
      the StatementMappingIndex
    • getCreateUserStatementMapping

      public StatementMappingIndex getCreateUserStatementMapping()
    • getCreateTimestampStatementMapping

      public StatementMappingIndex getCreateTimestampStatementMapping()
    • getUpdateUserStatementMapping

      public StatementMappingIndex getUpdateUserStatementMapping()
    • getUpdateTimestampStatementMapping

      public StatementMappingIndex getUpdateTimestampStatementMapping()
    • getExternalFKStatementMapping

      public StatementMappingIndex[] getExternalFKStatementMapping()
      Obtain the mapping for any external FKs in the statement
      Returns:
      the StatementMappingIndex
    • getExternalFKDiscrimStatementMapping

      public StatementMappingIndex[] getExternalFKDiscrimStatementMapping()
      Obtain the mapping for any external FK discriminators in the statement.
      Returns:
      the StatementMappingIndex
    • getExternalOrderStatementMapping

      public StatementMappingIndex[] getExternalOrderStatementMapping()
      Obtain the mapping for any external indexes in the statement
      Returns:
      the StatementMappingIndex
    • getInsertStmt

      public String getInsertStmt()
      Obtain the insert statement
      Returns:
      the SQL statement