org.opencms.file.collectors
Class CmsTimeFrameCategoryCollector

java.lang.Object
  extended byorg.opencms.file.collectors.A_CmsResourceCollector
      extended byorg.opencms.file.collectors.CmsTimeFrameCategoryCollector
All Implemented Interfaces:
java.lang.Comparable, I_CmsResourceCollector

public class CmsTimeFrameCategoryCollector
extends A_CmsResourceCollector

A collector that allows to collect resources within a time range based upon a configurable property that contains a time stamp.

Additioinally a property may be specified that contains a comma separated list of category Strings that have to match the specified list of categories to allow.

Demo usage:

 <cms:contentload collector="timeFrameAndCategories" 
   param="
     resource=/de/events/|
     resourceType=xmlcontent|
     resultLimit=10|
     sortDescending=true|
     timeStart=2007-08-01 14:22:12|
     timeEnd=2007-08-01 14:22:12|
     propertyTime=collector.time|
     propertyCategories=collector.categories|
     categories=sports,action,lifestyle"
   >
 

The param attribute supports a key - value syntax for collector params.

All parameters are specified as follows:

 key=value
 

Many key - value pairs may exist:

 key=value|key2=value2|key3=value3
 

The following keys are reserved:

All other key - value pairs are ignored.

Since:
7.0.3
Version:
$Revision: 1.3 $
Author:
Michael Emmerich

Field Summary
static java.text.DateFormat DATEFORMAT_SQL
          SQL Standard date format: "yyyy-MM-dd HH:mm:ss".
 
Fields inherited from class org.opencms.file.collectors.A_CmsResourceCollector
m_order
 
Constructor Summary
CmsTimeFrameCategoryCollector()
          Public constructor.
 
Method Summary
 java.util.List getCollectorNames()
          Returns a list of all collector names (Strings) this collector implementation supports.
protected  java.lang.String getCreateInFolder(CmsObject cms, CmsCollectorData data)
          Returns the link to create a new XML content item in the folder pointed to by the parameter.
 java.lang.String getCreateLink(CmsObject cms, java.lang.String collectorName, java.lang.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.
 java.lang.String getCreateParam(CmsObject cms, java.lang.String collectorName, java.lang.String param)
          Returns the parameter that must be passed to the getCreateLink(CmsObject, String, String) method.
 java.util.List getResults(CmsObject cms, java.lang.String collectorName, java.lang.String param)
          Returns a list of CmsResource Objects that are gathered in the VFS using the named collector.
 
Methods inherited from class org.opencms.file.collectors.A_CmsResourceCollector
checkParams, compareTo, equals, getCreateInFolder, getCreateLink, getCreateParam, getDefaultCollectorName, getDefaultCollectorParam, getOrder, getResults, hashCode, setDefaultCollectorName, setDefaultCollectorParam, setOrder, shrinkToFit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATEFORMAT_SQL

public static final java.text.DateFormat DATEFORMAT_SQL
SQL Standard date format: "yyyy-MM-dd HH:mm:ss".

Constructor Detail

CmsTimeFrameCategoryCollector

public CmsTimeFrameCategoryCollector()
Public constructor.

Method Detail

getCollectorNames

public java.util.List 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:
I_CmsResourceCollector.getCollectorNames()

getCreateInFolder

protected java.lang.String getCreateInFolder(CmsObject cms,
                                             CmsCollectorData data)
                                      throws CmsException
Description copied from class: A_CmsResourceCollector
Returns the link to create a new XML content item in the folder pointed to by the parameter.

Overrides:
getCreateInFolder in class A_CmsResourceCollector
Parameters:
cms - the current CmsObject
data - the collector data to use
Returns:
the link to create a new XML content item in the folder
Throws:
CmsException - if something goes wrong
See Also:
A_CmsResourceCollector.getCreateInFolder(org.opencms.file.CmsObject, org.opencms.file.collectors.CmsCollectorData)

getCreateLink

public java.lang.String getCreateLink(CmsObject cms,
                                      java.lang.String collectorName,
                                      java.lang.String param)
                               throws CmsException,
                                      CmsDataAccessException
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 CmsObject
collectorName - the name of the collector to use
param - an optional collector parameter
Returns:
the link to execute after a "new" button was clicked
Throws:
CmsException - if something goes wrong
CmsDataAccessException - if the parameter attribute of the corresponding collector tag is invalid
See Also:
I_CmsResourceCollector.getCreateLink(org.opencms.file.CmsObject, java.lang.String, java.lang.String)

getCreateParam

public java.lang.String getCreateParam(CmsObject cms,
                                       java.lang.String collectorName,
                                       java.lang.String param)
Description copied from interface: I_CmsResourceCollector
Returns the parameter that must be passed to the I_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 CmsObject
collectorName - the name of the collector to use
param - 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:
I_CmsResourceCollector.getCreateParam(org.opencms.file.CmsObject, java.lang.String, java.lang.String)

getResults

public java.util.List getResults(CmsObject cms,
                                 java.lang.String collectorName,
                                 java.lang.String param)
                          throws CmsDataAccessException,
                                 CmsException
Description copied from interface: I_CmsResourceCollector
Returns a list of CmsResource Objects that are gathered in the VFS using the named collector.

Parameters:
cms - the current CmsObject
collectorName - the name of the collector to use
param - an optional collector parameter
Returns:
a list of CmsXmlContent objects
Throws:
CmsException - if something goes wrong
CmsDataAccessException - if the parameter attribute of the corresponding collector tag is invalid
See Also:
I_CmsResourceCollector.getResults(org.opencms.file.CmsObject, java.lang.String, java.lang.String)