JBoss.orgCommunity Documentation

Tutorial

To use ForumEventLifeCycle class, do the following steps:

1. Create a new class that extends ForumEventListener.

For example: class ABCActivityPublisher



public class ABCActivityPublisher extends ForumEventListener {
..............
}

2. Override fuctions in this created class. In each function, you can write anythings to meet your needs.



public class ABCActivityPublisher extends ForumEventListener {
  public void saveCategory(Category category){
    ....
  }
  public void saveForum(Forum forum){
    ....
  }
  public void addTopic(Topic topic, String categoryId, String forumId)){
    ....
  }
  public void updateTopic(Topic topic, String categoryId, String forumId){
    ....
  }
  public void addPost(Post post, String categoryId, String forumId, String topicId){
    ....
  }
  public void updatePost(Post post, String categoryId, String forumId, String topicId){
    ....
  }
}

3. Add a new configuration to the configuration.xml file with the type that is the class created in the Step 1.



<external-component-plugins>
  <target-component>org.exoplatform.forum.service.ForumService</target-component>
  <component-plugin>
    <name>ForumEventListener</name>
    <set-method>addListenerPlugin</set-method>
    <type>{package}.{class name}</type>
  <!-- example
  <type>org.exoplatform.ks.ext.impl.ABCActivityPublisher</type>
  -->
  </component-plugin>
</external-component-plugins>