Discussion forums offer all members and guests of a teamspace the opportunity to create and contribute to message threads on topics of common interest.
The Collaboration API contains elements that developers can use to create, access, and manage discussion forums from within FileNet P8 applications. Key discussion elements are:
A discussion forum comprises the following basic information:
A discussion forum is established when the above information is assembled into a ForumInfo object and passed to a FolderContainer object.
Each new discussion forum can contain any number of topics, and each topic, in turn, can contain any number of postings and replies.
Topics are created by passing a new TopicPostingInfo object containing three strings—topic creator-owner ID, subject, and an introductory posting—to the Container method addContainee.
After a topic is created and the initial posting submitted, additional postings or responses to existing postings are generated by creating and passing new ReplyPostingInfo objects to the container's addContainee method. ReplyPostingInfo takes the following parameters: the ID of the posting party, a subject, posting content, and, if the new posting is in reply to an existing posting, the ID of the existing posting.
Forum descriptions and subjects can be modified at any time with the Forum interface's setDescription and setSubject methods, or both properties can be modified simultaneously with the bulkUpdate method.
Discussion participants may be kept abreast of forum or posting activity by subscribing to email notifications that are triggered by specified events. Subscriptions may be added, modified, or reviewed at any time. For details on how the notification process is defined and managed, see Subscriptions.
Discussion forums remain open until the Forum object's close method is called. Closed discussions can be resumed with the reopen() method.
Discussion forums are created and maintained within a _discussions folder, a subfolder of a teamspace's _internal folder. The _discussions folder implements the FolderContainer interface (an extension of the Container interface) and is based on the containment capabilities of a Content Engine Folder object.
The discussions folder is accessed through any of the following ContainerManager methods:
Collaboration.COLLABORATION_FORUMS_CONTAINER_DEFID
. Collaboration.TYPE_FORUM
; the id must be a GUID of a CollaborationForum Content Engine object.A new Forum object is created when a ForumInfo object is passed to the FolderContainer object's addSubContainer method, as described in the code below.
The following code describes how a Discussion Forum object might be created in a known object store and teamspace. For information on teamspace objects, see Teamspaces; for information on creating and managing object stores, see the Content Java API topic, Working With Object Stores.
// pass basic discussion forum data to new ForumInfo object
ForumInfo forumInfo = new ForumInfo(subject, description, ownerID);
ContainerManager containerManager = teamSpace.getContainerManager();
FolderContainer forumContainer = (FolderContainer)
containerManager.getContainerByDefinitionID (Collaboration.COLLABORATION_FORUM_CONTAINER_DEFID);
Forum forumObject = forumContainer.addSubContainer(forumInfo);
/*
Discussion topics are containees of a specified forum.
Topics are created by passing a new TopicPostingInfo object
(with three string parameters: topic creator-owner ID,
the subject of the topic, and an introductory posting)
to the Container method addContainee:
*/
TopicPostingInfo topicPostingInfo = new TopicPostingInfo(topicCreatorID, topicSubject, introPosting);
TopicPosting topicPosting = forumObject.addContainee(ti);
After a topic is created and the initial posting submitted, additional postings or responses to existing postings are generated by creating and passing new ReplyPostingInfo objects to addContainee:
ReplyPostingInfo replyPostingInfo = new ReplyPostingInfo(topicCreatorID,
topicSubject, messageContent, replyToPostingID);
ReplyPosting replyPosting = forumObject.addContainee(replyPostingInfo);
Note: Both TopicPostingInfo and ReplyPostingInfo are extensions of the abstract class PostingInfo.
If a new posting is not intended to answer an existing posting, ReplyPostingInfo's replyToPostingID parameter may be null.
If a new posting is intended as a reply to an existing posting, you can call the Container method getContainees to obtain the replyToPostingID for the target posting:
for(Iterator containeeIt = forum.getContainees(); containeeIt.hasNext();)
{
Object containee = containeeIt.next();
Posting posting = (Posting)containee;
String sub = posting.getSubject();
String id = posting.getID();
}
An alternate means of adding a reply is through the ReplyPostingCommand class:
Command cmd = CollaborationFactory.getCommand(Command.POSTINGREPLY_COMMAND_KEY);
cmd.setParameterData(ReplyPostingCommand.TEAMSPACE_PARAMETER_KEY, ts);
cmd.setParameterData(ReplyPostingCommand.POSTING_ID_PARAMETER_KEY, postingID);
cmd.setParameterData(ReplyPostingCommand.CONTENT_PARAMETER_KEY, "This is my reply to your posting");
cmd.setParameterData(ReplyPostingCommand.MEMBER_ID_PARAMETER_KEY, "userid");
Object obj = cmd.execute();
if(obj instanceof Map)
{ // exceptions thrown during command execution }
else
{ // cast return object to Posting }
For information on how discussion forums operate in the FileNet P8 TCM application, see Overview of Discussions.