public abstract class AbstractListStore extends AbstractCollectionStore implements org.datanucleus.store.scostore.ListStore
ElementContainerStore.ElementInfo| Modifier and Type | Field and Description |
|---|---|
protected boolean |
indexedList
Whether the list is indexed (like with JDO).
|
protected String |
indexOfStmt |
protected String |
lastIndexOfStmt |
protected String |
removeAtStmt |
protected String |
shiftStmt |
containsStmtaddStmt, clearStmt, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt, usingDiscriminatorInSizeStmtallowNulls, clr, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr| Modifier | Constructor and Description |
|---|---|
protected |
AbstractListStore(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(org.datanucleus.state.ObjectProvider op,
Object element,
int size)
Method to add an element to the List.
|
void |
add(org.datanucleus.state.ObjectProvider op,
Object element,
int index,
int size)
Method to add an element to the List.
|
boolean |
addAll(org.datanucleus.state.ObjectProvider op,
Collection elements,
int size)
Method to add a collection of elements to the List.
|
boolean |
addAll(org.datanucleus.state.ObjectProvider op,
Collection elements,
int index,
int size)
Method to add all elements from a Collection to the List.
|
Object |
get(org.datanucleus.state.ObjectProvider op,
int index)
Method to retrieve an element from the List.
|
protected String |
getIndexOfStmt(Object element)
Generate statement for getting the index of an item.
|
protected int[] |
getIndicesOf(org.datanucleus.state.ObjectProvider op,
Collection elements)
Utility to find the indices of a collection of elements.
|
protected String |
getIndicesOfStmt(Collection elements)
Generates the statement for getting the indices of a collection of element.
|
protected String |
getLastIndexOfStmt(Object element)
Generates the statement for getting the index of the last item.
|
protected String |
getRemoveAtStmt()
Generates the statement for removing an item.
|
protected String |
getShiftStmt()
Generates the statement for shifting items.
|
int |
indexOf(org.datanucleus.state.ObjectProvider op,
Object element)
Accessor for the indexOf an object in the List.
|
protected abstract boolean |
internalAdd(org.datanucleus.state.ObjectProvider op,
int startAt,
boolean atEnd,
Collection elements,
int size)
Internal method for adding an item to the List.
|
protected int |
internalIndexOf(org.datanucleus.state.ObjectProvider op,
Object element,
String stmt)
Internal method to find the index of an element.
|
protected abstract boolean |
internalRemove(org.datanucleus.state.ObjectProvider op,
Object element,
int size)
Convenience method to remove the specified element from the List.
|
protected abstract void |
internalRemoveAt(org.datanucleus.state.ObjectProvider op,
int index,
int size)
Internal method to remove an object at a location from the List.
|
protected void |
internalRemoveAt(org.datanucleus.state.ObjectProvider op,
int index,
String stmt,
int size)
Internal method to remove an object at a location in the List.
|
protected int[] |
internalShift(org.datanucleus.state.ObjectProvider op,
org.datanucleus.store.connection.ManagedConnection conn,
boolean batched,
int oldIndex,
int amount,
boolean executeNow)
Method to process a "shift" statement, updating the index in the list of the specified index.
|
Iterator |
iterator(org.datanucleus.state.ObjectProvider op)
Accessor for an iterator through the list elements.
|
int |
lastIndexOf(org.datanucleus.state.ObjectProvider op,
Object element)
Method to retrieve the last index of an object in the list.
|
ListIterator |
listIterator(org.datanucleus.state.ObjectProvider op)
Accessor for an iterator through the list elements.
|
protected abstract ListIterator |
listIterator(org.datanucleus.state.ObjectProvider op,
int startIdx,
int endIdx)
Accessor for an iterator through the list elements.
|
Object |
remove(org.datanucleus.state.ObjectProvider op,
int index,
int size)
Method to remove an object at an index in the List.
|
boolean |
remove(org.datanucleus.state.ObjectProvider op,
Object element,
int size,
boolean allowDependentField)
Method to remove the specified element from the List.
|
boolean |
removeAll(org.datanucleus.state.ObjectProvider op,
Collection elements,
int size)
Remove all elements from a collection from the association owner vs elements.
|
List |
subList(org.datanucleus.state.ObjectProvider op,
int startIdx,
int endIdx)
Method to retrieve a list of elements in a range.
|
contains, containsInternal, getRemoveStmt, getUpdateEmbeddedElementStmt, internalRemove, update, updateEmbeddedElement, updateEmbeddedElementclear, executeClear, getAddStmt, getClearStmt, getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementTypeallowsBatching, getDatastoreAdapter, getObjectProviderForEmbeddedPCObject, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStoreManager, isEmbeddedMapping, setOwnerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected boolean indexedList
protected String indexOfStmt
protected String lastIndexOfStmt
protected String removeAtStmt
protected String shiftStmt
protected AbstractListStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
storeMgr - Manager for the storeclr - ClassLoader resolverpublic Iterator iterator(org.datanucleus.state.ObjectProvider op)
iterator in interface org.datanucleus.store.scostore.CollectionStoreiterator in class ElementContainerStoreop - ObjectProvider for the container.public ListIterator listIterator(org.datanucleus.state.ObjectProvider op)
listIterator in interface org.datanucleus.store.scostore.ListStoreop - ObjectProvider for the container.protected abstract ListIterator listIterator(org.datanucleus.state.ObjectProvider op, int startIdx, int endIdx)
op - ObjectProvider for the container.startIdx - The start point in the list (only for indexed lists).endIdx - The end point in the list (only for indexed lists).public boolean add(org.datanucleus.state.ObjectProvider op,
Object element,
int size)
add in interface org.datanucleus.store.scostore.CollectionStoreop - The ObjectProviderelement - The element to removesize - Size of the current list (if known, -1 if not)public void add(org.datanucleus.state.ObjectProvider op,
Object element,
int index,
int size)
add in interface org.datanucleus.store.scostore.ListStoreelement - The element to add.index - The location to add atop - The ObjectProvider.public boolean addAll(org.datanucleus.state.ObjectProvider op,
Collection elements,
int size)
addAll in interface org.datanucleus.store.scostore.CollectionStoreop - The ObjectProviderelements - The elements to removesize - Current size of the list (if known). -1 if not knownpublic boolean addAll(org.datanucleus.state.ObjectProvider op,
Collection elements,
int index,
int size)
addAll in interface org.datanucleus.store.scostore.ListStoreop - The ObjectProviderelements - The collectionindex - The location to add atsize - Current size of the list (if known). -1 if not knownprotected abstract boolean internalAdd(org.datanucleus.state.ObjectProvider op,
int startAt,
boolean atEnd,
Collection elements,
int size)
op - The ObjectProviderstartAt - The start positionatEnd - Whether to add at the endelements - The Collection of elements to add.size - Current size of List (if known). -1 if not knownpublic Object get(org.datanucleus.state.ObjectProvider op, int index)
get in interface org.datanucleus.store.scostore.ListStoreop - ObjectProvider for the ownerindex - The index of the element required.public int indexOf(org.datanucleus.state.ObjectProvider op,
Object element)
indexOf in interface org.datanucleus.store.scostore.ListStoreop - ObjectProvider for the ownerelement - The element.public int lastIndexOf(org.datanucleus.state.ObjectProvider op,
Object element)
lastIndexOf in interface org.datanucleus.store.scostore.ListStoreop - ObjectProvider for the ownerelement - The objectpublic boolean removeAll(org.datanucleus.state.ObjectProvider op,
Collection elements,
int size)
removeAll in interface org.datanucleus.store.scostore.CollectionStoreop - ObjectProvider for the ownerelements - Collection of elements to removepublic boolean remove(org.datanucleus.state.ObjectProvider op,
Object element,
int size,
boolean allowDependentField)
remove in interface org.datanucleus.store.scostore.CollectionStoreop - ObjectProvider for the ownerelement - The element to remove.size - Current size of list if known. -1 if not knownallowDependentField - Whether to allow any cascade deletes caused by this removalprotected abstract boolean internalRemove(org.datanucleus.state.ObjectProvider op,
Object element,
int size)
op - ObjectProvider of the ownerelement - The elementsize - Current size of list if known. -1 if not knownpublic Object remove(org.datanucleus.state.ObjectProvider op, int index, int size)
remove in interface org.datanucleus.store.scostore.ListStoreop - ObjectProviderindex - The locationsize - Current size of the list (if known). -1 if not knownprotected abstract void internalRemoveAt(org.datanucleus.state.ObjectProvider op,
int index,
int size)
op - ObjectProviderindex - The index of the element to removesize - Current list size (if known). -1 if not knownpublic List subList(org.datanucleus.state.ObjectProvider op, int startIdx, int endIdx)
subList in interface org.datanucleus.store.scostore.ListStoreop - ObjectProviderstartIdx - From index (inclusive).endIdx - To index (exclusive)protected int[] getIndicesOf(org.datanucleus.state.ObjectProvider op,
Collection elements)
op - ObjectProviderelements - The elementsprotected int internalIndexOf(org.datanucleus.state.ObjectProvider op,
Object element,
String stmt)
op - ObjectProviderelement - The elementstmt - The statement to find the element.protected void internalRemoveAt(org.datanucleus.state.ObjectProvider op,
int index,
String stmt,
int size)
op - ObjectProviderindex - The locationstmt - The statement to remove the element from the Listsize - Current list size (if known). -1 if not knownprotected int[] internalShift(org.datanucleus.state.ObjectProvider op,
org.datanucleus.store.connection.ManagedConnection conn,
boolean batched,
int oldIndex,
int amount,
boolean executeNow)
throws MappedDatastoreException
op - ObjectProviderconn - The connectionbatched - Whether the statement is batchedoldIndex - The old indexamount - Amount to shift by (negative means shift down)executeNow - Whether to execute the statement now (or wait for batching)MappedDatastoreException - Thrown if an error occursprotected String getIndexOfStmt(Object element)
SELECT INDEXCOL FROM LISTTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...] [AND DISTINGUISHER=?] ORDER BY INDEXCOL
element - The element to get the index ofprotected String getLastIndexOfStmt(Object element)
SELECT INDEXCOL FROM LISTTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...] [AND DISTINGUISHER=?] ORDER BY INDEXCOL DESC
protected String getIndicesOfStmt(Collection elements)
SELECT INDEXCOL FROM LISTTABLE
WHERE (OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?]) OR
(OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?]) OR
(OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?])
ORDER BY INDEXCOL DESC
elements - The elements to retrieve the indices for.protected String getRemoveAtStmt()
DELETE FROM LISTTABLE WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
protected String getShiftStmt()
UPDATE LISTTABLE SET INDEXCOL = ? + INDEXCOL WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
Copyright © 2013. All Rights Reserved.