Class AbstractArrayStore<E>
- java.lang.Object
-
- org.datanucleus.store.rdbms.scostore.BaseContainerStore
-
- org.datanucleus.store.rdbms.scostore.ElementContainerStore
-
- org.datanucleus.store.rdbms.scostore.AbstractArrayStore<E>
-
- Type Parameters:
E- Type of element in this array
- All Implemented Interfaces:
org.datanucleus.store.types.scostore.ArrayStore<E>,org.datanucleus.store.types.scostore.Store
- Direct Known Subclasses:
FKArrayStore,JoinArrayStore
public abstract class AbstractArrayStore<E> extends ElementContainerStore implements org.datanucleus.store.types.scostore.ArrayStore<E>
Abstract representation of the backing store for an array.
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
addStmt, clearStmt, containerTable, elementCmd, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt
-
Fields inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractArrayStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanadd(org.datanucleus.state.ObjectProvider op, E element, int position)Adds one element to the association owner vs elementsvoidclear(org.datanucleus.state.ObjectProvider op)Clear the association from owner to all elements.voidclearInternal(org.datanucleus.state.ObjectProvider ownerOP)List<E>getArray(org.datanucleus.state.ObjectProvider op)Accessor for the array from the datastore.int[]internalAdd(org.datanucleus.state.ObjectProvider op, E element, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, int orderId, boolean executeNow)Internal method to add a row to the join table.abstract Iterator<E>iterator(org.datanucleus.state.ObjectProvider ownerOP)Accessor for an iterator through the array elements.voidprocessBatchedWrites(org.datanucleus.store.connection.ManagedConnection mconn)booleanset(org.datanucleus.state.ObjectProvider op, Object array)Method to set the array for the specified owner to the passed value.-
Methods inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
getAddStmtForJoinTable, getClearStmt, getComponentInfoForElement, getContainerTable, getElementClassMetaData, getElementMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, usingJoinTable, validateElementForReading, validateElementForWriting, validateElementType
-
Methods inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getObjectProviderForEmbeddedPCObject, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStoreManager, isEmbeddedMapping, setOwner
-
-
-
-
Constructor Detail
-
AbstractArrayStore
protected AbstractArrayStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
Constructor.- Parameters:
storeMgr- Manager for the storeclr- ClassLoader resolver
-
-
Method Detail
-
getArray
public List<E> getArray(org.datanucleus.state.ObjectProvider op)
Accessor for the array from the datastore.- Specified by:
getArrayin interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>- Parameters:
op- SM for the owner- Returns:
- The array (as a List of objects)
-
clear
public void clear(org.datanucleus.state.ObjectProvider op)
Clear the association from owner to all elements. Observes the necessary dependent field settings with respect to whether it should delete the element when doing so.- Specified by:
clearin interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>- Overrides:
clearin classElementContainerStore- Parameters:
op- ObjectProvider for the container.
-
set
public boolean set(org.datanucleus.state.ObjectProvider op, Object array)Method to set the array for the specified owner to the passed value.- Specified by:
setin interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>- Parameters:
op- ObjectProvider for the ownerarray- the array- Returns:
- Whether the array was updated successfully
-
add
public boolean add(org.datanucleus.state.ObjectProvider op, E element, int position)Adds one element to the association owner vs elements- Parameters:
op- ObjectProvider for the containerelement- The element to addposition- The position to add this element at- Returns:
- Whether it was successful
-
iterator
public abstract Iterator<E> iterator(org.datanucleus.state.ObjectProvider ownerOP)
Accessor for an iterator through the array elements.- Specified by:
iteratorin interfaceorg.datanucleus.store.types.scostore.ArrayStore<E>- Specified by:
iteratorin classElementContainerStore- Parameters:
ownerOP- ObjectProvider for the container.- Returns:
- The Iterator
-
clearInternal
public void clearInternal(org.datanucleus.state.ObjectProvider ownerOP)
-
internalAdd
public int[] internalAdd(org.datanucleus.state.ObjectProvider op, E element, org.datanucleus.store.connection.ManagedConnection conn, boolean batched, int orderId, boolean executeNow) throws MappedDatastoreExceptionInternal method to add a row to the join table. Used by add() and set() to add a row to the join table.- Parameters:
op- ObjectProvider for the owner of the collectionelement- The element to add the relation toconn- The connectionbatched- Whether we are batchingorderId- The order id to use for this element relationexecuteNow- Whether to execute the statement now (and not wait for any batch)- Returns:
- Whether a row was inserted
- Throws:
MappedDatastoreException- Thrown if an error occurs
-
processBatchedWrites
public void processBatchedWrites(org.datanucleus.store.connection.ManagedConnection mconn) throws MappedDatastoreException- Throws:
MappedDatastoreException
-
-