org.opencms.file.collectors
Class CmsSubscriptionCollector

java.lang.Object
  extended by org.opencms.file.collectors.A_CmsResourceCollector
      extended by org.opencms.file.collectors.CmsSubscriptionCollector
All Implemented Interfaces:
java.lang.Comparable<I_CmsResourceCollector>, I_CmsResourceCollector

public class CmsSubscriptionCollector
extends A_CmsResourceCollector

A collector that returns visited or subscribed resources depending on the current user and parameters.

The configuration of the collectors can be done in the parameter String using key value pairs, separated by the | (pipe) symbol. The following configuration options are available:

Example parameter String that can be used for the collector:
currentuser=true|daysfrom=14|includegroups=true|mode=unvisited|resource=/demo_en/|includesubfolders=true

Since:
8.0

Field Summary
static java.lang.String PARAM_KEY_CURRENTUSER
          The collector parameter key for the current user flag (to set the user in the filters to the current user).
static java.lang.String PARAM_KEY_DAYSFROM
          The collector parameter key for the number of days subtracted from the current day specifying the start point in time from which a resource was visited.
static java.lang.String PARAM_KEY_DAYSTO
          The collector parameter key for the number of days subtracted from the current day specifying the end point in time to which a resource was visited.
static java.lang.String PARAM_KEY_GROUPS
          The collector parameter key for the users group names, separated by comma, to read subscribed resources for.
static java.lang.String PARAM_KEY_INCLUDEGROUPS
          The collector parameter key for the include groups flag to read subscribed resources also for the given or current users groups.
static java.lang.String PARAM_KEY_INCLUDESUBFOLDERS
          The collector parameter key for the include subfolders flag to read subscribed resources also for the subfolders of the given parent folder.
static java.lang.String PARAM_KEY_MODE
          The collector parameter key for the subscription read mode.
static java.lang.String 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.
static java.lang.String PARAM_KEY_USER
          The collector parameter key for the user to read subscribed or visited resources for.
 
Fields inherited from class org.opencms.file.collectors.A_CmsResourceCollector
m_order, SEPARATOR_TEMPLATEFILE
 
Constructor Summary
CmsSubscriptionCollector()
           
 
Method Summary
 java.util.List<java.lang.String> getCollectorNames()
          Returns a list of all collector names (Strings) this collector implementation supports.
 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 I_CmsResourceCollector.getCreateLink(CmsObject, String, String) method.
 java.util.List<CmsResource> 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.
protected  java.util.List<CmsResource> getSubscribedDeletedResources(CmsObject cms, java.lang.String param)
          Returns the subscribed deleted resources according to the collector parameter.
protected  java.util.List<CmsResource> getSubscribedResources(CmsObject cms, java.lang.String param)
          Returns the subscribed resources according to the collector parameter.
protected  CmsSubscriptionFilter getSubscriptionFilter(CmsObject cms, java.util.Map<java.lang.String,java.lang.String> params)
          Returns the configured subscription filter to use.
protected  CmsSubscriptionFilter getSubscriptionFilter(CmsObject cms, java.lang.String param)
          Returns the configured subscription filter to use.
protected  CmsVisitedByFilter getVisitedByFilter(CmsObject cms, java.lang.String param)
          Returns the configured visited by filter to use.
protected  java.util.List<CmsResource> getVisitedResources(CmsObject cms, java.lang.String param)
          Returns the visited resources according to the collector parameter.
 
Methods inherited from class org.opencms.file.collectors.A_CmsResourceCollector
checkParams, compareTo, createResourceForCollector, equals, getCreateInFolder, 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

PARAM_KEY_CURRENTUSER

public static final java.lang.String PARAM_KEY_CURRENTUSER
The collector parameter key for the current user flag (to set the user in the filters to the current user).

See Also:
Constant Field Values

PARAM_KEY_DAYSFROM

public static final java.lang.String PARAM_KEY_DAYSFROM
The collector parameter key for the number of days subtracted from the current day specifying the start point in time from which a resource was visited.

See Also:
Constant Field Values

PARAM_KEY_DAYSTO

public static final java.lang.String PARAM_KEY_DAYSTO
The collector parameter key for the number of days subtracted from the current day specifying the end point in time to which a resource was visited.

