org.jpox.store.scostore
Interface CollectionStore

All Superinterfaces:
Store
All Known Subinterfaces:
ListStore, SetStore
All Known Implementing Classes:
org.jpox.store.rdbms.scostore.AbstractListStore, org.jpox.store.rdbms.scostore.AbstractSetStore, MapEntrySetStore

public interface CollectionStore
extends Store

Interface representation of the backing store for a Collection.

Version:
$Revision: 1.15 $

Method Summary
 boolean add(StateManager sm, java.lang.Object element)
          Method to add an element to the collection.
 boolean addAll(StateManager sm, java.util.Collection elements)
          Method to add a collection of elements to the collection.
 void clear(StateManager sm)
          Method to clear the collection.
 boolean contains(StateManager sm, java.lang.Object element)
          Method to check if an element exists in the collection.
 java.lang.String getElementType()
          Accessor for the element type in the collection.
 QueryExpression getExistsSubquery(QueryExpression stmt, JavaTypeMapping ownerMapping, LogicSetExpression ownerTe, DatastoreIdentifier collRangeVar)
          Create a subquery for the given query that joins a SetStore element table to the owner table.
 QueryExpression getSizeSubquery(QueryExpression stmt, JavaTypeMapping ownerMapping, LogicSetExpression ownerTe, DatastoreIdentifier collRangeVar)
          Create a subquery for the size of the collection.
 boolean hasOrderMapping()
          Accessor for whether the store utilises an order mapping.
 java.util.Iterator iterator(StateManager sm)
          Accessor for an iterator for the collection.
 ScalarExpression joinElementsTo(QueryExpression stmt, QueryExpression parentStmt, JavaTypeMapping ownerMapping, LogicSetExpression ownerTe, DatastoreIdentifier collRangeVar, java.lang.Class filteredElementType, ScalarExpression elmExpr, DatastoreIdentifier elementRangeVar)
          Method used in queries when contains() has been invoked.
 QueryExpression newQueryStatement(StateManager sm, java.lang.String candidateClass)
          Method to return a new Query Statement containing the candidate class.
 Query.ResultObjectFactory newResultObjectFactory(StateManager sm, QueryExpression stmt, boolean ignoreCache, boolean useFetchPlan)
          Method to return an object factory for processing query statements.
 boolean remove(StateManager sm, java.lang.Object element)
          Method to remove an element from the collection.
 boolean removeAll(StateManager sm, java.util.Collection elements)
          Method to remove a collection of elements from the collection.
 int size(StateManager sm)
          Accessor for the size of the collection.
 boolean updateEmbeddedElement(StateManager sm, java.lang.Object element, int fieldNumber, java.lang.Object value)
          Method to update en embedded element in the collection.
 
Methods inherited from interface org.jpox.store.scostore.Store
getOwnerMapping, getStoreManager
 

Method Detail

getElementType

public java.lang.String getElementType()
Accessor for the element type in the collection.

Returns:
The element type.

hasOrderMapping

public boolean hasOrderMapping()
Accessor for whether the store utilises an order mapping. An order mapping is used to allow for ordering of elements or to allow duplicates.

Returns:
Whether it uses an order mapping.

updateEmbeddedElement

public boolean updateEmbeddedElement(StateManager sm,
                                     java.lang.Object element,
                                     int fieldNumber,
                                     java.lang.Object value)
Method to update en embedded element in the collection.

Parameters:
sm - State Manager of the owner
element - The element
fieldNumber - Field to update in the element
value - The new value for the field
Returns:
Whether the element was modified

iterator

public java.util.Iterator iterator(StateManager sm)
Accessor for an iterator for the collection.

Parameters:
sm - State Manager for the collection.
Returns:
Iterator for the collection.

size

public int size(StateManager sm)
Accessor for the size of the collection.

Parameters:
sm - State Manager for the collection.
Returns:
The size of the collection.

contains

public boolean contains(StateManager sm,
                        java.lang.Object element)
Method to check if an element exists in the collection.

Parameters:
sm - State Manager for the collection.
element - Element to check
Returns:
Whether the element exists in the collection.

add

public boolean add(StateManager sm,
                   java.lang.Object element)
Method to add an element to the collection.

Parameters:
sm - State Manager for the collection.
element - Element to add
Returns:
Whether the element was added ok

addAll

public boolean addAll(StateManager sm,
                      java.util.Collection elements)
Method to add a collection of elements to the collection.

Parameters:
sm - State Manager for the collection.
elements - Elements to add
Returns:
Whether the elements were added ok

remove

public boolean remove(StateManager sm,
                      java.lang.Object element)
Method to remove an element from the collection.

Parameters:
sm - State Manager for the collection.
element - Element to remove
Returns:
Whether the element was removed ok

removeAll

public boolean removeAll(StateManager sm,
                         java.util.Collection elements)
Method to remove a collection of elements from the collection.

Parameters:
sm - State Manager for the collection.
elements - Element to remove
Returns:
Whether the elements were removed ok

clear

public void clear(StateManager sm)
Method to clear the collection.

Parameters:
sm - State Manager for the collection.

newQueryStatement

public QueryExpression newQueryStatement(StateManager sm,
                                         java.lang.String candidateClass)
Method to return a new Query Statement containing the candidate class.

Parameters:
sm - State Manager for the collection.
candidateClass - Class of the elements.
Returns:
The Query Statement.

newResultObjectFactory

public Query.ResultObjectFactory newResultObjectFactory(StateManager sm,
                                                        QueryExpression stmt,
                                                        boolean ignoreCache,
                                                        boolean useFetchPlan)
Method to return an object factory for processing query statements.

Parameters:
sm - State Manager for the collection.
stmt - The Query Statement.
ignoreCache - Whether to ignore the cache.
useFetchPlan - whether to use the fetch plan to retrieve fields in the same query
Returns:
The Persistent object factory.

getExistsSubquery

public QueryExpression getExistsSubquery(QueryExpression stmt,
                                         JavaTypeMapping ownerMapping,
                                         LogicSetExpression ownerTe,
                                         DatastoreIdentifier collRangeVar)
Create a subquery for the given query that joins a SetStore element table to the owner table. This subquery can subsequently be used in an EXISTS expression to determine whether a Collection is empty.

Parameters:
stmt - The Query Statement.
ownerMapping - the mapping for the owner.
ownerTe - Table Expression for the owner
collRangeVar - The range variable for the "Collection" table.
Returns:
A subquery for the given query that joins a SetStore element table to the owner table.

getSizeSubquery

public QueryExpression getSizeSubquery(QueryExpression stmt,
                                       JavaTypeMapping ownerMapping,
                                       LogicSetExpression ownerTe,
                                       DatastoreIdentifier collRangeVar)
Create a subquery for the size of the collection.

Parameters:
stmt - The Query Statement
ownerMapping - Mapping for the owner
ownerTe - Table Expression for the owner
collRangeVar - Range variable for the owner
Returns:
The subquery

joinElementsTo

public ScalarExpression joinElementsTo(QueryExpression stmt,
                                       QueryExpression parentStmt,
                                       JavaTypeMapping ownerMapping,
                                       LogicSetExpression ownerTe,
                                       DatastoreIdentifier collRangeVar,
                                       java.lang.Class filteredElementType,
                                       ScalarExpression elmExpr,
                                       DatastoreIdentifier elementRangeVar)
Method used in queries when contains() has been invoked.

Parameters:
stmt - The Query Statement
parentStmt - 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 owner
collRangeVar - The range variable for the "Collection" table.
filteredElementType - The Class Type for the filtered element
elmExpr - The Expression for the element
elementRangeVar - The SQL alias, or "range variable", to assign to the expression or to the element table.
Returns:
expression to the join


Copyright © -2007 . All Rights Reserved.