|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gentics.api.lib.datasource.AbstractDatasource
com.gentics.api.lib.datasource.ResolvableDatasource
public class ResolvableDatasource
Simple Implementation of a Datasource that is based on a given
Collection of
Resolvable objects. The class itself
implements also the interface Collection and serves as
wrapper for the underlying Collection of objects.
As Datasource this class supports filtering with RuleTrees, sorting and paging.
| Nested Class Summary | |
|---|---|
protected class |
ResolvableDatasource.Sorter
Comparator class for sorting Resolvables TODO unify this (use the generic Comparator for resolvables) |
| Nested classes/interfaces inherited from interface com.gentics.api.lib.datasource.Datasource |
|---|
Datasource.Sorting |
| Field Summary | |
|---|---|
protected org.apache.log4j.Logger |
logger
logger object |
| Fields inherited from interface com.gentics.api.lib.datasource.Datasource |
|---|
SORTORDER_ASC, SORTORDER_DESC, SORTORDER_NONE |
| Constructor Summary | |
|---|---|
ResolvableDatasource()
Create an empty instance of the ResolvableDatasource |
|
ResolvableDatasource(java.util.Collection rows)
Create an instance of the ResolvableDatasource that holds the objects given in the collection |
|
| Method Summary | |
|---|---|
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
void |
clear()
|
java.lang.Object |
clone()
Clone the datasource (that means to create a copy that would work excactly like this datasource) |
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
DatasourceFilter |
createDatasourceFilter(Expression expression)
Create a datasource filter for the given expression. |
protected com.gentics.lib.datasource.ResolvableDatasourceFilter |
getAsResolvableDatasourceFilter(DatasourceFilter filter)
Get the datasource filter as resolvable datasource filter |
int |
getCount(DatasourceFilter filter,
java.util.Map specificParameters)
Get the number of objects in the datasource that match the given filter |
int |
getCount2()
Get the number of rows matching the given rule. |
HandlePool |
getHandlePool()
Get the handlepool used by this Datasource. |
java.util.Collection |
getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns,
java.util.Map specificParameters)
Get the resolvables from the datasource that match the given datasource filter. |
java.util.Collection |
getResult(int start,
int count,
java.lang.String sortBy,
int sortOrder,
java.util.Map specificParameters)
Returns data fetched from the Datasource using the given RuleTree as filter. |
boolean |
hasChanged()
Return true when data in the underlying storage layer might have changed since the last invocation of Datasource.getResult() (or any of it's
variants). |
boolean |
hasChanged(long timestamp)
This default implementation simply always returns true. |
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
retainAll(java.util.Collection c)
|
void |
setAttributeNames(java.lang.String[] names)
Defines Attribute to select or store. |
void |
setRuleTree(RuleTree ruleTree)
Set the RuleTree to be used as filter when data is retrieved from this datasource. |
int |
size()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
| Methods inherited from class com.gentics.api.lib.datasource.AbstractDatasource |
|---|
getCount, getCount, getId, getResult, getResult, getResult, getResult, getResult, isValidAttribute, setId |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Field Detail |
|---|
protected org.apache.log4j.Logger logger
| Constructor Detail |
|---|
public ResolvableDatasource()
public ResolvableDatasource(java.util.Collection rows)
rows - collection of Resolvable objects| Method Detail |
|---|
public void setRuleTree(RuleTree ruleTree)
Datasource
setRuleTree in interface DatasourceruleTree - filter RuleTreeDatasource.getResult(DatasourceFilter, String[]),
Datasource.createDatasourceFilter(Expression)public void setAttributeNames(java.lang.String[] names)
Datasource
setAttributeNames in interface Datasourcenames - array of attribute names
public java.util.Collection getResult(int start,
int count,
java.lang.String sortBy,
int sortOrder,
java.util.Map specificParameters)
throws DatasourceNotAvailableException
Datasource
getResult in interface Datasourcestart - index of the first object to get after the filter and sorting have been
applied (counting starts with 0)count - maximum number of objects to return, -1 for no limitsortBy - property to sortby, null for unsorted result. May also
contain a comma separated list of attribute namessortOrder - sort order, use one of Datasource.SORTORDER_ASC,
Datasource.SORTORDER_DESC
Datasource.SORTORDER_NONEspecificParameters - map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)
DatasourceNotAvailableException
public int getCount2()
throws DatasourceNotAvailableException
Datasource
getCount2 in interface DatasourceDatasourceNotAvailableExceptionpublic HandlePool getHandlePool()
Datasource
getHandlePool in interface Datasource
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
Datasource
clone in interface Datasourceclone in class AbstractDatasourcejava.lang.CloneNotSupportedExceptionpublic boolean hasChanged()
DatasourceDatasource.getResult() (or any of it's
variants). The specific implementations can simply return true when a
change cannot be determined other than refetching the data or can do any
specific checks for modified data.
hasChanged in interface Datasourcepublic boolean hasChanged(long timestamp)
AbstractDatasource
hasChanged in interface DatasourcehasChanged in class AbstractDatasourcetimestamp - timestamp to check if data has propably changed - timestamp is a java timestamp - ie. milliseconds since 1970 like System.currentTimeMillis()
Datasource.hasChanged(long)public int size()
size in interface java.util.Collectionpublic void clear()
clear in interface java.util.Collectionpublic boolean isEmpty()
isEmpty in interface java.util.Collectionpublic java.lang.Object[] toArray()
toArray in interface java.util.Collectionpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectionpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.Collectionpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.Collectionpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.Collectionpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.Collectionpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectionpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.Collection
public DatasourceFilter createDatasourceFilter(Expression expression)
throws ExpressionParserException
Datasource
createDatasourceFilter in interface Datasourceexpression - expression to transform into a datasource filter
ExpressionParserException - When the DatasourceFilter can't be created
public java.util.Collection getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns,
java.util.Map specificParameters)
throws DatasourceException
Datasource
getResult in interface Datasourcefilter - datasource filterprefillAttributes - array of attribute names to prefill (null or empty for no prefilling)start - index of the first object to returncount - maximum number of objects to return (-1 for all objects).sortedColumns - possible sorting (may be null for "no sorting")specificParameters - map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)
DatasourceExceptionDatasource.createDatasourceFilter(Expression)
public int getCount(DatasourceFilter filter,
java.util.Map specificParameters)
throws DatasourceException
Datasource
getCount in interface Datasourcefilter - datasource filterspecificParameters - map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)
DatasourceExceptionDatasource.createDatasourceFilter(Expression)
protected com.gentics.lib.datasource.ResolvableDatasourceFilter getAsResolvableDatasourceFilter(DatasourceFilter filter)
throws DatasourceException
filter - filter
DatasourceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||