Class MapKeySetStore<K>

  • All Implemented Interfaces:
    org.datanucleus.store.types.scostore.CollectionStore<K>, org.datanucleus.store.types.scostore.SetStore<K>, org.datanucleus.store.types.scostore.Store

    class MapKeySetStore<K>
    extends AbstractSetStore<K>
    Implementation of a backing SetStore for map keys.
    • Field Detail

      • mapStore

        protected final org.datanucleus.store.types.scostore.MapStore<K,​?> mapStore
        Backing store for the map.
      • iteratorStmtLocked

        private java.lang.String iteratorStmtLocked
        JDBC statement to use for retrieving keys of the map (locking).
      • iteratorStmtUnlocked

        private java.lang.String iteratorStmtUnlocked
        JDBC statement to use for retrieving keys of the map (not locking).
    • Constructor Detail

      • MapKeySetStore

        MapKeySetStore​(MapTable mapTable,
                       JoinMapStore<K,​?> mapStore,
                       org.datanucleus.ClassLoaderResolver clr)
        Constructor where a join table is used to store the map relation.
        Parameters:
        mapTable - Join table used by the map (join table)
        mapStore - Backing store for the map
        clr - The ClassLoaderResolver
      • MapKeySetStore

        MapKeySetStore​(DatastoreClass mapTable,
                       FKMapStore<K,​?> mapStore,
                       org.datanucleus.ClassLoaderResolver clr)
        Constructor where a foreign key is used to store the map relation.
        Parameters:
        mapTable - Table holding the map relation (key or value)
        mapStore - Backing store for the map
        clr - The ClassLoaderResolver
    • Method Detail

      • initialize

        private void initialize​(org.datanucleus.ClassLoaderResolver clr)
        Initialisation method.
      • add

        public boolean add​(org.datanucleus.state.DNStateManager sm,
                           K key,
                           int size)
      • addAll

        public boolean addAll​(org.datanucleus.state.DNStateManager sm,
                              java.util.Collection keys,
                              int size)
      • remove

        public boolean remove​(org.datanucleus.state.DNStateManager sm,
                              java.lang.Object key,
                              int size,
                              boolean allowDependentField)
        Specified by:
        remove in interface org.datanucleus.store.types.scostore.CollectionStore<K>
        Overrides:
        remove in class AbstractSetStore<K>
      • removeAll

        public boolean removeAll​(org.datanucleus.state.DNStateManager sm,
                                 java.util.Collection keys,
                                 int size)
      • clear

        public void clear​(org.datanucleus.state.DNStateManager sm)
        Description copied from class: ElementContainerStore
        Clear the association from owner to all elements. Provides cascade-delete when the elements being deleted are PC types.
        Specified by:
        clear in interface org.datanucleus.store.types.scostore.CollectionStore<K>
        Overrides:
        clear in class ElementContainerStore
        Parameters:
        sm - StateManager for the container.
      • iterator

        public java.util.Iterator<K> iterator​(org.datanucleus.state.DNStateManager ownerSM)
        Accessor for an iterator for the set.
        Specified by:
        iterator in interface org.datanucleus.store.types.scostore.CollectionStore<K>
        Specified by:
        iterator in class AbstractSetStore<K>
        Parameters:
        ownerSM - StateManager for the set.
        Returns:
        Iterator for the set.
      • getSQLStatementForIterator

        protected SelectStatement getSQLStatementForIterator​(org.datanucleus.state.DNStateManager ownerSM)
        Method to generate an SQLStatement for iterating through keys of the map. Populates the iteratorMappingDef and iteratorMappingParams. Creates a statement that selects the key table(s), and adds any necessary join to the containerTable if that is not the key table. If the key is embedded then selects the table it is embedded in. Adds a restriction on the ownerMapping of the containerTable so we can restrict to the owner object.
        Parameters:
        ownerSM - StateManager for the owner object
        Returns:
        The SQLStatement