|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The DataCollection interface defines the public methods available on a
collection of DataObjects. DataCollections can be used to efficiently
iterate over a large set of DataObjects and access the values of their
properties. A DataCollection has much of the functionality of a
DataQuery
, and can be filtered or sorted
in the same way. A typical usage of a DataCollection is:
Session ssn = SessionManager.getSession(); DataCollection employees = ssn.retrieve("com.dotcom.Employee"); employees.setFilter("name like '%nut'"); employees.setOrder("name"); while (employees.next()) { System.out.println("ID: " + employees.get("id"), "Name: " + employees.get("id")); }A DataCollection can also be used to fetch complete DataObjects as opposed to simply accessing the property values of those DataObjects. This means of access is less efficient than that described above because a Java object must be instantiated for every DataObject in the DataCollection.
Session ssn = SessionManager.getSession(); DataCollection employees = ssn.retrieve("com.dotcom.Employee"); employees.addFilter("name like '%nut'"); employees.addOrder("name"); while (employees.next()) { DataObject emp = employees.getDataObject(); System.out.println(emp); }
SessionManager
,
Session
,
DataObject
,
DataQuery
Field Summary | |
static String |
versionId
|
Method Summary | |
boolean |
contains(DataObject data)
Tests whether the current collection contains an object. |
boolean |
contains(OID oid)
Tests whether the current collection contains an object. |
DataObject |
getDataObject()
Returns a data object for the current position in the collection. |
ObjectType |
getObjectType()
Returns the object type of the data collection. |
Object |
getParameter(String parameterName)
Allows a caller to get a parameter value for a parameter that has already been set |
void |
setParameter(String parameterName,
Object value)
Allows a user to bind a parameter within a named query. |
Methods inherited from interface com.arsdigita.persistence.DataQuery |
addEqualsFilter, addFilter, addFilter, addInSubqueryFilter, addInSubqueryFilter, addNotEqualsFilter, addNotInSubqueryFilter, addOrder, addOrderWithNull, addPath, alias, clearFilter, clearOrder, close, first, get, getFilterFactory, getPosition, getPropertyValues, getType, hasProperty, isAfterLast, isBeforeFirst, isEmpty, isFirst, isLast, last, next, previous, removeFilter, reset, rewind, setFilter, setOrder, setRange, setRange, setReturnsLowerBound, setReturnsUpperBound, size |
Field Detail |
public static final String versionId
Method Detail |
public DataObject getDataObject()
public ObjectType getObjectType()
public void setParameter(String parameterName, Object value)
setParameter
in interface DataQuery
parameterName
- The name of the parameter to bindvalue
- The value to assign to the parameterpublic Object getParameter(String parameterName)
getParameter
in interface DataQuery
parameterName
- The name of the parameter to retrieve
public boolean contains(OID oid)
oid
- The oid of the object.
public boolean contains(DataObject data)
data
- The dataobject.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |