4.4.2. Adding an action to publication lifecycle

After defining the publication lifecycle, you can add an action to it as follows:

  1. Create a listener which handles your desired task, for example, my.package.MyListener, which extends Listener<CmsService, Node>.

     public class my.package.MyListener extends Listener<CmsService, Node>

    You need to implement the following method in your my.package.MyListener listener.

    public void onEvent(Event<CmsService, Node> event) throws Exception

    For example, eXo Platform provides the org.exoplatform.wcm.authoring.listener.PostUpdateStateEventListener listener which automatically sends email notifications about the new state to all users of defined groups. Refer to PostUpdateStateEventListener for more details about its configuration.

  2. Declare your listener into custom-extension.war!/WEB-INF/conf/myacme-conf/wcm/publication-configuration.xml.

    
    <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>

    In which:

    • name: This is defined in your own publication plugin.

    • type: The path to your listener.

    With this configuration, your my.package.MyListener will be executed each time the content state is changed.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus