org.datanucleus.store.rdbms.scostore
Class AbstractCollectionStore

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
All Implemented Interfaces:
org.datanucleus.store.scostore.CollectionStore, org.datanucleus.store.scostore.Store
Direct Known Subclasses:
AbstractListStore, AbstractSetStore

public abstract class AbstractCollectionStore
extends ElementContainerStore
implements org.datanucleus.store.scostore.CollectionStore

Abstract representation of a store of a Collection. Contains all common parts of storing Sets and Lists.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
protected  String 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 AbstractCollectionStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
          Constructor.
 
Method Summary
 boolean contains(org.datanucleus.store.ObjectProvider op, Object element)
          Method to verify if the association owner vs elements contains a specific element in the association
protected  boolean containsInternal(org.datanucleus.store.ObjectProvider op, Object element)
           
protected  String getRemoveStmt(Object element)
          Generate statement for removing an element from the Collection.
protected  String getUpdateEmbeddedElementStmt(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping)
          Generate statement for update the field of an embedded element.
 int[] internalRemove(org.datanucleus.store.ObjectProvider op, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, Object element, boolean executeNow)
           
 void update(org.datanucleus.store.ObjectProvider op, Collection coll)
          Method to update the collection to be the supplied collection of elements.
 boolean updateEmbeddedElement(org.datanucleus.store.ObjectProvider op, Object element, int fieldNumber, Object value)
          Method to update a field of an embedded element.
 boolean updateEmbeddedElement(org.datanucleus.store.ObjectProvider op, Object element, int fieldNumber, Object value, org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping)
           
 
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, iterator, 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
add, addAll, clear, hasOrderMapping, iterator, remove, removeAll, size
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Field Detail

containsStmt

protected String containsStmt
Constructor Detail

AbstractCollectionStore

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

Parameters:
storeMgr - Manager for the store
clr - ClassLoader resolver
Method Detail

updateEmbeddedElement

public boolean updateEmbeddedElement(org.datanucleus.store.ObjectProvider op,
                                     Object element,
                                     int fieldNumber,
                                     Object value)
Method to update a field of an embedded element.

Specified by:
updateEmbeddedElement in interface org.datanucleus.store.scostore.CollectionStore
Parameters:
op - ObjectProvider of the owner
element - The element to update
fieldNumber - The number of the field to update
value - The value
Returns:
true if the datastore was updated

update

public void update(org.datanucleus.store.ObjectProvider op,
                   Collection coll)
Method to update the collection to be the supplied collection of elements.

Specified by:
update in interface org.datanucleus.store.scostore.CollectionStore
Parameters:
op - ObjectProvider of the object
coll - The collection to use

contains

public boolean contains(org.datanucleus.store.ObjectProvider op,
                        Object element)
Method to verify if the association owner vs elements contains a specific element in the association

Specified by:
contains in interface org.datanucleus.store.scostore.CollectionStore
Parameters:
op - ObjectProvider
element - The element
Returns:
Whether it contains the element

getUpdateEmbeddedElementStmt

protected String getUpdateEmbeddedElementStmt(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping)
Generate statement for update the field of an embedded element.
 UPDATE SETTABLE
 SET EMBEDDEDFIELD1 = ?
 WHERE OWNERCOL=?
 AND ELEMENTCOL = ?
 

Parameters:
fieldMapping - The mapping for the field within the embedded object to be updated
Returns:
Statement for updating an embedded element in the Set

updateEmbeddedElement

public boolean updateEmbeddedElement(org.datanucleus.store.ObjectProvider op,
                                     Object element,
                                     int fieldNumber,
                                     Object value,
                                     org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping)

containsInternal

protected boolean containsInternal(org.datanucleus.store.ObjectProvider op,
                                   Object element)

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
Throws:
org.datanucleus.store.mapped.exceptions.MappedDatastoreException

getRemoveStmt

protected String getRemoveStmt(Object element)
Generate statement for removing an element from the Collection.
 DELETE FROM COLLTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ?
 

Returns:
Statement for deleting an item from the Collection.


Copyright © 2012. All Rights Reserved.