wt.workflow.forum
Class StandardForumService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.workflow.forum.StandardForumService
All Implemented Interfaces:
ForumService, Manager, NetFactor, Serializable

public class StandardForumService
extends StandardManager
implements ForumService, Serializable

Use the newStandardForumService static factory method(s), not the StandardForumService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private static String DEFAULT_TEMPLATE_NAME
           
private static String EVENT_PROPOGATION_QUEUE_NAME
           
private  ProcessingQueue eventPropogationQueue
           
private static int NRETRIES
           
private static String OBJECT_FORUM_TEMPLATE_PATH
           
private static String PROJECT_FORUM_TEMPLATE_PATH
           
private static long QUEUE_INTERVAL
           
private static String RESOURCE
           
private static int SLEEPTIME
           
private static boolean USE_QUEUE
           
private static boolean VERBOSE
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardForumService()
           
 
Method Summary
 void addForum(DiscussionForum forum, SubjectOfForum subject, boolean primary)
          Creates and ForumSubject association between the given forum and the subject.
private  void constructDiscussionThread(Vector findChildrenFor, Vector notMapped, HashMap finalDiscussionThread)
           
 DiscussionForum createForum(CollaborationTemplate template, String forumName, SubjectOfForum subject)
          Deprecated.  
 DiscussionForum createForum(CollaborationTemplate template, String forumName, SubjectOfForum subject, WTContainerRef containerRef)
          Creates and persists a Forum based on the strucutre defined in the given template and associates the given subject with this new forum.
 DiscussionForum createForum(String templateName, String forumName, SubjectOfForum subject)
          Deprecated.  
 DiscussionForum createForum(String templateName, String forumName, SubjectOfForum subject, WTContainerRef containerRef)
          Creates and persists a Forum based on the strucutre defined in the given template and associates the given subject with this new forum.
private  void dispatchEvent(String eventType, Object target)
          Dispatch a ForumServiceEvent with eventType=eventType and target=target
 Forum findForum(Discussion discussion)
          

Supported API: false
 Project2 findForumProject(Forum forum)
          

Supported API: false
 HashMap getChildDiscussions(Discussion discussion, boolean attachments)
          Returns all objects that have the container as their parent object.
 String getConceptualClassname()
          Deprecated.  
 DiscussionForumTemplate getDefaultTemplate()
          Deprecated. in 7.0
 DiscussionForumTemplate getDefaultTemplate(WTContainerRef containerRef)
          Retrieves the ForumTemplate given the name of the template.
 WTHashSet getForums(WTCollection subject)
           
 Enumeration getForums(WTObject subject)
          Retrieves all the forums that the given SubjectOfForum is associated with.
 Enumeration getForums(WTObject subject, boolean otherSideOnly)
          Retrieves all the forums that the given SubjectOfForum is associated with and if otherSideOnly is false, all the links that represent these associations .
 Enumeration getPostings(Discussion parent)
          Retrieves all the postings that are part of the given Discussion.
 DiscussionForumTemplate getTemplate(String name)
          Retrieves the ForumTemplate given the name of the template.
 DiscussionForumTemplate getTemplate(String name, WTContainerRef containerRef)
          Retrieves the ForumTemplate given the name of the template.
 Enumeration getTopics(Discussion parent)
          Retrieves all the topics that are part of the given discussion.
static StandardForumService newStandardForumService()
          Default factory for the class.
protected  void performStartupProcess()
          

Supported API: false
 void registerEvents(ManagerService managerService)
          Register events with the passed ManagerService.
 DiscussionForum saveForum(SubjectOfForum subject, DiscussionForum forum)
          Persists the forum if it isnt already there, else updates the existing one.
 DiscussionPosting savePosting(DiscussionPosting posting)
          Persist the posting if it doesnt already exist and update the existing one otherwise.
 CollaborationTemplate saveTemplate(CollaborationTemplate template)
          Persist the posting if it doesnt already exist and update the existing one otherwise.
 DiscussionTopic saveTopic(DiscussionTopic topic)
          Persist the topic if it doesnt already exist and update the existing one otherwise.
protected  void startEventPropogationQueue()
          Starts event propogation queue.
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

VERBOSE

private static boolean VERBOSE

USE_QUEUE

private static boolean USE_QUEUE

DEFAULT_TEMPLATE_NAME

private static String DEFAULT_TEMPLATE_NAME

PROJECT_FORUM_TEMPLATE_PATH

private static String PROJECT_FORUM_TEMPLATE_PATH

OBJECT_FORUM_TEMPLATE_PATH

private static String OBJECT_FORUM_TEMPLATE_PATH

EVENT_PROPOGATION_QUEUE_NAME

private static final String EVENT_PROPOGATION_QUEUE_NAME
See Also:
Constant Field Values

NRETRIES

private static final int NRETRIES
See Also:
Constant Field Values

SLEEPTIME

private static final int SLEEPTIME
See Also:
Constant Field Values

QUEUE_INTERVAL

private static long QUEUE_INTERVAL

eventPropogationQueue

private ProcessingQueue eventPropogationQueue
Constructor Detail

StandardForumService

public StandardForumService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

registerEvents

public void registerEvents(ManagerService managerService)
Register events with the passed ManagerService. The default method does nothing, subclasses should provide an overriding implementation.

Supported API: false

Specified by:
registerEvents in interface Manager
Overrides:
registerEvents in class StandardManager
Parameters:
managerService - the ManagerService with which to register events.

performStartupProcess

protected void performStartupProcess()
                              throws ManagerException


Supported API: false

Overrides:
performStartupProcess in class StandardManager
Throws:
ManagerException

newStandardForumService

public static StandardForumService newStandardForumService()
                                                    throws WTException
Default factory for the class.

Supported API: false

Returns:
StandardForumService
Throws:
WTException

addForum

public void addForum(DiscussionForum forum,
                     SubjectOfForum subject,
                     boolean primary)
              throws WTException,
                     NotAuthorizedException
Creates and ForumSubject association between the given forum and the subject. primary indicates whether or not the given subject was the first to use this forum.

Supported API: false

Specified by:
addForum in interface ForumService
Parameters:
forum - forum playing DISCUSSION_ROLE for the association.
subject - Business object playing SUBJECT_ROLE of the association.
primary - boolean indicating whether or not subject is the primary subject of the forum.
Throws:
WTException
NotAuthorizedException

saveTopic

public DiscussionTopic saveTopic(DiscussionTopic topic)
                          throws WTException,
                                 NotAuthorizedException
Persist the topic if it doesnt already exist and update the existing one otherwise. Use this method instead of directly calling store, save or insert methods on the PersistenceManager or PersistenceManagerSvr. This method generates the NEW_DISCUSSION event if the the topic is new.

Supported API: false

Specified by:
saveTopic in interface ForumService
Parameters:
topic -
Returns:
DiscussionTopic
Throws:
WTException
NotAuthorizedException

getTopics

public Enumeration getTopics(Discussion parent)
                      throws WTException
Retrieves all the topics that are part of the given discussion. The discussion can only be either a Forum or a DiscussionTopic.

Supported API: false

Specified by:
getTopics in interface ForumService
Parameters:
parent - Discussion whose topics to retrieve.
Returns:
Enumeration
Throws:
WTException

saveTemplate

public CollaborationTemplate saveTemplate(CollaborationTemplate template)
                                   throws WTException
Persist the posting if it doesnt already exist and update the existing one otherwise.

Supported API: false

Specified by:
saveTemplate in interface ForumService
Parameters:
template -
Returns:
CollaborationTemplate
Throws:
WTException

savePosting

public DiscussionPosting savePosting(DiscussionPosting posting)
                              throws WTException
Persist the posting if it doesnt already exist and update the existing one otherwise. Use this method instead of directly calling store, save or insert methods on the PersistenceManager or PersistenceManagerSvr. This method generates the NEW_DISCUSSION event if the the posting is new.

Supported API: false

Specified by:
savePosting in interface ForumService
Parameters:
posting -
Returns:
DiscussionPosting
Throws:
WTException

getForums

public Enumeration getForums(WTObject subject)
                      throws WTException
Retrieves all the forums that the given SubjectOfForum is associated with.

Supported API: false

Specified by:
getForums in interface ForumService
Parameters:
subject - The subject whose forums are to be retrieved.
Returns:
Enumeration
Throws:
WTException

saveForum

public DiscussionForum saveForum(SubjectOfForum subject,
                                 DiscussionForum forum)
                          throws WTException
Persists the forum if it isnt already there, else updates the existing one.

Supported API: false

Specified by:
saveForum in interface ForumService
Parameters:
subject -
forum -
Returns:
DiscussionForum
Throws:
WTException

createForum

public DiscussionForum createForum(String templateName,
                                   String forumName,
                                   SubjectOfForum subject)
                            throws WTException
Deprecated.  

Creates and persists a Forum based on the strucutre defined in the given template and associates the given subject with this new forum. The subject becomes the primary subject of all discussions in this forum. This method can be used to programmatically create an instance of a given Forum based on a certain template and associated with a business object. For eg. everytime a new WTPart is created, this method with a constant ForumTemplate name and the new WTPart can be called so every instance of a WTPart comes with a Forum with some default structure.

Supported API: false

Specified by:
createForum in interface ForumService
Parameters:
templateName - The name of the template whose structure this forum should be based on.
forumName - The name of the forum.
subject - The business object that is to form the subject of discussions in this forum.
Returns:
DiscussionForum
Throws:
WTException

getPostings

public Enumeration getPostings(Discussion parent)
                        throws WTException
Retrieves all the postings that are part of the given Discussion.

Supported API: false

Specified by:
getPostings in interface ForumService
Parameters:
parent - The discussion whose postings to retrieve.
Returns:
Enumeration
Throws:
WTException

createForum

public DiscussionForum createForum(CollaborationTemplate template,
                                   String forumName,
                                   SubjectOfForum subject)
                            throws WTException
Deprecated.  

