|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.store.rdbms.scostore.BaseContainerStore
org.jpox.store.rdbms.scostore.ElementContainerStore
org.jpox.store.rdbms.scostore.AbstractCollectionStore
org.jpox.store.rdbms.scostore.AbstractListStore
org.jpox.store.rdbms.scostore.JoinListStore
Representation of the backing store for a Normal List. Uses a Join table, so we use 3 tables - owner table, join table and element table.
Nested Class Summary |
Nested classes inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore |
ElementContainerStore.ElementInfo |
Field Summary | |
protected java.lang.String |
addStmt
|
protected java.lang.String |
indexOfStmt
|
protected java.lang.String |
lastIndexOfStmt
|
protected java.lang.String |
listName
|
protected java.lang.String |
removeAtStmt
|
protected java.lang.String |
setStmt
|
protected java.lang.String |
shiftStmt
|
Fields inherited from class org.jpox.store.rdbms.scostore.AbstractCollectionStore |
containsStmt |
Fields inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore |
clearStmt, clr, containerTable, dba, elementInfo, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, elmIdentifier, emd, iterateUsingDiscriminator, LOCALISER, orderMapping, ownerFieldMetaData, ownerMapping, relationDiscriminatorMapping, relationDiscriminatorValue, sizeStmt, storeMgr, thisIdentifier |
Constructor Summary | |
JoinListStore(AbstractPropertyMetaData fmd,
CollectionTable joinTable,
ClassLoaderResolver clr)
Constructor. |
Method Summary | |
void |
add(StateManager sm,
int index,
java.lang.Object element)
Method to add an element to the List. |
boolean |
add(StateManager sm,
java.lang.Object element)
Method to add an element to the List. |
boolean |
addAll(StateManager sm,
java.util.Collection elements)
Method to add a collection of elements to the List. |
boolean |
addAll(StateManager sm,
java.util.Collection c,
boolean initialising)
Method to add all elements from a Collection to the List. |
boolean |
addAll(StateManager sm,
int index,
java.util.Collection c)
Method to add all elements from a Collection to the List. |
java.lang.Object |
get(StateManager sm,
int index)
Method to retrieve an element from the List. |
protected java.lang.String |
getIndexOfStmt()
Generate statement for getting the index of an item. |
protected java.lang.String |
getIndicesOfStmt(java.util.Collection elements)
Generates the statement for getting the indices of a collection of element. |
protected QueryExpression |
getIteratorStatement(StateManager ownerSM,
int start_index,
int end_index)
Accessor for the iterator statement to retrieve element(s) in a range from the List. |
protected java.lang.String |
getLastIndexOfStmt()
Generates the statement for getting the index of the last item. |
protected java.lang.String |
getRemoveAtStmt()
Generates the statement for removing an item. |
protected java.lang.String |
getSetStmt()
Generates the statement for setting an item. |
protected java.lang.String |
getShiftStmt()
Generates the statement for shifting items. |
int |
indexOf(StateManager sm,
java.lang.Object element)
Accessor for the indexOf an object in the List. |
protected void |
initialiseStatements()
Method to initialise the statements being used. |
protected boolean |
internalAdd(StateManager sm,
int start,
boolean atEnd,
java.util.Collection c,
boolean initialising)
Internal method to add element(s) to the List. |
protected java.util.List |
internalGetRange(StateManager sm,
int start,
int end)
Utility to retrieve (as a List) the elements for the List in a range depending on the specified start/end positions. |
protected void |
internalRemoveAt(StateManager sm,
int index,
java.lang.String stmt)
Internal method to remove an object at a location in the List. |
java.util.Iterator |
iterator(StateManager sm)
Accessor for an iterator through the list elements. |
ScalarExpression |
joinElementsTo(QueryExpression stmt,
QueryExpression parentStmt,
JavaTypeMapping ownerMapping,
LogicSetExpression ownerTe,
DatastoreIdentifier listRangeVar,
java.lang.Class filteredElementType,
ScalarExpression elmExpr,
DatastoreIdentifier elementRangeVar)
Method used in queries when contains() has been invoked. |
int |
lastIndexOf(StateManager sm,
java.lang.Object element)
Method to retrieve the last index of an object in the list. |
java.util.ListIterator |
listIterator(StateManager sm)
Accessor for an iterator through the list elements. |
java.util.ListIterator |
listIterator(StateManager ownerSM,
int start)
Accessor for an iterator through the list elements. |
QueryExpression |
newQueryStatement(StateManager sm,
java.lang.String candidateClass)
Utility to return a new QueryStatement. |
protected void |
prepareIndicesOfStmt(StateManager sm,
java.sql.PreparedStatement ps,
java.util.Collection elements)
Method to prepare the indicesOf statement for use. |
java.lang.Object |
remove(StateManager sm,
int index)
Method to remove an object at a location in the List. |
boolean |
remove(StateManager sm,
java.lang.Object element)
Method to remove an element from the List. |
boolean |
removeAll(StateManager sm,
java.util.Collection elements)
Remove all elements from a collection from the association owner vs elements. |
protected void |
removeAt(StateManager sm,
int index)
Method to remove an element from the specified position |
java.lang.Object |
set(StateManager sm,
int index,
java.lang.Object element,
boolean allowDependentField)
Method to set an object in the List. |
java.util.List |
subList(StateManager sm,
int start,
int end)
Method to retrieve a list of elements in a range. |
Methods inherited from class org.jpox.store.rdbms.scostore.AbstractCollectionStore |
contains, getContainsStmt, getExistsSubquery, getSizeSubquery, getUpdateEmbeddedElementStmt, updateEmbeddedElement |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jpox.store.scostore.CollectionStore |
clear, contains, getElementType, getExistsSubquery, getSizeSubquery, hasOrderMapping, newResultObjectFactory, size, updateEmbeddedElement |
Methods inherited from interface org.jpox.store.scostore.Store |
getOwnerMapping, getStoreManager |
Field Detail |
protected java.lang.String listName
protected java.lang.String addStmt
protected java.lang.String removeAtStmt
protected java.lang.String setStmt
protected java.lang.String shiftStmt
protected java.lang.String indexOfStmt
protected java.lang.String lastIndexOfStmt
Constructor Detail |
public JoinListStore(AbstractPropertyMetaData fmd, CollectionTable joinTable, ClassLoaderResolver clr)
joinTable
- The join tableclr
- ClassLoader resolverMethod Detail |
protected QueryExpression getIteratorStatement(StateManager ownerSM, int start_index, int end_index)
ownerSM
- The StateManagerstart_index
- The start position in the List.end_index
- The end position in the List.
public QueryExpression newQueryStatement(StateManager sm, java.lang.String candidateClass)
sm
- The state managercandidateClass
- The base class
public ScalarExpression joinElementsTo(QueryExpression stmt, QueryExpression parentStmt, JavaTypeMapping ownerMapping, LogicSetExpression ownerTe, DatastoreIdentifier listRangeVar, java.lang.Class filteredElementType, ScalarExpression elmExpr, DatastoreIdentifier elementRangeVar)
stmt
- The Query StatementparentStmt
- the parent Query Statement. If there is no parent, parentStmt
must be equals to stmt
ownerMapping
- the mapping for the owner.ownerTe
- Table Expression for the ownerlistRangeVar
- The range variable for the "List" table.filteredElementType
- The Class Type for the filtered elementelmExpr
- The Expression for the elementelementRangeVar
- The SQL alias, or "range variable", to assign to the
expression or to the element table.
protected void initialiseStatements()
initialiseStatements
in class AbstractCollectionStore
public java.util.Iterator iterator(StateManager sm)
iterator
in interface CollectionStore
iterator
in class ElementContainerStore
sm
- State Manager for the container.
public java.util.ListIterator listIterator(StateManager sm)
listIterator
in interface ListStore
sm
- State Manager for the container.
public java.util.ListIterator listIterator(StateManager ownerSM, int start)
listIterator
in interface ListStore
ownerSM
- State Manager for the container.start
- The start point in the list.
public boolean add(StateManager sm, java.lang.Object element)
add
in interface CollectionStore
sm
- The state managerelement
- The element to remove
public void add(StateManager sm, int index, java.lang.Object element)
add
in interface ListStore
sm
- The state manager.index
- The location to add atelement
- The element to add.public boolean addAll(StateManager sm, java.util.Collection elements)
addAll
in interface CollectionStore
sm
- The state managerelements
- The elements to remove
public boolean addAll(StateManager sm, int index, java.util.Collection c)
addAll
in interface ListStore
sm
- The state managerindex
- The location to add atc
- The collection
public boolean addAll(StateManager sm, java.util.Collection c, boolean initialising)
addAll
in interface ListStore
sm
- The state managerc
- The collectioninitialising
- Whether we are initialising the list with these elements
public java.lang.Object get(StateManager sm, int index)
get
in interface ListStore
sm
- The state managerindex
- The location of the element.
public int indexOf(StateManager sm, java.lang.Object element)
indexOf
in interface ListStore
sm
- The state managerelement
- The element.
public int lastIndexOf(StateManager sm, java.lang.Object element)
lastIndexOf
in interface ListStore
sm
- The state manager.element
- The object
public boolean remove(StateManager sm, java.lang.Object element)
remove
in interface CollectionStore
sm
- The state managerelement
- The element to remove.
public boolean removeAll(StateManager sm, java.util.Collection elements)
removeAll
in interface CollectionStore
sm
- State Manager for the containerelements
- Collection of elements to remove
public java.lang.Object remove(StateManager sm, int index)
remove
in interface ListStore
sm
- The state manager.index
- The location
public java.lang.Object set(StateManager sm, int index, java.lang.Object element, boolean allowDependentField)
set
in interface ListStore
sm
- The state managerindex
- The item indexelement
- What to set it to.allowDependentField
- Whether to allow dependent field deletes
public java.util.List subList(StateManager sm, int start, int end)
subList
in interface ListStore
sm
- The state manager.start
- From index (inclusive)end
- To index (exclusive)
protected java.lang.String getIndexOfStmt()
SELECT INDEXCOL FROM LISTTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...] [AND DISTINGUISHER=?] ORDER BY INDEXCOL
protected java.lang.String getLastIndexOfStmt()
SELECT INDEXCOL FROM LISTTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...] [AND DISTINGUISHER=?] ORDER BY INDEXCOL DESC
protected java.lang.String getRemoveAtStmt()
DELETE FROM LISTTABLE WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
protected java.lang.String getSetStmt()
UPDATE LISTTABLE SET [ELEMENTCOL = ?] [EMBEDDEDFIELD1=?, EMBEDDEDFIELD2=?, ...] WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
protected java.lang.String getShiftStmt()
UPDATE LISTTABLE SET ELEMENTCOL = ? WHERE OWNERCOL = ? AND INDEXCOL = ? [AND DISTINGUISHER=?]
protected java.lang.String getIndicesOfStmt(java.util.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 void prepareIndicesOfStmt(StateManager sm, java.sql.PreparedStatement ps, java.util.Collection elements)
sm
- State Manager of the container.ps
- The Prepared Statementelements
- Collection of elementsprotected void removeAt(StateManager sm, int index)
sm
- The State Manager for the listindex
- The index of the elementprotected void internalRemoveAt(StateManager sm, int index, java.lang.String stmt)
sm
- The state manager.index
- The locationstmt
- The statement to remove the element from the Listprotected boolean internalAdd(StateManager sm, int start, boolean atEnd, java.util.Collection c, boolean initialising)
sm
- The state managerstart
- The start location (if required)atEnd
- Whether to add the element at the endc
- The collection of objects to add.initialising
- Whether we are initialising the list with these elements
protected java.util.List internalGetRange(StateManager sm, int start, int end)
sm
- State Manager for the containerstart
- Start position in the List.end
- End position in the List.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |