JBoss.orgCommunity Documentation

Perform tasks when a content's state is updated

To perform some tasks when a content's state is updated, you need to create a listener that handles the task and configure it. Following is the general configuration:



<external-component-plugins>
<target-component>org.exoplatform.services.listener.ListenerService</target-component>
<component-plugin>
<name>PublicationService.event.postUpdateState</name>
<set-method>addListener</set-method>
<type>my.package.MyListener</type>
<description>Your listener description</description>
</component-plugin>
</external-component-plugins>

With this configuration, your listener my.package.MyListener will be executed each time a content's state is changed.

For example, eXo provides a listener which automatically sends email notifications about the new state to all users of defined groups: org.exoplatform.wcm.authoring.listener.PostUpdateStateEventListener. So, the configuration will be:



<external-component-plugins>
<target-component>org.exoplatform.services.listener.ListenerService</target-component>
<component-plugin>
<name>PublicationService.event.postUpdateState</name>
<set-method>addListener</set-method>
<type>org.exoplatform.wcm.authoring.listener.PostUpdateStateEventListener</type>
<description>This listener will send a mail when there are changes in a content's state</description>
</component-plugin>
</external-component-plugins>