Class DeleteRequest.DeleteMappingConsumer

  • All Implemented Interfaces:
    MappingConsumer
    Enclosing class:
    DeleteRequest

    private class DeleteRequest.DeleteMappingConsumer
    extends java.lang.Object
    implements MappingConsumer
    Mapping Consumer used for generating the DELETE statement for an object in a table. This statement will be of the form
     DELETE FROM table-name WHERE id1=? AND id2=?
     
    or (when also performing version checks)
     DELETE FROM table-name WHERE id1=? AND id2=? AND version={oldvers}
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<MappingCallbacks> callbackMappings
      Mapping Callbacks to invoke at deletion.
      private org.datanucleus.ClassLoaderResolver clr
      ClassLoaderResolver
      private org.datanucleus.metadata.AbstractClassMetaData cmd
      MetaData for the class of the object
      (package private) boolean initialized
      Flag for initialisation state of the consumer.
      private java.util.List oneToOneNonOwnerFields
      Fields in a 1-1 relation with FK in the table of the other object.
      (package private) int paramIndex
      Current parameter index.
      (package private) java.lang.StringBuilder where
      Where clause for the statement.
      private boolean whereClauseConsumption  
      private java.util.List whereFields
      WHERE clause field numbers to use in identifying the record to delete.
    • Constructor Summary

      Constructors 
      Constructor Description
      DeleteMappingConsumer​(org.datanucleus.ClassLoaderResolver clr, org.datanucleus.metadata.AbstractClassMetaData cmd)
      Constructor.
    • Field Detail

      • initialized

        boolean initialized
        Flag for initialisation state of the consumer.
      • where

        java.lang.StringBuilder where
        Where clause for the statement. Built during the consumption process.
      • paramIndex

        int paramIndex
        Current parameter index.
      • whereFields

        private java.util.List whereFields
        WHERE clause field numbers to use in identifying the record to delete.
      • oneToOneNonOwnerFields

        private java.util.List oneToOneNonOwnerFields
        Fields in a 1-1 relation with FK in the table of the other object.
      • callbackMappings

        private java.util.List<MappingCallbacks> callbackMappings
        Mapping Callbacks to invoke at deletion.
      • clr

        private final org.datanucleus.ClassLoaderResolver clr
        ClassLoaderResolver
      • cmd

        private final org.datanucleus.metadata.AbstractClassMetaData cmd
        MetaData for the class of the object
      • whereClauseConsumption

        private boolean whereClauseConsumption
    • Constructor Detail

      • DeleteMappingConsumer

        public DeleteMappingConsumer​(org.datanucleus.ClassLoaderResolver clr,
                                     org.datanucleus.metadata.AbstractClassMetaData cmd)
        Constructor.
        Parameters:
        clr - the ClassLoaderResolver
        cmd - AbstractClassMetaData
    • Method Detail

      • setWhereClauseConsumption

        public void setWhereClauseConsumption()
      • preConsumeMapping

        public void preConsumeMapping​(int highest)
        Description copied from interface: MappingConsumer
        This method is called before consuming the mappings
        Specified by:
        preConsumeMapping in interface MappingConsumer
        Parameters:
        highest - 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)
        Description copied from interface: MappingConsumer
        Consumes a mapping associated to a member
        Specified by:
        consumeMapping in interface MappingConsumer
        Parameters:
        m - The Java type mapping
        mmd - MetaData for the member
      • consumeMapping

        public void consumeMapping​(JavaTypeMapping m,
                                   MappingType mappingType)
        Consumes a mapping for a surrogate column (version, datastore identity, multitenancy). Never called with whereClauseConsumption=false
        Specified by:
        consumeMapping in interface MappingConsumer
        Parameters:
        m - The mapping
        mappingType - the Mapping type
      • getWhereFieldNumbers

        public int[] getWhereFieldNumbers()
        Accessor for the field numbers of any WHERE clause fields
        Returns:
        array of absolute WHERE clause field numbers
      • getOneToOneNonOwnerFields

        public org.datanucleus.metadata.AbstractMemberMetaData[] getOneToOneNonOwnerFields()
        All 1-1 bidirectional non-owner fields, with the FK In the other object.
        Returns:
        The fields that are 1-1 bidirectional with the FK at the other side.
      • getMappingCallBacks

        public java.util.List<MappingCallbacks> getMappingCallBacks()
        Obtain a List of mapping callbacks that will be run for this deletion.
        Returns:
        the mapping callbacks
      • getStatement

        public java.lang.String getStatement()
        Accessor for the delete SQL statement.
        Returns:
        The delete SQL statement
      • getSoftDeleteStatement

        public java.lang.String getSoftDeleteStatement()