public interface Datasource
extends java.lang.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 |
---|---|
java.lang.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,
java.util.Map<java.lang.String,java.lang.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.
|
java.lang.String |
getId()
Returns the unique identifier for this Datasource.
|
java.util.Collection |
getResult()
Deprecated.
Use
getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
java.util.Collection<Resolvable> |
getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes)
Get the resolvables from the datasource that match the given datasource
filter (unsorted).
|
java.util.Collection<Resolvable> |
getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns)
Get the resolvables from the datasource that match the given datasource filter.
|
java.util.Collection<Resolvable> |
getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns,
java.util.Map<java.lang.String,java.lang.Object> 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)
Deprecated.
Use
getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
java.util.Collection |
getResult(int start,
int count,
java.lang.String sortBy,
int sortOrder,
java.util.Map specificParameters)
Deprecated.
use
getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
java.util.Collection |
getResult(java.lang.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(java.lang.String attributeName)
Verifies that the given attribute name is valid and exists in the
datasource.
|
void |
setAttributeNames(java.lang.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(java.lang.String[] names)
getResult(DatasourceFilter, String[])
methods.names
- array of attribute namesjava.util.Collection getResult(int start, int count, java.lang.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 availablejava.util.Collection getResult() throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.DatasourceNotAvailableException
- if the datasource is not availablejava.util.Collection getResult(java.lang.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 availablejava.util.Collection getResult(int start, int count, java.lang.String sortBy, int sortOrder, java.util.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()
java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.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 createdjava.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.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)
java.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.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)
java.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.String[] prefillAttributes, int start, int count, Datasource.Sorting[] sortedColumns, java.util.Map<java.lang.String,java.lang.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, java.util.Map<java.lang.String,java.lang.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)
java.lang.String getId()
boolean isValidAttribute(java.lang.String attributeName) throws DatasourceException
attributeName
- the attribute name to checkDatasourceException
- in case of errorsCopyright © 2020 Gentics Software. All Rights Reserved.