public interface Datasource extends Cloneable
AbstractDatasource
instead.Modifier and Type | Interface and Description |
---|---|
static class |
Datasource.Sorting
Inner class for definition of sorting
|
Modifier and Type | Field and Description |
---|---|
static int |
SORTORDER_ASC
Constant for the sortorder "ASCENDING"
|
static int |
SORTORDER_DESC
Constant for the sortorder "DESCENDING"
|
static int |
SORTORDER_NONE
Constant for the sortorder "NONE" (ie.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clone the datasource (that means to create a copy that would
work excactly like this datasource)
|
DatasourceFilter |
createDatasourceFilter(Expression expression)
Create a datasource filter for the given expression.
|
int |
getCount()
Deprecated.
use
getCount(DatasourceFilter) instead. |
int |
getCount(DatasourceFilter filter)
Get the number of objects in the datasource that match the given filter
|
int |
getCount(DatasourceFilter filter,
Map<String,Object> specificParameters)
Get the number of objects in the datasource that match the given filter
|
int |
getCount2()
Deprecated.
use
getCount(DatasourceFilter) instead. |
HandlePool |
getHandlePool()
Get the handlepool used by this Datasource.
|
String |
getId()
Returns the unique identifier for this Datasource.
|
Collection |
getResult()
Deprecated.
Use
getResult(DatasourceFilter, String[]) methods with DatasourceFilter 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<Resolvable> |
getResult(DatasourceFilter filter,
String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns,
Map<String,Object> specificParameters)
Get the resolvables from the datasource that match the given datasource filter.
|
Collection |
getResult(int start,
int count,
String sortBy,
int sortOrder)
Deprecated.
Use
getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
Collection |
getResult(int start,
int count,
String sortBy,
int sortOrder,
Map specificParameters)
Deprecated.
use
getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
Collection |
getResult(String sortBy,
int sortOrder)
Deprecated.
Use
getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
boolean |
hasChanged()
Deprecated.
deprecated since a datasource should be stateless, use
hasChanged(long) instead. |
boolean |
hasChanged(long timestamp)
Returns true when the data in the underlying storage layer might
have changed since the given timestamp.
|
boolean |
isValidAttribute(String attributeName)
Verifies that the given attribute name is valid and exists in the
datasource.
|
void |
setAttributeNames(String[] names)
Deprecated.
Prefill Attributes can be given in
getResult(DatasourceFilter, String[]) methods. |
void |
setRuleTree(RuleTree ruleTree)
Deprecated.
RuleTree is deprecated, use
Expression and DatasourceFilter instead. |
static final int SORTORDER_NONE
static final int SORTORDER_ASC
static final int SORTORDER_DESC
void setRuleTree(RuleTree ruleTree)
ruleTree
- filter RuleTreegetResult(DatasourceFilter, String[])
,
createDatasourceFilter(Expression)
void setAttributeNames(String[] names)
getResult(DatasourceFilter, String[])
methods.names
- array of attribute namesCollection getResult(int start, int count, String sortBy, int sortOrder) throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.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 SORTORDER_ASC
,
SORTORDER_DESC
SORTORDER_NONE
DatasourceNotAvailableException
- if the datasource is not availableCollection getResult() throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.DatasourceNotAvailableException
- if the datasource is not availableCollection getResult(String sortBy, int sortOrder) throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.sortBy
- property to sortby, null for unsorted result. May also
contain a comma separated list of attribute namessortOrder
- sort order, use one of SORTORDER_ASC
,
SORTORDER_DESC
SORTORDER_NONE
DatasourceNotAvailableException
- if the datasource is not availableCollection getResult(int start, int count, String sortBy, int sortOrder, Map specificParameters) throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.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 SORTORDER_ASC
,
SORTORDER_DESC
SORTORDER_NONE
specificParameters
- map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)DatasourceNotAvailableException
- if the datasource is not availableint getCount()
getCount(DatasourceFilter)
instead.int getCount2() throws DatasourceNotAvailableException
getCount(DatasourceFilter)
instead.DatasourceNotAvailableException
- if the datasource is not availableHandlePool getHandlePool()
Object clone() throws CloneNotSupportedException
CloneNotSupportedException
- if cloning is not possibleboolean hasChanged()
hasChanged(long)
instead.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.boolean hasChanged(long timestamp)
timestamp
- timestamp to check if data has propably changed - timestamp is a java timestamp - ie. milliseconds since 1970 like System.currentTimeMillis()
DatasourceFilter createDatasourceFilter(Expression expression) throws ExpressionParserException
expression
- expression to transform into a datasource filterExpressionParserException
- When the DatasourceFilter can't be createdCollection<Resolvable> getResult(DatasourceFilter filter, String[] prefillAttributes) throws DatasourceException
filter
- datasource filterprefillAttributes
- array of attribute names to prefill (null or empty for no prefilling)DatasourceException
- in case of errorscreateDatasourceFilter(Expression)
Collection<Resolvable> getResult(DatasourceFilter filter, String[] prefillAttributes, int start, int count, Datasource.Sorting[] sortedColumns) throws DatasourceException
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 errorscreateDatasourceFilter(Expression)
Collection<Resolvable> getResult(DatasourceFilter filter, String[] prefillAttributes, int start, int count, Datasource.Sorting[] sortedColumns, Map<String,Object> specificParameters) throws DatasourceException
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")specificParameters
- map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)DatasourceException
- in case of errorscreateDatasourceFilter(Expression)
int getCount(DatasourceFilter filter) throws DatasourceException
filter
- datasource filterDatasourceException
- in case of errorscreateDatasourceFilter(Expression)
int getCount(DatasourceFilter filter, Map<String,Object> specificParameters) throws DatasourceException
filter
- datasource filterspecificParameters
- map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)DatasourceException
- in case of errorscreateDatasourceFilter(Expression)
String getId()
boolean isValidAttribute(String attributeName) throws DatasourceException
attributeName
- the attribute name to checkDatasourceException
- in case of errorsCopyright © 2017 Gentics Software. All Rights Reserved.