Package org.opencms.file.collectors
Class CmsAddCategoriesPostCreateHandler
java.lang.Object
org.opencms.file.collectors.CmsAddCategoriesPostCreateHandler
- All Implemented Interfaces:
I_CmsCollectorPostCreateHandler
public class CmsAddCategoriesPostCreateHandler
extends Object
implements I_CmsCollectorPostCreateHandler
A post create handler that adds categories to newly created resources (that are not a copy of an existing resource).
To configure it for adding the categories with category paths "cat1/subcat1/", "cat1/subcat2/" and "cat2/"
add the attribute
postCreateHandler="org.opencms.file.collectors.CmsAddCategoriesPostCreateHandler|cat1/subcat1/,cat1/subcat2/,cat2/"
to the tag that provides the create option (i.e., <cms:contentload>, <cms:edit> or <cms:display>.
Instead of providing category paths, one can also use site or root paths of the folders representing the categories. If a category path starts with "/" it is assumed to be site or root path. Otherwise it is treated as category path, i.e., the path without the category repositories base path.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onCreate
(CmsObject cms, CmsResource createdResource, boolean copyMode) This is called after the new content has been created (and possibly already been filled with content).void
onCreate
(CmsObject cms, CmsResource createdResource, boolean copyMode, String config) Adds the categories specified viaconfig
to the newly created resource iff not in copy mode.
-
Constructor Details
-
CmsAddCategoriesPostCreateHandler
public CmsAddCategoriesPostCreateHandler()
-
-
Method Details
-
onCreate
Description copied from interface:I_CmsCollectorPostCreateHandler
This is called after the new content has been created (and possibly already been filled with content).- Specified by:
onCreate
in interfaceI_CmsCollectorPostCreateHandler
- Parameters:
cms
- the current user's CMS contextcreatedResource
- the resource which has been createdcopyMode
- true if the user chose one of the elements in the collector list as a model- See Also:
-
onCreate
Adds the categories specified viaconfig
to the newly created resource iff not in copy mode.- Specified by:
onCreate
in interfaceI_CmsCollectorPostCreateHandler
- Parameters:
cms
- the current user's CMS contextcreatedResource
- the resource which has been createdcopyMode
-true
if the user chose one of the elements in the collector list as a modelconfig
- a comma separted list of category, site or root paths that specify the categories to be added to the created resource ifcopyMode
isfalse
.- See Also:
-