org.datanucleus.store.mapped.scostore
Class AbstractSetStore

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
All Implemented Interfaces:
CollectionStoreQueryable, CollectionStore, SetStore, Store
Direct Known Subclasses:
FKSetStore, JoinSetStore, MapKeySetStore, MapValueSetStore

public abstract class AbstractSetStore
extends AbstractCollectionStore
implements SetStore

Abstract representation of the backing store for a Set/Collection.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
 
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
protected AbstractSetStore(StoreManager storeMgr, ClassLoaderResolver clr, AbstractSetStoreSpecialization specialization)
          Constructor.
 
Method Summary
 boolean add(StateManager sm, java.lang.Object element, int size)
          Adds one element to the association owner vs elements
 boolean addAll(StateManager sm, java.util.Collection elements, int size)
          Adds all elements from a collection to the association owner vs elements
abstract  java.util.Iterator iterator(StateManager ownerSM)
          Accessor for an iterator for the set.
 boolean remove(StateManager sm, java.lang.Object element, int size, boolean allowDependentField)
          Removes the association to one element
 boolean removeAll(StateManager sm, java.util.Collection elements, int size)
          Remove all elements from a collection from the association owner vs elements.
 
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
clear, 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
clear, contains, getElementType, hasOrderMapping, size, update, updateEmbeddedElement
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 
Methods inherited from interface org.datanucleus.store.mapped.expression.CollectionStoreQueryable
joinElementsTo
 

Constructor Detail

AbstractSetStore

protected AbstractSetStore(StoreManager storeMgr,
                           ClassLoaderResolver clr,
                           AbstractSetStoreSpecialization specialization)
Constructor.

Parameters:
storeMgr - Manager for the store
clr - The ClassLoaderResolver
specialization - the datastore-specific specialization
Method Detail

iterator

public abstract java.util.Iterator iterator(StateManager ownerSM)
Accessor for an iterator for the set. Implemented by the subclass using whatever mechanism the underlying datastore provides.

Specified by:
iterator in interface CollectionStore
Specified by:
iterator in class ElementContainerStore
Parameters:
ownerSM - State Manager for the set.
Returns:
Iterator for the set.

add

public boolean add(StateManager sm,
                   java.lang.Object element,
                   int size)
Adds one element to the association owner vs elements

Specified by:
add in interface CollectionStore
Parameters:
sm - State Manager for the container
element - The 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)
Adds all elements from a collection to the association owner vs elements

Specified by:
addAll in interface CollectionStore
Parameters:
sm - State Manager for the container
elements - The 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)
Removes the association to one element

Specified by:
remove in interface CollectionStore
Parameters:
sm - State Manager for the container
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)
Remove all elements from a collection from the association owner vs elements. This implementation iterates around the remove() method doing each element 1 at a time. Please refer to the JoinSetStore and FKSetStore for the variations used there. This is used for Map key and value stores.

Specified by:
removeAll in interface CollectionStore
Parameters:
sm - State Manager for the container
elements - Collection of elements to remove
size - Current size of collection if known. -1 if not known
Returns:
Whether the database was updated


Copyright © 2010. All Rights Reserved.