|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.rdbms.scostore.BaseContainerStore
org.datanucleus.store.rdbms.scostore.ElementContainerStore
org.datanucleus.store.rdbms.scostore.AbstractCollectionStore
org.datanucleus.store.rdbms.scostore.AbstractListStore
public abstract class AbstractListStore
Abstract representation of a backing store for a List.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore |
|---|
ElementContainerStore.ElementInfo |
| Field Summary | |
|---|---|
protected boolean |
indexedList
Whether the list is indexed (like with JDO). |
protected String |
indexOfStmt
|
protected String |
lastIndexOfStmt
|
protected String |
removeAtStmt
|
protected String |
shiftStmt
|
| 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 |
AbstractListStore(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr)
Constructor. |
| Method Summary | |
|---|---|
boolean |
add(org.datanucleus.store.ObjectProvider sm,
Object element,
int size)
Method to add an element to the List. |
void |
add(org.datanucleus.store.ObjectProvider sm,
Object element,
int index,
int size)
Method to add an element to the List. |
boolean |
addAll(org.datanucleus.store.ObjectProvider sm,
Collection elements,
int size)
Method to add a collection of elements to the List. |
boolean |
addAll(org.datanucleus.store.ObjectProvider sm,
Collection elements,
int index,
int size)
Method to add all elements from a Collection to the List. |
Object |
get(org.datanucleus.store.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.store.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.store.ObjectProvider op,
Object element)
Accessor for the indexOf an object in the List. |
protected abstract boolean |
internalAdd(org.datanucleus.store.ObjectProvider sm,
int startAt,
boolean atEnd,
Collection elements,
int size)
Internal method for adding an item to the List. |
protected int |
internalIndexOf(org.datanucleus.store.ObjectProvider op,
Object element,
String stmt)
Internal method to find the index of an element. |
protected abstract boolean |
internalRemove(org.datanucleus.store.ObjectProvider op,
Object element,
int size)
Convenience method to remove the specified element from the List. |
protected abstract void |
internalRemoveAt(org.datanucleus.store.ObjectProvider op,
int index,
int size)
Internal method to remove an object at a location from the List. |
protected void |
internalRemoveAt(org.datanucleus.store.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.store.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.store.ObjectProvider sm)
Accessor for an iterator through the list elements. |
int |
lastIndexOf(org.datanucleus.store.ObjectProvider op,
Object element)
Method to retrieve the last index of an object in the list. |
ListIterator |
listIterator(org.datanucleus.store.ObjectProvider sm)
Accessor for an iterator through the list elements. |
protected abstract ListIterator |
listIterator(org.datanucleus.store.ObjectProvider ownerSM,
int startIdx,
int endIdx)
Accessor for an iterator through the list elements. |
Object |
remove(org.datanucleus.store.ObjectProvider op,
int index,
int size)
Method to remove an object at an index in the List. |
boolean |
remove(org.datanucleus.store.ObjectProvider op,
Object element,
int size,
boolean allowDependentField)
Method to remove the specified element from the List. |
boolean |
removeAll(org.datanucleus.store.ObjectProvider op,
Collection elements,
int size)
Remove all elements from a collection from the association owner vs elements. |
List |
subList(org.datanucleus.store.ObjectProvider op,
int startIdx,
int endIdx)
Method to retrieve a list of elements in a range. |
| Methods inherited from class org.datanucleus.store.rdbms.scostore.AbstractCollectionStore |
|---|
contains, containsInternal, getRemoveStmt, getUpdateEmbeddedElementStmt, internalRemove, 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.ListStore |
|---|
set |
| 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 |
| Field Detail |
|---|
protected boolean indexedList
protected String indexOfStmt
protected String lastIndexOfStmt
protected String removeAtStmt
protected String shiftStmt
| Constructor Detail |
|---|
protected AbstractListStore(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr)
storeMgr - Manager for the storeclr - ClassLoader resolver| Method Detail |
|---|
public Iterator iterator(org.datanucleus.store.ObjectProvider sm)
iterator in interface org.datanucleus.store.scostore.CollectionStoreiterator in class ElementContainerStoresm - State Manager for the container.
public ListIterator listIterator(org.datanucleus.store.ObjectProvider sm)
listIterator in interface org.datanucleus.store.scostore.ListStoresm - State Manager for the container.
protected abstract ListIterator listIterator(org.datanucleus.store.ObjectProvider ownerSM,
int startIdx,
int endIdx)
ownerSM - State Manager 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.store.ObjectProvider sm,
Object element,
int size)
add in interface org.datanucleus.store.scostore.CollectionStoresm - The state managerelement - The element to removesize - Size of the current list (if known, -1 if not)
public void add(org.datanucleus.store.ObjectProvider sm,
Object element,
int index,
int size)
add in interface org.datanucleus.store.scostore.ListStoreelement - The element to add.index - The location to add atsm - The state manager.
public boolean addAll(org.datanucleus.store.ObjectProvider sm,
Collection elements,
int size)
addAll in interface org.datanucleus.store.scostore.CollectionStoresm - The state managerelements - The elements to removesize - Current size of the list (if known). -1 if not known
public boolean addAll(org.datanucleus.store.ObjectProvider sm,
Collection elements,
int index,
int size)
addAll in interface org.datanucleus.store.scostore.ListStoresm - The state managerelements - The collectionindex - The location to add atsize - Current size of the list (if known). -1 if not known
protected abstract boolean internalAdd(org.datanucleus.store.ObjectProvider sm,
int startAt,
boolean atEnd,
Collection elements,
int size)
sm - The state managerstartAt - 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 known
public Object get(org.datanucleus.store.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.store.ObjectProvider op,
Object element)
indexOf in interface org.datanucleus.store.scostore.ListStoreop - ObjectProvider for the ownerelement - The element.
public int lastIndexOf(org.datanucleus.store.ObjectProvider op,
Object element)
lastIndexOf in interface org.datanucleus.store.scostore.ListStoreop - ObjectProvider for the ownerelement - The object
public boolean removeAll(org.datanucleus.store.ObjectProvider op,
Collection elements,
int size)
removeAll in interface org.datanucleus.store.scostore.CollectionStoreop - ObjectProvider for the ownerelements - Collection of elements to remove
public boolean remove(org.datanucleus.store.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 removal
protected abstract boolean internalRemove(org.datanucleus.store.ObjectProvider op,
Object element,
int size)
op - ObjectProvider of the ownerelement - The elementsize - Current size of list if known. -1 if not known
public Object remove(org.datanucleus.store.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 known
protected abstract void internalRemoveAt(org.datanucleus.store.ObjectProvider op,
int index,
int size)
op - ObjectProviderindex - The index of the element to removesize - Current list size (if known). -1 if not known
public List subList(org.datanucleus.store.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.store.ObjectProvider op,
Collection elements)
op - ObjectProviderelements - The elements
protected int internalIndexOf(org.datanucleus.store.ObjectProvider op,
Object element,
String stmt)
op - ObjectProviderelement - The elementstmt - The statement to find the element.
protected void internalRemoveAt(org.datanucleus.store.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 known
protected int[] internalShift(org.datanucleus.store.ObjectProvider op,
org.datanucleus.store.connection.ManagedConnection conn,
boolean batched,
int oldIndex,
int amount,
boolean executeNow)
throws org.datanucleus.store.mapped.exceptions.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)
org.datanucleus.store.mapped.exceptions.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 of
protected 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=?]
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||