org.datanucleus.store.rdbms.scostore
Class AbstractSetStore

java.lang.Object
  extended by org.datanucleus.store.rdbms.scostore.BaseContainerStore
      extended by org.datanucleus.store.rdbms.scostore.ElementContainerStore
          extended by org.datanucleus.store.rdbms.scostore.AbstractCollectionStore
              extended by org.datanucleus.store.rdbms.scostore.AbstractSetStore
All Implemented Interfaces:
org.datanucleus.store.scostore.CollectionStore, org.datanucleus.store.scostore.SetStore, org.datanucleus.store.scostore.Store
Direct Known Subclasses:
RDBMSFKSetStore, RDBMSJoinSetStore

public abstract class AbstractSetStore
extends AbstractCollectionStore
implements org.datanucleus.store.scostore.SetStore

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


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
 
Fields inherited from class org.datanucleus.store.rdbms.scostore.AbstractCollectionStore
containsStmt
 
Fields inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
addStmt, clearStmt, clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt, usingDiscriminatorInSizeStmt
 
Fields inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowNulls, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
protected AbstractSetStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
          Constructor.
 
Method Summary
 boolean add(org.datanucleus.store.ObjectProvider op, Object element, int size)
          Adds one element to the association owner vs elements.
 boolean addAll(org.datanucleus.store.ObjectProvider op, Collection elements, int size)
          Adds all elements from a collection to the association owner vs elements
 int[] internalAdd(org.datanucleus.store.ObjectProvider op, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, Object element, boolean processNow)
          Method to process an "add" statement.
 int[] internalRemove(org.datanucleus.store.ObjectProvider op, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, Object element, boolean executeNow)
           
abstract  Iterator iterator(org.datanucleus.store.ObjectProvider op)
          Accessor for an iterator for the set.
 boolean remove(org.datanucleus.store.ObjectProvider op, Object element, int size)
           
 boolean remove(org.datanucleus.store.ObjectProvider op, Object element, int size, boolean allowDependentField)
          Removes the association to one element
 boolean removeAll(org.datanucleus.store.ObjectProvider op, Collection elements, int size)
          Remove all elements from a collection from the association owner vs elements.
 
Methods inherited from class org.datanucleus.store.rdbms.scostore.AbstractCollectionStore
contains, containsInternal, getRemoveStmt, getUpdateEmbeddedElementStmt, update, updateEmbeddedElement, updateEmbeddedElement
 
Methods inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
clear, executeClear, getAddStmt, getClearStmt, getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType
 
Methods inherited from class org.datanucleus.store.rdbms.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, hasOrderMapping, size, update, updateEmbeddedElement
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Constructor Detail

AbstractSetStore

protected AbstractSetStore(RDBMSStoreManager storeMgr,
                           org.datanucleus.ClassLoaderResolver clr)
Constructor.

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

iterator

public abstract Iterator iterator(org.datanucleus.store.ObjectProvider op)
Accessor for an iterator for the set. Implemented by the subclass using whatever mechanism the underlying datastore provides.

Specified by:
iterator in interface org.datanucleus.store.scostore.CollectionStore
Specified by:
iterator in class ElementContainerStore
Parameters:
op - State Manager for the set.
Returns:
Iterator for the set.

add

public boolean add(org.datanucleus.store.ObjectProvider op,
                   Object element,
                   int size)
Adds one element to the association owner vs elements.

Specified by:
add in interface org.datanucleus.store.scostore.CollectionStore
Parameters:
op - ObjectProvider for the container
element - The element to add
Returns:
Whether it was successful

addAll

public boolean addAll(org.datanucleus.store.ObjectProvider op,
                      Collection elements,
                      int size)
Adds all elements from a collection to the association owner vs elements

Specified by:
addAll in interface org.datanucleus.store.scostore.CollectionStore
Parameters:
op - ObjectProvider 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(org.datanucleus.store.ObjectProvider op,
                      Object element,
                      int size,
                      boolean allowDependentField)
Removes the association to one element

Specified by:
remove in interface org.datanucleus.store.scostore.CollectionStore
Parameters:
op - ObjectProvider 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(org.datanucleus.store.ObjectProvider op,
                         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 org.datanucleus.store.scostore.CollectionStore
Parameters:
op - State Manager for the container
elements - Collection of elements to remove
Returns:
Whether the database was updated

internalAdd

public int[] internalAdd(org.datanucleus.store.ObjectProvider op,
                         org.datanucleus.store.connection.ManagedConnection conn,
                         boolean batched,
                         Object element,
                         boolean processNow)
                  throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
Method to process an "add" statement.

Parameters:
op - ObjectProvider for the owner
conn - The connection
batched - Whether we are batching it
element - The element
Returns:
Number of datastore records changed (always 0 if batch since nothing yet changed)
Throws:
org.datanucleus.store.mapped.exceptions.MappedDatastoreException - Thrown if an error occurs

remove

public boolean remove(org.datanucleus.store.ObjectProvider op,
                      Object element,
                      int size)

internalRemove

public int[] internalRemove(org.datanucleus.store.ObjectProvider op,
                            org.datanucleus.store.connection.ManagedConnection conn,
                            boolean batched,
                            Object element,
                            boolean executeNow)
                     throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
Overrides:
internalRemove in class AbstractCollectionStore
Throws:
org.datanucleus.store.mapped.exceptions.MappedDatastoreException


Copyright © 2012. All Rights Reserved.