Creates and persists a Forum based on the strucutre defined in the given template and associates the given subject with this new forum. The subject becomes the primary subject of this forum.

Supported API: false

Specified by:
createForum in interface ForumService
Parameters:
template - The template containing the the structure to be used.
forumName - Name of the forum.
subject - The business object that is the primary subject of discussions in this forum.
Returns:
DiscussionForum
Throws:
WTException

getTemplate

public DiscussionForumTemplate getTemplate(String name,
                                           WTContainerRef containerRef)
                                    throws WTException
Retrieves the ForumTemplate given the name of the template.

Supported API: false

Specified by:
getTemplate in interface ForumService
Parameters:
name -
containerRef -
Returns:
DiscussionForumTemplate
Throws:
WTException

getForums

public Enumeration getForums(WTObject subject,
                             boolean otherSideOnly)
                      throws WTException
Retrieves all the forums that the given SubjectOfForum is associated with and if otherSideOnly is false, all the links that represent these associations .

Supported API: false

Specified by:
getForums in interface ForumService
Parameters:
subject - The subject whose forums are to be retrieved.
otherSideOnly - retrieve only the forums or the links as well.
Returns:
Enumeration
Throws:
WTException

getDefaultTemplate

public DiscussionForumTemplate getDefaultTemplate()
                                           throws WTException
Deprecated. in 7.0

Retrieves the ForumTemplate given the name of the template.

Supported API: false

Specified by:
getDefaultTemplate in interface ForumService
Returns:
DiscussionForumTemplate
Throws:
WTException

findForum

public Forum findForum(Discussion discussion)
                throws WTException


Supported API: false

Specified by:
findForum in interface ForumService
Parameters:
discussion -
Returns:
Forum
Throws:
WTException

findForumProject

public Project2 findForumProject(Forum forum)
                          throws WTException


Supported API: false

Specified by:
findForumProject in interface ForumService
Parameters:
forum -
Returns:
Project2
Throws:
WTException

getChildDiscussions

public HashMap getChildDiscussions(Discussion discussion,
                                   boolean attachments)
                            throws WTException
Returns all objects that have the container as their parent object.

Supported API: false

Specified by:
getChildDiscussions in interface ForumService
Parameters:
discussion -
attachments -
Returns:
HashMap
Throws:
WTException

getTemplate

public DiscussionForumTemplate getTemplate(String name)
                                    throws WTException
Retrieves the ForumTemplate given the name of the template.

Supported API: false

Specified by:
getTemplate in interface ForumService
Parameters:
name -
Returns:
DiscussionForumTemplate
Throws:
WTException

createForum

public DiscussionForum createForum(String templateName,
                                   String forumName,
                                   SubjectOfForum subject,
                                   WTContainerRef containerRef)
                            throws WTException
Creates and persists a Forum based on the strucutre defined in the given template and associates the given subject with this new forum. The subject becomes the primary subject of all discussions in this forum. This method can be used to programmatically create an instance of a given Forum based on a certain template and associated with a business object. For eg. everytime a new WTPart is created, this method with a constant ForumTemplate name and the new WTPart can be called so every instance of a WTPart comes with a Forum with some default structure.

Supported API: false

Specified by:
createForum in interface ForumService
Parameters:
templateName - The name of the template whose structure this forum should be based on.
forumName - The name of the forum.
subject - The business object that is to form the subject of discussions in this forum.
containerRef -
Returns:
DiscussionForum
Throws:
WTException

createForum

public DiscussionForum createForum(CollaborationTemplate template,
                                   String forumName,
                                   SubjectOfForum subject,
                                   WTContainerRef containerRef)
                            throws WTException
Creates and persists a Forum based on the strucutre defined in the given template and associates the given subject with this new forum. The subject becomes the primary subject of this forum.

Supported API: false

Specified by:
createForum in interface ForumService
Parameters:
template - The template containing the the structure to be used.
forumName - Name of the forum.
subject - The business object that is the primary subject of discussions in this forum.
containerRef -
Returns:
DiscussionForum
Throws:
WTException

getDefaultTemplate

public DiscussionForumTemplate getDefaultTemplate(WTContainerRef containerRef)
                                           throws WTException
Retrieves the ForumTemplate given the name of the template.

Supported API: false

Specified by:
getDefaultTemplate in interface ForumService
Parameters:
containerRef -
Returns:
DiscussionForumTemplate
Throws:
WTException

dispatchEvent

private void dispatchEvent(String eventType,
                           Object target)
                    throws WTException
Dispatch a ForumServiceEvent with eventType=eventType and target=target

Throws:
WTException

constructDiscussionThread

private void constructDiscussionThread(Vector findChildrenFor,
                                       Vector notMapped,
                                       HashMap finalDiscussionThread)
                                throws WTException
Throws:
WTException

startEventPropogationQueue

protected void startEventPropogationQueue()
                                   throws WTException
Starts event propogation queue.

Throws:
WTException

getForums

public WTHashSet getForums(WTCollection subject)
                    throws WTException
Throws:
WTException