public abstract class AbstractDatasource extends Object implements Datasource
Datasource
directly
in order to
Datasource.Sorting
SORTORDER_ASC, SORTORDER_DESC, SORTORDER_NONE
Constructor and Description |
---|
AbstractDatasource()
If you use this super constructor as implementor, you should always
call
setId(String) afterwards - but it is recommended to
use AbstractDatasource(String) instead. |
AbstractDatasource(String id) |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clone the datasource (that means to create a copy that would
work excactly like this datasource)
|
int |
getCount()
Get the number of rows matching the given rule.
|
int |
getCount(DatasourceFilter filter)
Get the number of objects in the datasource that match the given filter
|
String |
getId()
Returns the unique identifier for this Datasource.
|
Collection |
getResult()
Deprecated.
use
getResult(DatasourceFilter, String[]) instead. |
Collection<Resolvable> |
getResult(DatasourceFilter filter,
String[] prefillAttributes)
Get the resolvables from the datasource that match the given datasource
filter (unsorted).
|
Collection<Resolvable> |
getResult(DatasourceFilter filter,
String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns)
Get the resolvables from the datasource that match the given datasource filter.
|
Collection |
getResult(int start,
int count,
String sortBy,
int sortOrder)
Deprecated.
|
Collection |
getResult(String sortBy,
int sortOrder)
Deprecated.
|
boolean |
hasChanged(long timestamp)
This default implementation simply always returns true.
|
boolean |
isValidAttribute(String attributeName)
This default implementation will always return null because
there is no generic way of determine if an attribute name is valid.
|
void |
setId(String id)
Allows to set the id of this datasource.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDatasourceFilter, getCount, getCount2, getHandlePool, getResult, getResult, hasChanged, setAttributeNames, setRuleTree
public AbstractDatasource(String id)
id
- Id for this datasource.public AbstractDatasource()
setId(String)
afterwards - but it is recommended to
use AbstractDatasource(String)
instead.public Object clone() throws CloneNotSupportedException
Datasource
clone
in interface Datasource
clone
in class Object
CloneNotSupportedException
- if cloning is not possiblepublic Collection getResult() throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
instead.getResult
in interface Datasource
DatasourceNotAvailableException
- if the datasource is not availableDatasource.getResult()
public Collection getResult(int start, int count, String sortBy, int sortOrder) throws DatasourceNotAvailableException
Datasource.getResult(DatasourceFilter, String[], int, int, Sorting[])
instead.Datasource
getResult
in interface Datasource
start
- 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_NONE
DatasourceNotAvailableException
- if the datasource is not availableDatasource.getResult(int, int,
java.lang.String, int)
public Collection getResult(String sortBy, int sortOrder) throws DatasourceNotAvailableException
Datasource.getResult(DatasourceFilter, String[], int, int, Sorting[])
instead.Datasource
getResult
in interface Datasource
sortBy
- 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_NONE
DatasourceNotAvailableException
- if the datasource is not availableDatasource.getResult(java.lang.String,
int)
public int getCount(DatasourceFilter filter) throws DatasourceException
Datasource
getCount
in interface Datasource
filter
- datasource filterDatasourceException
- in case of errorsDatasource.createDatasourceFilter(Expression)
public Collection<Resolvable> getResult(DatasourceFilter filter, String[] prefillAttributes) throws DatasourceException
Datasource
getResult
in interface Datasource
filter
- datasource filterprefillAttributes
- array of attribute names to prefill (null or empty for no prefilling)DatasourceException
- in case of errorsDatasource.createDatasourceFilter(Expression)
public Collection<Resolvable> getResult(DatasourceFilter filter, String[] prefillAttributes, int start, int count, Datasource.Sorting[] sortedColumns) throws DatasourceException
Datasource
getResult
in interface Datasource
filter
- 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")DatasourceException
- in case of errorsDatasource.createDatasourceFilter(Expression)
public boolean hasChanged(long timestamp)
hasChanged
in interface Datasource
timestamp
- timestamp to check if data has propably changed - timestamp is a java timestamp - ie. milliseconds since 1970 like System.currentTimeMillis()
Datasource.hasChanged(long)
public String getId()
Datasource
getId
in interface Datasource
public void setId(String id)
AbstractDatasource(String)
tough.id
- the id for this datasource.getId()
public int getCount()
Datasource
getCount
in interface Datasource
public boolean isValidAttribute(String attributeName) throws DatasourceException
isValidAttribute
in interface Datasource
attributeName
- the attribute name to checkDatasourceException
- in case of errorsDatasource.isValidAttribute(java.lang.String)
Copyright © 2017 Gentics Software. All Rights Reserved.