Class A_CmsResourceCollector
- All Implemented Interfaces:
Comparable<I_CmsResourceCollector>
,I_CmsCollectorPublishListProvider
,I_CmsResourceCollector
- Direct Known Subclasses:
CmsCategoryResourceCollector
,CmsChangedResourceCollector
,CmsDateResourceCollector
,CmsDefaultResourceCollector
,CmsPriorityResourceCollector
,CmsSolrCollector
,CmsSubscriptionCollector
,CmsTimeFrameCategoryCollector
- Since:
- 6.0.0
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The collector order of this collector.static final String
The template file separator string for creating a new resource in direct edit mode, can be used to append an explicit template file name inI_CmsResourceCollector.getCreateParam(CmsObject, String, String)
.Fields inherited from interface org.opencms.file.collectors.I_CmsResourceCollector
DEFAULT_LIMIT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Checks if the required parameters have been set.int
static String
createResourceForCollector
(CmsObject cms, String newLink, Locale locale, String referenceResource, String modelFile, String mode, String postCreateHandler) Creates a new content collector resource.boolean
Two collectors are considered to be equal if they are sharing the same implementation class.protected String
getCreateInFolder
(CmsObject cms, String param) Returns the link to create a new XML content item in the folder pointed to by the parameter.protected String
getCreateInFolder
(CmsObject cms, CmsCollectorData data) Returns the link to create a new XML content item in the folder pointed to by the parameter.getCreateLink
(CmsObject cms) Returns the link that must be executed when a user clicks on the direct edit "new" button on a list created by the default collector.getCreateParam
(CmsObject cms) Returns the default parameter that must be passed to theI_CmsResourceCollector.getCreateLink(CmsObject, String, String)
method.int
getCreateTypeId
(CmsObject cms, String collectorName, String param) Returns the id of the resource type for new collector items.Returns the default collector name to use for collecting resources.Returns the default collector parameter to use for collecting resources.int
getOrder()
Returns the "order weight" of this collector.getPostCreateHandler
(String className) Instantiates a post-create handler given a class name (which may actually be null).Gets the publish list for the collector.getResults
(CmsObject cms) Returns a list ofCmsResource
Objects that are gathered in the VFS using the default collector name and parameter.int
hashCode()
void
setDefaultCollectorName
(String collectorName) Sets the default collector name to use for collecting resources.void
setDefaultCollectorParam
(String param) Sets the default collector parameter to use for collecting resources.void
setOrder
(int order) Sets the "order weight" of this collector.protected List<CmsResource>
shrinkToFit
(List<CmsResource> result, int maxSize) Shrinks a List to fit a maximum size.protected List<CmsResource>
shrinkToFit
(List<CmsResource> result, int maxSize, int explicitNumResults) Shrinks a List to fit a maximum size.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opencms.file.collectors.I_CmsResourceCollector
getCollectorNames, getCreateLink, getCreateParam, getResults, getResults
-
Field Details
-
SEPARATOR_TEMPLATEFILE
The template file separator string for creating a new resource in direct edit mode, can be used to append an explicit template file name inI_CmsResourceCollector.getCreateParam(CmsObject, String, String)
.- See Also:
-
m_order
The collector order of this collector.
-
-
Constructor Details
-
A_CmsResourceCollector
public A_CmsResourceCollector()Constructor to initialize some default values.
-
-
Method Details
-
createResourceForCollector
public static String createResourceForCollector(CmsObject cms, String newLink, Locale locale, String referenceResource, String modelFile, String mode, String postCreateHandler) throws CmsException Creates a new content collector resource.- Parameters:
cms
- the cms contextnewLink
- the new resource linklocale
- the content localereferenceResource
- the reference resourcemodelFile
- the model filemode
- the optional creation mode (can be null)postCreateHandler
- optional class name of anI_CmsCollectorPostCreateHandler
which is invoked after the content has been created. The fully qualified class name can be followed by a "|" symbol and a handler specific configuration string.- Returns:
- the new file name
- Throws:
CmsException
- if something goes wrong
-
getPostCreateHandler
Instantiates a post-create handler given a class name (which may actually be null).If the given name is null or does not refer to a valid post-create handler class, a default implementation will be returned.
- Parameters:
className
- the class name of the post-create handler class- Returns:
- a post-create handler instance
-
compareTo
- Specified by:
compareTo
in interfaceComparable<I_CmsResourceCollector>
- See Also:
-
equals
Two collectors are considered to be equal if they are sharing the same implementation class. -
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 default 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.- Specified by:
getCreateLink
in interfaceI_CmsResourceCollector
- Parameters:
cms
- the current CmsObject- Returns:
- the link to execute after a "new" button was clicked
- Throws:
CmsException
- if something goes wrongCmsDataAccessException
- if the parameter attribute of the corresponding collector tag is invalid- See Also:
-
getCreateParam
Description copied from interface:I_CmsResourceCollector
Returns the default 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.- Specified by:
getCreateParam
in interfaceI_CmsResourceCollector
- Parameters:
cms
- the current CmsObject- Returns:
- the parameter that will be passed to the
I_CmsResourceCollector.getCreateLink(CmsObject, String, String)
method, or null - Throws:
CmsDataAccessException
- if the param attrib of the corresponding collector tag is invalid- See Also:
-
getCreateTypeId
Description copied from interface:I_CmsResourceCollector
Returns the id of the resource type for new collector items.Returns -1 if creation of new items is not supported.
- Specified by:
getCreateTypeId
in interfaceI_CmsResourceCollector
- Parameters:
cms
- the current CmsObjectcollectorName
- the name of the collector to useparam
- an optional collector parameter- Returns:
- the resource type id
- Throws:
CmsException
- if something goes wrong- See Also:
-
getDefaultCollectorName
Description copied from interface:I_CmsResourceCollector
Returns the default collector name to use for collecting resources.- Specified by:
getDefaultCollectorName
in interfaceI_CmsResourceCollector
- Returns:
- the default collector name
- See Also:
-
getDefaultCollectorParam
Description copied from interface:I_CmsResourceCollector
Returns the default collector parameter to use for collecting resources.- Specified by:
getDefaultCollectorParam
in interfaceI_CmsResourceCollector
- Returns:
- the default collector parameter
- See Also:
-
getOrder
Description copied from interface:I_CmsResourceCollector
Returns the "order weight" of this collector.The "order weight" is important because two collector classes may provide a collector with the same name. If this is the case, the collector implementation with the higher order number "overrules" the lower order number class.
- Specified by:
getOrder
in interfaceI_CmsResourceCollector
- Returns:
- the "order weight" of this collector
- See Also:
-
getResults
Description copied from interface:I_CmsResourceCollector
Returns a list ofCmsResource
Objects that are gathered in the VFS using the default collector name and parameter.- Specified by:
getResults
in interfaceI_CmsResourceCollector
- Parameters:
cms
- the current CmsObject- 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:
-
hashCode
-
setDefaultCollectorName
Description copied from interface:I_CmsResourceCollector
Sets the default collector name to use for collecting resources.- Specified by:
setDefaultCollectorName
in interfaceI_CmsResourceCollector
- Parameters:
collectorName
- the default collector name- See Also:
-
setDefaultCollectorParam
Description copied from interface:I_CmsResourceCollector
Sets the default collector parameter to use for collecting resources.- Specified by:
setDefaultCollectorParam
in interfaceI_CmsResourceCollector
- Parameters:
param
- the default collector parameter- See Also:
-
setOrder
Description copied from interface:I_CmsResourceCollector
Sets the "order weight" of this collector.- Specified by:
setOrder
in interfaceI_CmsResourceCollector
- Parameters:
order
- the order weight to set- See Also:
-
checkParams
Checks if the required parameters have been set. -
getCreateInFolder
Returns the link to create a new XML content item in the folder pointed to by the parameter.- Parameters:
cms
- the current CmsObjectdata
- the collector data to use- Returns:
- the link to create a new XML content item in the folder
- Throws:
CmsException
- if something goes wrong- Since:
- 7.0.2
-
getCreateInFolder
Returns the link to create a new XML content item in the folder pointed to by the parameter.- Parameters:
cms
- the current CmsObjectparam
- the folder name to use- Returns:
- the link to create a new XML content item in the folder
- Throws:
CmsException
- if something goes wrong
-
shrinkToFit
Shrinks a List to fit a maximum size.- Parameters:
result
- a ListmaxSize
- the maximum size of the List- Returns:
- the reduced list
-
shrinkToFit
protected List<CmsResource> shrinkToFit(List<CmsResource> result, int maxSize, int explicitNumResults) Shrinks a List to fit a maximum size.- Parameters:
result
- a ListmaxSize
- the maximum size of the ListexplicitNumResults
- the value of the numResults parameter given to the getResults method (this overrides maxSize if it is positive)- Returns:
- the reduced list
-