org.datanucleus.store.mapped.scostore
Class JoinListStore
java.lang.Object
org.datanucleus.store.mapped.scostore.BaseContainerStore
org.datanucleus.store.mapped.scostore.ElementContainerStore
org.datanucleus.store.mapped.scostore.AbstractCollectionStore
org.datanucleus.store.mapped.scostore.AbstractListStore
org.datanucleus.store.mapped.scostore.JoinListStore
- All Implemented Interfaces:
- CollectionStore, ListStore, Store
public abstract class JoinListStore
- extends AbstractListStore
Representation of the backing store for a join-table List.
Uses a Join table, so we use 3 tables - owner table, join table and element table.
| Fields inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore |
clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, specialization |
|
Constructor Summary |
JoinListStore(AbstractMemberMetaData fmd,
ClassLoaderResolver clr,
DatastoreContainerObject joinTable,
JavaTypeMapping ownerMapping,
JavaTypeMapping elementMapping,
JavaTypeMapping orderMapping,
JavaTypeMapping relationDiscriminatorMapping,
java.lang.String relationDiscriminatorValue,
boolean elementsAreEmbedded,
boolean elementsAreSerialised,
JoinListStoreSpecialization specialization)
Constructor. |
|
Method Summary |
protected boolean |
internalAdd(ObjectProvider sm,
int start,
boolean atEnd,
java.util.Collection c,
int size)
Internal method to add element(s) to the List. |
protected boolean |
internalRemove(ObjectProvider ownerSM,
java.lang.Object element,
int size)
Convenience method to remove the specified element from the List. |
boolean |
removeAll(ObjectProvider sm,
java.util.Collection elements,
int size)
Remove all elements from a collection from the association owner vs
elements. |
protected void |
removeAt(ObjectProvider sm,
int index,
int size)
Method to remove an element from the specified position |
java.lang.Object |
set(ObjectProvider sm,
int index,
java.lang.Object element,
boolean allowDependentField)
Method to set an object in the List. |
void |
update(ObjectProvider sm,
java.util.Collection coll)
Method to update the collection to be the supplied collection of elements. |
| Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractListStore |
add, add, addAll, addAll, get, getIndicesOf, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, subList |
| Methods inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore |
clear, getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getElementType, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, hasOrderMapping, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JoinListStore
public JoinListStore(AbstractMemberMetaData fmd,
ClassLoaderResolver clr,
DatastoreContainerObject joinTable,
JavaTypeMapping ownerMapping,
JavaTypeMapping elementMapping,
JavaTypeMapping orderMapping,
JavaTypeMapping relationDiscriminatorMapping,
java.lang.String relationDiscriminatorValue,
boolean elementsAreEmbedded,
boolean elementsAreSerialised,
JoinListStoreSpecialization specialization)
- Constructor.
- Parameters:
clr - ClassLoader resolver
internalAdd
protected boolean internalAdd(ObjectProvider sm,
int start,
boolean atEnd,
java.util.Collection c,
int size)
- Internal method to add element(s) to the List.
Performs the add in 2 steps.
- Shift all existing elements into their new positions so we can insert.
- Insert all new elements directly at their desired positions>/li>
Both steps can be batched (separately).
- Specified by:
internalAdd in class AbstractListStore
- Parameters:
sm - The state managerstart - 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 known
- Returns:
- Whether it was successful
set
public java.lang.Object set(ObjectProvider sm,
int index,
java.lang.Object element,
boolean allowDependentField)
- Method to set an object in the List.
- Parameters:
sm - The state managerindex - The item indexelement - What to set it to.allowDependentField - Whether to allow dependent field deletes
- Returns:
- The value before setting.
update
public void update(ObjectProvider sm,
java.util.Collection coll)
- Method to update the collection to be the supplied collection of elements.
- Specified by:
update in interface CollectionStore- Overrides:
update in class AbstractCollectionStore
- Parameters:
sm - StateManager of the objectcoll - The collection to use
internalRemove
protected boolean internalRemove(ObjectProvider ownerSM,
java.lang.Object element,
int size)
- Convenience method to remove the specified element from the List.
- Specified by:
internalRemove in class AbstractListStore
- Parameters:
element - The elementownerSM - StateManager of the ownersize - Current size of list if known. -1 if not known
- Returns:
- Whether the List was modified
removeAll
public boolean removeAll(ObjectProvider sm,
java.util.Collection elements,
int size)
- Remove all elements from a collection from the association owner vs
elements. Performs the removal in 3 steps. The first gets the indices
that will be removed (and the highest index present). The second step
removes these elements from the list. The third step updates the indices
of the remaining indices to fill the holes created.
- Specified by:
removeAll in interface CollectionStore- Overrides:
removeAll in class AbstractListStore
- Parameters:
sm - State Manager for the containerelements - Collection of elements to removesize - Current size of collection if known. -1 if not known
- Returns:
- Whether the database was updated
removeAt
protected void removeAt(ObjectProvider sm,
int index,
int size)
- Method to remove an element from the specified position
- Specified by:
removeAt in class AbstractListStore
- Parameters:
sm - The State Manager for the listindex - The index of the elementsize - Current size of list (if known). -1 if not known
Copyright © 2011. All Rights Reserved.