Package org.opencms.file.collectors
Class CmsChangedResourceCollector
java.lang.Object
org.opencms.file.collectors.A_CmsResourceCollector
org.opencms.file.collectors.CmsChangedResourceCollector
- All Implemented Interfaces:
Comparable<I_CmsResourceCollector>
,I_CmsCollectorPublishListProvider
,I_CmsResourceCollector
A resource collector that collects resources changed in a given time frame and supports flexible sorting based on resource dates.
- Since:
- 8.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The collector parameter key for the maximum number of resources to return.static final String
The collector parameter key for the date from which a resource should be changed.static final String
The collector parameter key for the date to which a resource should be changed.static final String
The collector parameter key for the name of the resource type to exclude from the result.static final String
The collector parameter key for the resource, i.e.static final String
The collector parameter key for the sort attribute that should be used to sort the result.Fields inherited from class org.opencms.file.collectors.A_CmsResourceCollector
m_order, SEPARATOR_TEMPLATEFILE
Fields inherited from interface org.opencms.file.collectors.I_CmsResourceCollector
DEFAULT_LIMIT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected List<CmsResource>
allChangedInFolderDate
(CmsObject cms, String param, boolean tree, boolean asc, int numResults) Returns a List of all changed resources in the folder pointed to by the parameter sorted by the date attributes specified in the parameter.Returns a list of all collector names (Strings) this collector implementation supports.getCreateLink
(CmsObject cms, String collectorName, String param) Returns the link that must be executed when a user clicks on the direct edit "new" button on a list created by the named collector.getCreateParam
(CmsObject cms, String collectorName, String param) Returns the parameter that must be passed to theI_CmsResourceCollector.getCreateLink(CmsObject, String, String)
method.getResults
(CmsObject cms, String collectorName, String param) Returns a list ofCmsResource
Objects that are gathered in the VFS using the named collector.getResults
(CmsObject cms, String collectorName, String param, int numResults) Returns a list ofCmsResource
Objects that are gathered in the VFS using the named collector.Methods inherited from class org.opencms.file.collectors.A_CmsResourceCollector
checkParams, compareTo, createResourceForCollector, equals, getCreateInFolder, getCreateInFolder, getCreateLink, getCreateParam, getCreateTypeId, getDefaultCollectorName, getDefaultCollectorParam, getOrder, getPostCreateHandler, getPublishResources, getResults, hashCode, setDefaultCollectorName, setDefaultCollectorParam, setOrder, shrinkToFit, shrinkToFit
-
Field Details
-
PARAM_KEY_COUNT
The collector parameter key for the maximum number of resources to return.- See Also:
-
PARAM_KEY_DATEFROM
The collector parameter key for the date from which a resource should be changed.- See Also:
-
PARAM_KEY_DATETO
The collector parameter key for the date to which a resource should be changed.- See Also:
-
PARAM_KEY_EXCLUDETYPE
The collector parameter key for the name of the resource type to exclude from the result.- See Also:
-
PARAM_KEY_RESOURCE
The collector parameter key for the resource, i.e. the parent folder from which the subscribed or visited resources should be read from.- See Also:
-
PARAM_KEY_SORTBY
The collector parameter key for the sort attribute that should be used to sort the result.- See Also:
-
-
Constructor Details
-
CmsChangedResourceCollector
public CmsChangedResourceCollector()
-
-
Method Details
-
getCollectorNames
Description copied from interface:I_CmsResourceCollector
Returns a list of all collector names (Strings) this collector implementation supports.- Returns:
- a list of all collector names this collector implementation supports
- See Also:
-
getCreateLink
Description copied from interface:I_CmsResourceCollector
Returns the link that must be executed when a user clicks on the direct edit "new" button on a list created by the named collector.If this method returns
null
, it indicated that the selected collector implementation does not support a "create link", and so no "new" button will should shown on lists generated with this collector.- Parameters:
cms
- the current CmsObjectcollectorName
- the name of the collector to useparam
- an optional collector parameter- Returns:
- the link to execute after a "new" button was clicked
- See Also:
-
getCreateParam
Description copied from interface:I_CmsResourceCollector
Returns the parameter that must be passed to theI_CmsResourceCollector.getCreateLink(CmsObject, String, String)
method.If this method returns
null
, it indicates that the selected collector implementation does not support a "create link", and so no "new" button will should shown on lists generated with this collector.- Parameters:
cms
- the current CmsObjectcollectorName
- the name of the collector to useparam
- an optional collector parameter from the current page context- Returns:
- the parameter that will be passed to the
I_CmsResourceCollector.getCreateLink(CmsObject, String, String)
method, or null - See Also:
-
getResults
public List<CmsResource> getResults(CmsObject cms, String collectorName, String param) throws CmsDataAccessException, CmsException Description copied from interface:I_CmsResourceCollector
Returns a list ofCmsResource
Objects that are gathered in the VFS using the named collector.- Parameters:
cms
- the current CmsObjectcollectorName
- the name of the collector to useparam
- an optional collector parameter- Returns:
- a list of CmsXmlContent objects
- Throws:
CmsDataAccessException
- if the parameter attribute of the corresponding collector tag is invalidCmsException
- if something goes wrong- See Also:
-
getResults
public List<CmsResource> getResults(CmsObject cms, String collectorName, String param, int numResults) throws CmsDataAccessException, CmsException Description copied from interface:I_CmsResourceCollector
Returns a list ofCmsResource
Objects that are gathered in the VFS using the named collector.This method takes as a parameter the desired number of results. If this number is -1, the number of results will only depend on the collector parameters. If it is positive, any given result number in the collector parameter string will not be used.
- Parameters:
cms
- the current CmsObjectcollectorName
- the name of the collector to useparam
- an optional collector parameternumResults
- the desired number of results (overrides result number possibl- Returns:
- a list of CmsXmlContent objects
- Throws:
CmsDataAccessException
- if the parameter attribute of the corresponding collector tag is invalidCmsException
- if something goes wrong- See Also:
-
allChangedInFolderDate
protected List<CmsResource> allChangedInFolderDate(CmsObject cms, String param, boolean tree, boolean asc, int numResults) throws CmsException Returns a List of all changed resources in the folder pointed to by the parameter sorted by the date attributes specified in the parameter.- Parameters:
cms
- the current CmsObjectparam
- must contain an extended collector parameter set as described byCmsExtendedCollectorData
tree
- if true, look in folder and all child folders, if false, look only in given folderasc
- iftrue
, the sort is ascending (old dates first), otherwise it is descending (new dates first)numResults
- number of results- Returns:
- a List of all resources in the folder pointed to by the parameter sorted by the selected dates
- Throws:
CmsException
- if something goes wrong
-