public class JoinListStore<E> extends AbstractListStore<E>
ListStore
using join table.indexedList, indexOfStmt, lastIndexOfStmt, removeAtStmt, shiftStmt
containsStmt
addStmt, clearStmt, containerTable, elementCmd, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr
Constructor and Description |
---|
JoinListStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
CollectionTable joinTable,
org.datanucleus.ClassLoaderResolver clr)
Constructor for a join list store for RDBMS.
|
Modifier and Type | Method and Description |
---|---|
ElementIteratorStatement |
getIteratorStatement(org.datanucleus.ExecutionContext ec,
org.datanucleus.FetchPlan fp,
boolean addRestrictionOnOwner,
int startIdx,
int endIdx)
Method to return the SQLStatement and mapping for an iterator for this backing store.
|
protected String |
getRemoveAllStmt(Collection elements)
Generate statement for removing a collection of items from the List.
|
protected String |
getSetStmt()
Generates the statement for setting an item.
|
protected boolean |
internalAdd(org.datanucleus.state.ObjectProvider op,
int start,
boolean atEnd,
Collection<E> c,
int size)
Internal method to add element(s) to the List.
|
protected boolean |
internalRemove(org.datanucleus.state.ObjectProvider ownerOP,
Object element,
int size)
Convenience method to remove the specified element from the List.
|
protected void |
internalRemoveAt(org.datanucleus.state.ObjectProvider op,
int index,
int size)
Method to remove an element from the specified position
|
protected ListIterator<E> |
listIterator(org.datanucleus.state.ObjectProvider ownerOP,
int startIdx,
int endIdx)
Accessor for an iterator through the list elements.
|
boolean |
removeAll(org.datanucleus.state.ObjectProvider op,
Collection elements,
int size)
Remove all elements from a collection from the association owner vs
elements.
|
E |
set(org.datanucleus.state.ObjectProvider op,
int index,
Object element,
boolean allowDependentField)
Method to set an object in the List.
|
void |
update(org.datanucleus.state.ObjectProvider op,
Collection coll)
Method to update the collection to be the supplied collection of elements.
|
add, add, addAll, addAll, get, getIndexOfStmt, getIndicesOf, getIndicesOfStmt, getLastIndexOfStmt, getRemoveAtStmt, getShiftStmt, indexOf, internalIndexOf, internalRemoveAt, internalShift, iterator, lastIndexOf, listIterator, remove, remove, subList
contains, getRemoveStmt, getUpdateEmbeddedElementStmt, updateEmbeddedElement, updateEmbeddedElement
clear, getAddStmtForJoinTable, getClearStmt, getComponentInfoForElement, getContainerTable, getElementClassMetaData, getElementMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, usingJoinTable, validateElementForReading, validateElementForWriting, validateElementType
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getObjectProviderForEmbeddedPCObject, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStoreManager, isEmbeddedMapping, setOwner
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public JoinListStore(org.datanucleus.metadata.AbstractMemberMetaData mmd, CollectionTable joinTable, org.datanucleus.ClassLoaderResolver clr)
mmd
- Metadata for the member that has the list with join tablejoinTable
- The Join tableclr
- ClassLoader resolverprotected boolean internalAdd(org.datanucleus.state.ObjectProvider op, int start, boolean atEnd, Collection<E> c, int size)
internalAdd
in class AbstractListStore<E>
op
- The ObjectProviderstart
- The start location (if required)atEnd
- Whether to add the element at the endc
- The collection of objects to add.size
- Current size of list if known. -1 if not knownpublic E set(org.datanucleus.state.ObjectProvider op, int index, Object element, boolean allowDependentField)
op
- ObjectProvider for the ownerindex
- The item indexelement
- What to set it to.allowDependentField
- Whether to allow dependent field deletespublic void update(org.datanucleus.state.ObjectProvider op, Collection coll)
update
in interface org.datanucleus.store.types.scostore.CollectionStore<E>
update
in class AbstractCollectionStore<E>
op
- ObjectProvider of the objectcoll
- The collection to useprotected boolean internalRemove(org.datanucleus.state.ObjectProvider ownerOP, Object element, int size)
internalRemove
in class AbstractListStore<E>
element
- The elementownerOP
- ObjectProvider of the ownersize
- Current size of list if known. -1 if not knownpublic boolean removeAll(org.datanucleus.state.ObjectProvider op, Collection elements, int size)
op
- ObjectProviderelements
- Collection of elements to removeprotected void internalRemoveAt(org.datanucleus.state.ObjectProvider op, int index, int size)
internalRemoveAt
in class AbstractListStore<E>
op
- The ObjectProvider for the listindex
- The index of the elementsize
- Current size of list (if known). -1 if not knownprotected ListIterator<E> listIterator(org.datanucleus.state.ObjectProvider ownerOP, int startIdx, int endIdx)
listIterator
in class AbstractListStore<E>
ownerOP
- ObjectProvider for the ownerstartIdx
- The start point in the list (only for indexed lists).endIdx
- End index in the list (only for indexed lists).protected String getSetStmt()
UPDATE LISTTABLE SET [ELEMENTCOL = ?] [EMBEDDEDFIELD1=?, EMBEDDEDFIELD2=?, ...] WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
protected String getRemoveAllStmt(Collection elements)
DELETE FROM LISTTABLE WHERE (OWNERCOL=? AND ELEMENTCOL=?) OR (OWNERCOL=? AND ELEMENTCOL=?) OR (OWNERCOL=? AND ELEMENTCOL=?)
elements
- Collection of elements to removepublic ElementIteratorStatement getIteratorStatement(org.datanucleus.ExecutionContext ec, org.datanucleus.FetchPlan fp, boolean addRestrictionOnOwner, int startIdx, int endIdx)
SELECT ELEM_COLS FROM JOIN_TBL [JOIN ELEM_TBL ON ELEM_TBL.ID = JOIN_TBL.ELEM_ID] [WHERE] [JOIN_TBL.OWNER_ID = {value}] [AND] [JOIN_TBL.DISCRIM = {discrimValue}] [ORDER BY {orderClause}]
ec
- ExecutionContextfp
- FetchPlan to use in determing which fields of element to selectaddRestrictionOnOwner
- Whether to restrict to a particular owner (otherwise functions as bulk fetch for many owners).startIdx
- Start index for the iterator (or -1)endIdx
- End index for the iterator (or -1)Copyright © 2020. All rights reserved.