You are looking at documentation for an older release. Not what you want? See the current release documentation.
Category is a particular classification arranged in a hierarchical structure and help end-users easily organize their content.
There are 2 ways to create a category tree:
Directly inline, via the Content Administration interface. See here for more details.
In your extension, via XML configuration files.
Configuring a category tree via XML configuration files
Create categories-configuration.xml
under custom-extension.war!/WEB-INF/conf/myacme-conf/wcm/
.
Add external-component-plugins
for the category tree to the custom-extension.war!/WEB-INF/conf/myacme-conf/wcm/categories-configuration.xml
as follows:
<external-component-plugins>
<target-component>org.exoplatform.services.cms.taxonomy.TaxonomyService</target-component>
<component-plugin>
<name>TaxonomyPlugin</name>
<set-method>addTaxonomyPlugin</set-method>
<type>org.exoplatform.services.cms.taxonomy.impl.TaxonomyPlugin</type>
<init-params>
<value-param>...</value-param>
<object-param>...</object-param>
</init-params>
</component-plugin>
</external-component-plugins>
You can view the sample in
$PLATFORM_TOMCAT_HOME/webapps/acme-website.war!/WEB-INF/conf/acme-portal/wcm/taxonomy/acme-taxonomies-configuration.xml
or here.
Define the repository, workspace, name of the tree and its JCR path via value-param
.
For example, create a category tree named powers:
<value-param>
<name>autoCreateInNewRepository</name>
<value>false</value>
</value-param>
<value-param>
<name>workspace</name>
<value>collaboration</value>
</value-param>
<value-param>
<name>path</name>
<value>/sites/acme/categories</value>
</value-param>
<value-param>
<name>treeName</name>
<value>powers</value>
</value-param>
Configure permissions for each group of users in the site, and the triggered
action when a new document is added to the category tree via object-param
.
For example, set permission for the powers category tree:
<object-param>
<name>permission.configuration</name>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig">
<field name="taxonomies">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Taxonomy">
<field name="permissions">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>any</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>false</string>
</field>
<field name="setProperty">
<string>false</string>
</field>
<field name="remove">
<string>false</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>*:/platform/administrators</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>true</string>
</field>
<field name="setProperty">
<string>true</string>
</field>
<field name="remove">
<string>true</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>*:/platform/web-contributors</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>true</string>
</field>
<field name="setProperty">
<string>true</string>
</field>
<field name="remove">
<string>true</string>
</field>
</object>
</value>
</collection>
</field>
</object>
</value>
</collection>
</field>
</object>
</object-param>
When you create a new category, you will add a pre-configured exo:taxonomyAction
to the root node of the category tree.
This action is triggered when a new document is added to anywhere in the category tree. The default action moves the document to the physical storage location and replaces the document in the category tree with a symlink of the exo:taxonomyLink
type pointing to it. The physical storage location is defined by a workspace name, a path and the current
date and time.
For example, configure actions for a document added to the powers category tree:
<object-param>
<name>predefined.actions</name>
<description>description</description>
<object type="org.exoplatform.services.cms.actions.impl.ActionConfig">
<field name="actions">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.cms.actions.impl.ActionConfig$TaxonomyAction">
<field name="type">
<string>exo:taxonomyAction</string>
</field>
<field name="name">
<string>taxonomyAction</string>
</field>
<field name="description">
<string></string>
</field>
<field name="homePath">
<string>collaboration:/sites/acme/categories/powers</string>
</field>
<field name="targetWspace">
<string>collaboration</string>
</field>
<field name="targetPath">
<string>/sites/acme/web contents</string>
</field>
<field name="lifecyclePhase">
<collection type="java.util.ArrayList">
<value>
<string>node_added</string>
</value>
</collection>
</field>
<field name="roles">
<string>*:/platform/users</string>
</field>
<field name="mixins">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.cms.actions.impl.ActionConfig$Mixin">
<field name="name">
<string>mix:affectedNodeTypes</string>
</field>
<field name="properties">
<string>
exo:affectedNodeTypeNames=nt:file,acme:contact_us,exo:cssFile,exo:htmlFile,exo:jsFile,exo:webContent,exo:pictureOnHeadWebcontent,acme:product,exo:link
</string>
</field>
</object>
</value>
</collection>
</field>
</object>
</value>
</collection>
</field>
</object>
</object-param>
Describe the structure and names of the categories and configure their permissions inside your category tree.
<object-param>
<name>taxonomy.configuration</name>
<description>configuration predefined taxonomies to inject in jcr</description>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig">
<field name="taxonomies">
<collection type="java.util.ArrayList">
<!-- Defense taxonomy -->
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$category">
<field name="name">
<string>DefenseTaxonomy</string>
</field>
<field name="path">
<string>/Defense</string>
</field>
<field name="permissions">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>any</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>false</string>
</field>
<field name="setProperty">
<string>false</string>
</field>
<field name="remove">
<string>false</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>*:/platform/administrators</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>true</string>
</field>
<field name="setProperty">
<string>true</string>
</field>
<field name="remove">
<string>true</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>*:/platform/web-contributors</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>true</string>
</field>
<field name="setProperty">
<string>true</string>
</field>
<field name="remove">
<string>true</string>
</field>
</object>
</value>
</collection>
</field>
</object>
</value>
<!-- Defense/Vision taxonomy -->
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Taxonomy">
<field name="name">
<string>VisionTaxonomy</string>
</field>
<field name="path">
<string>/Defense/Vision</string>
</field>
<field name="permissions">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>any</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>false</string>
</field>
<field name="setProperty">
<string>false</string>
</field>
<field name="remove">
<string>false</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.cms.taxonomy.impl.TaxonomyConfig$Permission">
<field name="identity">
<string>*:/platform/administrators</string>
</field>
<field name="read">
<string>true</string>
</field>
<field name="addNode">
<string>true</string>
</field>
<field name="setProperty">
<string>true</string>
</field>
<field name="remove">
<string>true</string>
</field>
</object>
</value>
</collection>
</field>
</object>
</value>
</collection>
</field>
</object>
</object-param>
This configuration shows you how to add the Defense category and its Vision sub-category to the power category tree and how to set the permission for these categories.
Register categories-configuration.xml
into custom-extension.war!/WEB-INF/conf/configuration.xml
.
<import>war:/conf/myacme-conf/wcm/categories-configuration.xml</import>
See also