|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gentics.api.lib.datasource.AbstractDatasource
public abstract class AbstractDatasource
Abstract basic implementation for datasources. Implementing your own datasources is
not supported right now. When the time has come, one should rather
extend this class than implement the interface Datasource
directly
in order to
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.gentics.api.lib.datasource.Datasource |
---|
Datasource.Sorting |
Field Summary |
---|
Fields inherited from interface com.gentics.api.lib.datasource.Datasource |
---|
SORTORDER_ASC, SORTORDER_DESC, SORTORDER_NONE |
Constructor Summary | |
---|---|
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(java.lang.String id)
|
Method Summary | |
---|---|
java.lang.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 |
java.lang.String |
getId()
Returns the unique identifier for this Datasource. |
java.util.Collection |
getResult()
Deprecated. use getResult(DatasourceFilter, String[]) 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 |
getResult(int start,
int count,
java.lang.String sortBy,
int sortOrder)
Deprecated. use {@link #getResult(DatasourceFilter, String[], int, int, Sorting[]) instead. |
java.util.Collection |
getResult(java.lang.String sortBy,
int sortOrder)
Deprecated. use {@link #getResult(DatasourceFilter, String[], int, int, Sorting[]) instead. |
boolean |
hasChanged(long timestamp)
This default implementation simply always returns true. |
boolean |
isValidAttribute(java.lang.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(java.lang.String id)
Allows to set the id of this datasource. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.gentics.api.lib.datasource.Datasource |
---|
createDatasourceFilter, getCount, getCount2, getHandlePool, getResult, getResult, hasChanged, setAttributeNames, setRuleTree |
Constructor Detail |
---|
public AbstractDatasource(java.lang.String id)
id
- Id for this datasource.public AbstractDatasource()
setId(String)
afterwards - but it is recommended to
use AbstractDatasource(String)
instead.
Method Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Datasource
clone
in interface Datasource
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.util.Collection getResult() throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
instead.
getResult
in interface Datasource
DatasourceNotAvailableException
Datasource.getResult()
public java.util.Collection getResult(int start, int count, java.lang.String sortBy, int sortOrder) throws DatasourceNotAvailableException
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
Datasource.getResult(int, int,
java.lang.String, int)
public java.util.Collection getResult(java.lang.String sortBy, int sortOrder) throws DatasourceNotAvailableException
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
Datasource.getResult(java.lang.String,
int)
public int getCount(DatasourceFilter filter) throws DatasourceException
Datasource
getCount
in interface Datasource
filter
- datasource filter
DatasourceException
Datasource.createDatasourceFilter(Expression)
public java.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.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
Datasource.createDatasourceFilter(Expression)
public java.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.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
Datasource.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 java.lang.String getId()
Datasource
getId
in interface Datasource
public void setId(java.lang.String id)
AbstractDatasource(String)
tough.
id
- the id for this datasource.getId()
public int getCount()
Datasource
getCount
in interface Datasource
public boolean isValidAttribute(java.lang.String attributeName) throws DatasourceException
isValidAttribute
in interface Datasource
attributeName
- the attribute name to check
DatasourceException
Datasource.isValidAttribute(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |