|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is used to represent the relationship between two objects.
It is important to note that when the deprecated methods in this class are removed, this class will no longer extend DataCollection. If you want something that extends DataCollection, use DataAssociationCursor instead.
Field Summary | |
static String |
versionId
|
Method Summary | |
DataObject |
add(DataObject object)
Adds object to the persistent association. |
Filter |
addFilter(String conditions)
Deprecated. use cursor() .addFilter(String conditions) |
void |
addOrder(String order)
Deprecated. use cursor() .addOrder(String order) |
void |
clear()
Removes all the objects in the persistent association. |
void |
clearFilter()
Deprecated. use cursor() .clearFilter() |
void |
clearOrder()
Deprecated. use cursor() .clearOrder() |
void |
close()
Deprecated. use cursor() .close() |
DataAssociationCursor |
cursor()
Returns a data association iterator that allows users to iterate through all of the data associations This is a convenience method for getDataAssociationCursor() |
boolean |
first()
Deprecated. use cursor() .first() |
Object |
get(String propertyName)
Deprecated. use cursor() .get() |
DataAssociationCursor |
getDataAssociationCursor()
Returns a data association iterator that allows users to iterate through all of the data associations |
DataCollection |
getDataCollection()
Returns a data collection containing all the objects in this association. |
DataObject |
getDataObject()
Deprecated. use cursor() .getDataObject() |
Object |
getLinkProperty(String name)
Deprecated. Use cursor() .getLinkProperty |
ObjectType |
getObjectType()
Deprecated. use cursor() .getObjectType() |
Object |
getParameter(String parameterName)
Deprecated. use cursor() .getParameter(String parameterName) |
int |
getPosition()
Deprecated. use cursor() .getPosition() |
boolean |
isEmpty()
Deprecated. use cursor() .isEmpty() |
boolean |
isFirst()
Deprecated. use cursor() .isFirst() |
boolean |
isLast()
Deprecated. use cursor() .isLast() |
boolean |
isModified()
Returns true if the collection has been modified. |
boolean |
last()
Deprecated. use cursor() .last() |
boolean |
next()
Deprecated. use cursor() .next() |
boolean |
previous()
Deprecated. use cursor() .previous() |
void |
remove()
Deprecated. Use remove(DataObject object) or
cursor() , loop through the object
and then call remove() |
void |
remove(DataObject object)
Removes object from the collection. |
void |
remove(OID oid)
Removes object from the collection. |
void |
reset()
Deprecated. use cursor() .reset() |
void |
rewind()
Deprecated. use cursor() .rewind() |
Filter |
setFilter(String conditions)
Deprecated. see #addFilter |
void |
setOrder(String order)
Deprecated. see #addOrder |
void |
setParameter(String parameterName,
Object value)
Deprecated. use cursor() .setParameter(Strin
parameterName, Object value)} |
long |
size()
Deprecated. use cursor() .size() |
Methods inherited from interface com.arsdigita.persistence.DataCollection |
contains, contains |
Methods inherited from interface com.arsdigita.persistence.DataQuery |
addEqualsFilter, addFilter, addInSubqueryFilter, addInSubqueryFilter, addNotEqualsFilter, addNotInSubqueryFilter, addOrderWithNull, addPath, alias, getFilterFactory, getPropertyValues, getType, hasProperty, isAfterLast, isBeforeFirst, removeFilter, setRange, setRange, setReturnsLowerBound, setReturnsUpperBound |
Field Detail |
public static final String versionId
Method Detail |
public DataObject add(DataObject object)
object
- The object to add.public void clear()
public DataCollection getDataCollection()
public DataAssociationCursor getDataAssociationCursor()
public DataAssociationCursor cursor()
public Object getLinkProperty(String name)
cursor()
.getLinkProperty
name
- The name of the link property.
public void remove()
remove(DataObject object)
or
cursor()
, loop through the object
and then call remove()
public void remove(DataObject object)
object
- The object to remove.public void remove(OID oid)
oid
- The OID of the object to remove.public boolean isModified()
public void rewind()
cursor()
.rewind()
rewind
in interface DataQuery
public void reset()
cursor()
.reset()
reset
in interface DataQuery
public boolean first() throws PersistenceException
cursor()
.first()
first
in interface DataQuery
PersistenceException
- Always thrown!public Object get(String propertyName) throws PersistenceException
cursor()
.get()
get
in interface DataQuery
propertyName
- the name of the property
PersistenceException
public int getPosition() throws PersistenceException
cursor()
.getPosition()
getPosition
in interface DataQuery
PersistenceException
public boolean isEmpty() throws PersistenceException
cursor()
.isEmpty()
isEmpty
in interface DataQuery
PersistenceException
public boolean isFirst() throws PersistenceException
cursor()
.isFirst()
isFirst
in interface DataQuery
PersistenceException
public boolean isLast() throws PersistenceException
cursor()
.isLast()
If the query has not yet been executed, it executes the query.
isLast
in interface DataQuery
PersistenceException
public boolean last() throws PersistenceException
cursor()
.last()
last
in interface DataQuery
PersistenceException
- Always thrown!public boolean next() throws PersistenceException
cursor()
.next()
next
in interface DataQuery
PersistenceException
public boolean previous() throws PersistenceException
cursor()
.previous()
previous
in interface DataQuery
PersistenceException
- Always thrown!public Filter setFilter(String conditions)
Filter f = query.setFilter("id < :maxId and id > :minId"); f.set("maxId", 10); f.set("minId", 1);
setFilter
in interface DataQuery
conditions
- the conditions for the filter
public Filter addFilter(String conditions)
cursor()
.addFilter(String conditions)
Filter filter = query.addFilter("priority < :bound");
filter.set("bound", new Integer(3));
filter = query.addFilter("priority < :bound");
filter.set("bound", new Integer(8));
The above actually evaluates to
"priority < 3 and priority > 3"
which is clearly now what the developer wants.
The following will work.
Filter filter = query.addFilter("priority < :lowerBound");
filter.set("lowerBound", new Integer(3));
filter = query.addFilter("priority < :upperBound");
filter.set("upperBound", new Integer(8));
It is actually the same as
Filter filter = query.addFilter("priority < :lowerBound
and priority > :uperBound");
filter.set("upperBound", new Integer(8));
filter.set("lowerBound", new Integer(3));
addFilter
in interface DataQuery
conditions
- The conditions for the filter. This is a string
that should represent part of a SQL "where" clause. Specifically,
it should normally take the form of
<column_name> <condition> <attribute bind variable>
where the "condition" is something like "=", "<", ">", or
"!=". The "bind variable" should be a colon followed by
some attribute name that will later be set with a call to
Filter.set(java.lang.String,
java.lang.Object)
It is possible to set multiple conditions with a single addFilter statement by combining the conditions with an "and" or an "or". Conditions may be grouped by using parentheses. Consecutive calls to addFilter append the filters using "and".
If there is already a filter that exists for this query
then the passed in conditions are added to the current
conditions with an AND like (<current conditions>)
and (< passed in conditions>)
public void clearFilter()
cursor()
.clearFilter()
clearFilter
in interface DataQuery
public void setOrder(String order) throws PersistenceException
query.setOrder("creationDate desc, id");
setOrder
in interface DataQuery
PersistenceException
public void addOrder(String order) throws PersistenceException
cursor()
.addOrder(String order)
query.addOrder("creationDate desc, id");
addOrder
in interface DataQuery
order
- This String parameter specifies the ordering of the
output. This should be a comma seperated list
of Attribute names (not the database column names)
in the order of precedence.
Separating attributes by commas is the same as
calling addOrder multiple times, each with the
next attribute. For instance, this
addOrder("creationDate");
addOrder("creationUser");
is the same as
addOrder("creationDate, creationUser");
If the items should be ordered in ascending order, the attribute name should be followed by the word "asc" If the items should be ordered in descending order, the attribute should be followed by the word "desc" For instance, or order by ascending date and descending user (for users created with the same date), you would use the following:
addOrder("creationDate asc, creationUser desc");
PersistenceException
public void clearOrder()
cursor()
.clearOrder()
clearOrder
in interface DataQuery
public long size() throws PersistenceException
cursor()
.size()
size
in interface DataQuery
PersistenceException
public void setParameter(String parameterName, Object value)
cursor()
.setParameter(Strin
parameterName, Object value)}
setParameter
in interface DataCollection
parameterName
- The name of the parameter to bindvalue
- The value to assign to the parameterpublic Object getParameter(String parameterName)
cursor()
.getParameter(String parameterName)
getParameter
in interface DataCollection
parameterName
- The name of the parameter to retrieve
public void close()
cursor()
.close()
close
in interface DataQuery
public DataObject getDataObject()
cursor()
.getDataObject()
getDataObject
in interface DataCollection
public ObjectType getObjectType()
cursor()
.getObjectType()
getObjectType
in interface DataCollection
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |