JBoss.orgCommunity Documentation
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){
....
}
}
The function saveCategory is called when a category is added and/or edited.
The function saveForum is called when a forum is added and/or edited.
The function addTopic is called when a topic is added.
The function updateTopic is called when a topic is updated.
The function addPost is called when a post is added.
The function updatePost is called when a post is updated.
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>