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., invalid input: '<'cms:contentload>, invalid input: '<'cms:edit> or invalid input: '<'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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonCreate(CmsObject cms, CmsResource createdResource, boolean copyMode) This is called after the new content has been created (and possibly already been filled with content).voidonCreate(CmsObject cms, CmsResource createdResource, boolean copyMode, String config) Adds the categories specified viaconfigto the newly created resource iff not in copy mode.
-
Constructor Details
-
CmsAddCategoriesPostCreateHandler
public CmsAddCategoriesPostCreateHandler()
-
-
Method Details
-
onCreate
Description copied from interface:I_CmsCollectorPostCreateHandlerThis is called after the new content has been created (and possibly already been filled with content).- Specified by:
onCreatein 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 viaconfigto the newly created resource iff not in copy mode.- Specified by:
onCreatein interfaceI_CmsCollectorPostCreateHandler- Parameters:
cms- the current user's CMS contextcreatedResource- the resource which has been createdcopyMode-trueif 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 ifcopyModeisfalse.- See Also:
-