This section shows you how to create a publication lifecycle in an existing publication plugin, for example, Authoring publication plugin. Each lifecycle is related to a Publication plugin.
Create publication-configuration.xml
under custom-extension.war!/WEB-INF/conf/myacme-conf/wcm/
.
Define lifecycles by a simple vertical workflow with steps (states) and profiles (membership) as follows.
<external-component-plugins>
<target-component>org.exoplatform.services.wcm.extensions.publication.PublicationManager</target-component>
<component-plugin>
<name>AddLifecycle</name>
<set-method>addLifecycle</set-method>
<type>org.exoplatform.services.wcm.extensions.publication.lifecycle.StatesLifecyclePlugin</type>
<description>Configures</description>
<priority>1</priority>
<init-params>
<object-param>
<name>lifecycles</name>
<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig">
<field name="lifecycles">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$Lifecycle">
<field name="name">
<string>lifecycle1</string>
</field>
<field name="publicationPlugin">
<string>Authoring publication</string>
</field>
<field name="states">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
<field name="state">
<string>draft</string>
</field>
<field name="membership">
<string>author:/platform/web-contributors</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
<field name="state">
<string>pending</string>
</field>
<field name="membership">
<string>author:/platform/web-contributors</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
<field name="state">
<string>approved</string>
</field>
<field name="membership">
<string>manager:/platform/web-contributors</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
<field name="state">
<string>staged</string>
</field>
<field name="membership">
<string>publisher:/platform/web-contributors</string>
</field>
</object>
</value>
<value>
<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
<field name="state">
<string>published</string>
</field>
<field name="membership">
<string>publisher:/platform/web-contributors</string>
</field>
</object>
</value>
</collection>
</field>
</object>
</value>
</collection>
</field>
</object>
</object-param>
</init-params>
</component-plugin>
<component-plugin>
<name>AddContext</name>
<set-method>addContext</set-method>
<type>org.exoplatform.services.wcm.extensions.publication.context.ContextPlugin</type>
<init-params>
<object-param>
<name>contexts</name>
<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig">
<field name="contexts">
<collection type="java.util.ArrayList">
<value>
<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig$Context">
<field name="name">
<string>contextdefault</string>
</field>
<field name="priority">
<string>200</string>
</field>
<field name="lifecycle">
<string>lifecycle1</string>
</field>
</object>
</value>
</collection>
</field>
</object>
</object-param>
</init-params>
</component-plugin>
</external-component-plugins>
The configuration above defines a lifecycle called
lifecycle1
with publication states, including draft
,
pending
, approved
, staged
, and published
.
Each state is set permission to a given membership.
The lifecycle is defined by the org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$Lifecycle
object type. So, you can use this object type with the field
tags to add more lifecycles to the plugin.
The value of the publicationPlugin
field must be the name of the publication plugin, for example, Authoring
publication
.
Refer to the
States Lifecycle
and
Context plugin
sections for more details about the parameters of the configuration above.
Register publication-configuration.xml
into custom-extension.war!/WEB-INF/conf/configuration.xml
.
<import>war:/conf/myacme-conf/wcm/publication-configuration.xml</import>