If the parameter PARAM_KEY_DAYSFROM is also used, the value of this key should be less than the value set as PARAM_KEY_DAYSFROM parameter.

See Also:
Constant Field Values

PARAM_KEY_GROUPS

public static final java.lang.String PARAM_KEY_GROUPS
The collector parameter key for the users group names, separated by comma, to read subscribed resources for.

See Also:
Constant Field Values

PARAM_KEY_INCLUDEGROUPS

public static final java.lang.String PARAM_KEY_INCLUDEGROUPS
The collector parameter key for the include groups flag to read subscribed resources also for the given or current users groups.

See Also:
Constant Field Values

PARAM_KEY_INCLUDESUBFOLDERS

public static final java.lang.String PARAM_KEY_INCLUDESUBFOLDERS
The collector parameter key for the include subfolders flag to read subscribed resources also for the subfolders of the given parent folder.

See Also:
Constant Field Values

PARAM_KEY_MODE

public static final java.lang.String PARAM_KEY_MODE
The collector parameter key for the subscription read mode.

See Also:
Constant Field Values

PARAM_KEY_RESOURCE

public static final java.lang.String 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:
Constant Field Values

PARAM_KEY_USER

public static final java.lang.String PARAM_KEY_USER
The collector parameter key for the user to read subscribed or visited resources for.

See Also:
Constant Field Values
Constructor Detail

CmsSubscriptionCollector

public CmsSubscriptionCollector()
Method Detail

getCollectorNames

public java.util.List<java.lang.String> 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()

getCreateLink

public java.lang.String getCreateLink(CmsObject cms,
                                      java.lang.String collectorName,
                                      java.lang.String param)
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
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<CmsResource> 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:
CmsDataAccessException - if the parameter attribute of the corresponding collector tag is invalid
CmsException - if something goes wrong
See Also:
I_CmsResourceCollector.getResults(org.opencms.file.CmsObject, java.lang.String, java.lang.String)

getSubscribedDeletedResources

protected java.util.List<CmsResource> getSubscribedDeletedResources(CmsObject cms,
                                                                    java.lang.String param)
                                                             throws CmsException
Returns the subscribed deleted resources according to the collector parameter.

Parameters:
cms - the current users context
param - an optional collector parameter
Returns:
the subscribed deleted resources according to the collector parameter
Throws:
CmsException - if something goes wrong

getSubscribedResources

protected java.util.List<CmsResource> getSubscribedResources(CmsObject cms,
                                                             java.lang.String param)
                                                      throws CmsException
Returns the subscribed resources according to the collector parameter.

Parameters:
cms - the current users context
param - an optional collector parameter
Returns:
the subscribed resources according to the collector parameter
Throws:
CmsException - if something goes wrong

getSubscriptionFilter

protected CmsSubscriptionFilter getSubscriptionFilter(CmsObject cms,
                                                      java.util.Map<java.lang.String,java.lang.String> params)
                                               throws CmsException
Returns the configured subscription filter to use.

Parameters:
cms - the current users context
params - the optional collector parameters
Returns:
the configured subscription filter to use
Throws:
CmsException - if something goes wrong

getSubscriptionFilter

protected CmsSubscriptionFilter getSubscriptionFilter(CmsObject cms,
                                                      java.lang.String param)
                                               throws CmsException
Returns the configured subscription filter to use.

Parameters:
cms - the current users context
param - an optional collector parameter
Returns:
the configured subscription filter to use
Throws:
CmsException - if something goes wrong

getVisitedByFilter

protected CmsVisitedByFilter getVisitedByFilter(CmsObject cms,
                                                java.lang.String param)
                                         throws CmsException
Returns the configured visited by filter to use.

Parameters:
cms - the current users context
param - an optional collector parameter
Returns:
the configured visited by filter to use
Throws:
CmsException - if something goes wrong

getVisitedResources

protected java.util.List<CmsResource> getVisitedResources(CmsObject cms,
                                                          java.lang.String param)
                                                   throws CmsException
Returns the visited resources according to the collector parameter.

Parameters:
cms - the current users context
param - an optional collector parameter
Returns:
the visited resources according to the collector parameter
Throws:
CmsException - if something goes wrong