org.datanucleus.store.mapped.scostore
Class MapKeySetStore

java.lang.Object
  extended by org.datanucleus.store.mapped.scostore.BaseContainerStore
      extended by org.datanucleus.store.mapped.scostore.ElementContainerStore
          extended by org.datanucleus.store.mapped.scostore.AbstractCollectionStore
              extended by org.datanucleus.store.mapped.scostore.AbstractSetStore
                  extended by org.datanucleus.store.mapped.scostore.MapKeySetStore
All Implemented Interfaces:
CollectionStoreQueryable, CollectionStore, SetStore, Store

public abstract class MapKeySetStore
extends AbstractSetStore

Representation of the backing store for the keys of a Map. This is used where the user calls Map.keySet() and then wants to perform some operation on the resulting Set. The keys for a Map can be stored in several ways. There are the following possibilities


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
protected  MapStore mapStore
           
 
Fields inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, specialization
 
Fields inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsNull, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
MapKeySetStore(DatastoreContainerObject mapTable, AbstractMemberMetaData ownerMmd, JavaTypeMapping ownerMapping, JavaTypeMapping keyMapping, MapStore mapStore, ClassLoaderResolver clr, AbstractSetStoreSpecialization specialization)
          Constructor for a backing store for the keys of a map relation.
 
Method Summary
 boolean add(StateManager sm, java.lang.Object element, int size)
          Method to add an element.
 boolean addAll(StateManager sm, java.util.Collection elements, int size)
          Method to add a collection of elements.
protected abstract  boolean canClear()
           
protected abstract  boolean canRemove()
           
 void clear(StateManager sm)
          Method to clear the collection.
 ScalarExpression joinElementsTo(QueryExpression stmt, QueryExpression qs, JavaTypeMapping ownerMapping, LogicSetExpression te, DatastoreIdentifier setTableAlias, java.lang.Class filteredElementType, ScalarExpression elmExpr, DatastoreIdentifier elementTableAlias, boolean existsQuery)
          Method used in queries when contains() has been invoked.
 boolean remove(StateManager sm, java.lang.Object element, int size, boolean allowDependentField)
          Method to remove an element.
 boolean removeAll(StateManager sm, java.util.Collection elements, int size)
          Method to remove a collection of elements.
 
Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractSetStore
iterator
 
Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractCollectionStore
contains, getExistsSubquery, getSizeSubquery, update, updateEmbeddedElement
 
Methods inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getElementType, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, hasOrderMapping, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType
 
Methods inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsBatching, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, getStoreManager, isEmbeddedMapping, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.datanucleus.store.scostore.CollectionStore
contains, getElementType, hasOrderMapping, size, update, updateEmbeddedElement
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Field Detail

mapStore

protected final MapStore mapStore
Constructor Detail

MapKeySetStore

public MapKeySetStore(DatastoreContainerObject mapTable,
                      AbstractMemberMetaData ownerMmd,
                      JavaTypeMapping ownerMapping,
                      JavaTypeMapping keyMapping,
                      MapStore mapStore,
                      ClassLoaderResolver clr,
                      AbstractSetStoreSpecialization specialization)
Constructor for a backing store for the keys of a map relation.

Parameters:
mapTable - The table for the map (table storing the map linkage)
ownerMmd - Metadata for the owner member
ownerMapping - mapping from the map table to the owner table
keyMapping - mapping from the map table to the key
mapStore - The backing store for the map
clr - The ClassLoaderResolver
specialization - The specialisation
Method Detail

add

public boolean add(StateManager sm,
                   java.lang.Object element,
                   int size)
Method to add an element. Overridden because we want to prevent it.

Specified by:
add in interface CollectionStore
Overrides:
add in class AbstractSetStore
Parameters:
sm - State Manager of collection.
element - Element to add.
size - Current size of the collection if known. -1 if not known
Returns:
Whether it was successful

addAll

public boolean addAll(StateManager sm,
                      java.util.Collection elements,
                      int size)
Method to add a collection of elements. Overridden because we want to prevent it.

Specified by:
addAll in interface CollectionStore
Overrides:
addAll in class AbstractSetStore
Parameters:
sm - State Manager of collection.
elements - Elements to add.
size - Current size of set (if known). Not used by sets
Returns:
Whether it was successful

remove

public boolean remove(StateManager sm,
                      java.lang.Object element,
                      int size,
                      boolean allowDependentField)
Method to remove an element. Overridden because we want to prevent it.

Specified by:
remove in interface CollectionStore
Overrides:
remove in class AbstractSetStore
Parameters:
sm - State Manager of collection.
element - Element to remove.
size - Current size
allowDependentField - Whether to allow any cascade deletes caused by this removal
Returns:
Whether it was successful

removeAll

public boolean removeAll(StateManager sm,
                         java.util.Collection elements,
                         int size)
Method to remove a collection of elements. Overridden because we want to prevent it.

Specified by:
removeAll in interface CollectionStore
Overrides:
removeAll in class AbstractSetStore
Parameters:
sm - State Manager of collection.
elements - Elements to remove.
size - Current size of collection if known. -1 if not known
Returns:
Whether it was successful

clear

public void clear(StateManager sm)
Method to clear the collection. Overridden because we want to prevent it.

Specified by:
clear in interface CollectionStore
Overrides:
clear in class ElementContainerStore
Parameters:
sm - State Manager of collection.

canRemove

protected abstract boolean canRemove()

canClear

protected abstract boolean canClear()

joinElementsTo

public ScalarExpression joinElementsTo(QueryExpression stmt,
                                       QueryExpression qs,
                                       JavaTypeMapping ownerMapping,
                                       LogicSetExpression te,
                                       DatastoreIdentifier setTableAlias,
                                       java.lang.Class filteredElementType,
                                       ScalarExpression elmExpr,
                                       DatastoreIdentifier elementTableAlias,
                                       boolean existsQuery)
Description copied from interface: CollectionStoreQueryable
Method used in queries when contains() has been invoked.

Parameters:
stmt - The Query Statement
qs - the parent Query Statement. If there is no parent, "parentStmt" must be equals to "stmt".
ownerMapping - the mapping for the owner
te - Table Expression for the owner
setTableAlias - Alias for the "Collection" table.
filteredElementType - The Class Type for the filtered element
elmExpr - The Expression for the element
elementTableAlias - The SQL alias to assign to the element table expression
existsQuery - Whether this is joining for an EXISTS query
Returns:
expression to the join


Copyright © 2010. All Rights Reserved.