Java Doc for ForumThread.java in  » Forum » yazd » com » Yasna » forum » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Forum » yazd » com.Yasna.forum 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.Yasna.forum.ForumThread

All known Subclasses:   com.Yasna.forum.database.DbForumThread,  com.Yasna.forum.ForumThreadProxy,
ForumThread
public interface ForumThread (Code)
A ForumThread is a container for a hierarchy of ForumMessages.

Intimately tied to the concept of a ForumThread is a root message. A root message must be supplied when creating a thread. Subsequently, all further messages posted to the thread are children of the root message.

To get a handle on a ForumThread object, the getThread method should be called from a Forum object. To create a thread, createThread from a Forum object should be used. After creating a thread, you must attach it to a Forum by calling addThread from a Forum object. To delete a ForumThread, call the deleteThread method from the Forum object that the thread is attached to.

There are two options for navigating through the messages of a thread.

  • A TreeWalker -- this provides a hierarchical view of the messages in in the thread. For most skins, this will be the most appropriate navigation method.
  • An Iterator -- this provides a flat view of the messages in the thread. Since the message structure is not really flat, a field to sort by must be provided. This view of thread is useful for skins that want to provide functionality such as listing all the messages in the order they were created, etc.
Because a root message must be passed in when creating a thread, you must first create that message before creating the thread. The following code snippet demonstrates:
 //Assume that a forum object and user object are already defined.
 ForumMessage rootMessage = myForum.createMessage(myUser);
 rootMessage.setSubject("A subject");
 rootMessage.setBody("A body");
 ForumThread myThread = myForum.createThread(rootMessage);
 




Method Summary
public  voidaddMessage(ForumMessage parentMessage, ForumMessage newMessage)
     Adds a new message to the thread.
public  voidaddReadCount()
     This method adds one to the read count. This should have been implemented at the database level, but due to caching it couldn't. Also it couldn't be added at the getThread level, since the ForumIterator uses the factory to get the thread for the list of the threads.
public  voiddeleteMessage(ForumMessage message)
     Deletes a message from the thread.
public  DategetCreationDate()
     Returns the Date that the thread was created.
public  ForumgetForum()
     Returns the parent Forum of the thread.
public  intgetID()
     Returns the unique id of the thread.
public  ForumMessagegetMessage(int messageID)
     Returns a message from the thread based on its id.
public  intgetMessageCount()
     Returns the number of messages in the thread.
public  DategetModifiedDate()
     Returns the Date that the thread was last modified.
public  StringgetName()
     Returns the name of the thread (which is the subject of the root message).
public  intgetReadCount()
     Returns the number of times this thread has been read.
public  ForumMessagegetRootMessage()
     Returns the root message of a thread.
public  ThreadTypegetThreadType()
    
public  booleanhasPermission(int type)
     Returns true if the handle on the object has the permission specified. A list of possible permissions can be found in the ForumPermissions class.
public  booleanisApproved()
     Returns whether the thread was approved.
public  booleanisClosed()
    
public  booleanisSticky()
    
public  Iteratormessages()
     Return an Iterator for all the messages in a thread.
public  Iteratormessages(int startIndex, int numResults)
     Return an Iterator for all the messages in a thread.
public  voidmoveMessage(ForumMessage message, ForumThread newThread, ForumMessage parentMessage)
     Moves a message from one thread to another.
public  voidsetApprovment(boolean approved)
     Used by moderators to approved a thread in moderated forum.
public  voidsetClosed(boolean param)
    
public  voidsetCreationDate(Date creationDate)
     Sets the creation date of the thread.
public  voidsetModifiedDate(Date modifiedDate)
     Sets the date the thread was last modified.
public  voidsetSticky(boolean param)
    
public  TreeWalkertreeWalker()
     Returns a TreeWalker for the entire thread.



Method Detail
addMessage
public void addMessage(ForumMessage parentMessage, ForumMessage newMessage) throws UnauthorizedException(Code)
Adds a new message to the thread.
Parameters:
  parentMessage - some message in the thread that will be parent
Parameters:
  newMessage - message to add to the thread under the parent



addReadCount
public void addReadCount()(Code)
This method adds one to the read count. This should have been implemented at the database level, but due to caching it couldn't. Also it couldn't be added at the getThread level, since the ForumIterator uses the factory to get the thread for the list of the threads. Therefore it would create an inacurate count. You manually have to add the count in the skin to return an accurate count.



deleteMessage
public void deleteMessage(ForumMessage message) throws UnauthorizedException(Code)
Deletes a message from the thread. Throws an IllegalArgumentException if the message is not in the thread. If the message is deleted, it should be entirely erased from the Forum system. Therefore, the behavior is unspecified if a message object is first removed from a thread and then added to another (this action not recommended).
throws:
  IllegalArgumentException - if the message does not belong to thethread.
throws:
  UnauthorizedException - if does not have ADMIN permissions.



getCreationDate
public Date getCreationDate()(Code)
Returns the Date that the thread was created.



getForum
public Forum getForum()(Code)
Returns the parent Forum of the thread.



getID
public int getID()(Code)
Returns the unique id of the thread.



getMessage
public ForumMessage getMessage(int messageID) throws ForumMessageNotFoundException(Code)
Returns a message from the thread based on its id.
Parameters:
  messageID - the ID of the message to get from the thread.



getMessageCount
public int getMessageCount()(Code)
Returns the number of messages in the thread. This includes the root message. So, to find the number of replies to the root message, subtract one from the answer of this method.



getModifiedDate
public Date getModifiedDate()(Code)
Returns the Date that the thread was last modified. In other words, the date of the most recent message in the thread.



getName
public String getName()(Code)
Returns the name of the thread (which is the subject of the root message). This is a convenience method that is equivalent to getRootMessage().getSubject(). the name of the thread, which is the subject of the root message.



getReadCount
public int getReadCount()(Code)
Returns the number of times this thread has been read. We also manually add the count each time the message is read from the cache, so we have an accurate count of the times the thread has been read.



getRootMessage
public ForumMessage getRootMessage()(Code)
Returns the root message of a thread. The root message is a special first message that is intimately tied to the thread for most forumViews. All other messages in the thread are children of the root message.



getThreadType
public ThreadType getThreadType()(Code)



hasPermission
public boolean hasPermission(int type)(Code)
Returns true if the handle on the object has the permission specified. A list of possible permissions can be found in the ForumPermissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
See Also:   ForumPermissions



isApproved
public boolean isApproved()(Code)
Returns whether the thread was approved. When forum is not modereted this method always will return true; true if the thread was approved.



isClosed
public boolean isClosed()(Code)



isSticky
public boolean isSticky()(Code)



messages
public Iterator messages()(Code)
Return an Iterator for all the messages in a thread.



messages
public Iterator messages(int startIndex, int numResults)(Code)
Return an Iterator for all the messages in a thread. The startIndex and numResults restrict the number of results returned, which is useful for multi-page HTML navigation.
Parameters:
  startIndex - the index you'd like to start the iterator at.
Parameters:
  numResuls - the max number of results iterator will hold.



moveMessage
public void moveMessage(ForumMessage message, ForumThread newThread, ForumMessage parentMessage) throws UnauthorizedException, IllegalArgumentException(Code)
Moves a message from one thread to another. The message will become a child of parentMessage in newThread For this to work, message must exist in the thread that this method is invoked on, parentMessage must be in newThread, and the user calling this method must have ADMIN permissions for the forum this method is invoked on and the forum that newThread belongs to.

The main purpose of this method is to allow admins to move non-topical messages into a more appropriate thread.
Parameters:
  message - the message to move to another thread.
Parameters:
  newThread - the thread to move the message to.
Parameters:
  parentMessage - the message under newThread that messageshould become a child of.
throws:
  UnauthorizedException - if does not have ADMIN permissions for thethis forum and the forum that newThread belongs to.
throws:
  IllegalArgumentException - if message does not belongto the thread that this method is invoked on, or parentMessage does not belong to newThread.




setApprovment
public void setApprovment(boolean approved) throws UnauthorizedException(Code)
Used by moderators to approved a thread in moderated forum.
Parameters:
  approved - when true this thread will be visible for all.
throws:
  UnauthorizedException - if does not have ADMIN permissions.



setClosed
public void setClosed(boolean param) throws UnauthorizedException(Code)



setCreationDate
public void setCreationDate(Date creationDate) throws UnauthorizedException(Code)
Sets the creation date of the thread. In most cases, the creation date will default to when the thread was entered into the system. However, the creation date needs to be set manually when importing data. In other words, skin authors should ignore this method since it only intended for system maintenance.
Parameters:
  creationDate - the date the thread was created.
throws:
  UnauthorizedException - if does not have ADMIN permissions.



setModifiedDate
public void setModifiedDate(Date modifiedDate) throws UnauthorizedException(Code)
Sets the date the thread was last modified. In most cases, last modifed will default to when the thread data was last changed. However, the last modified date needs to be set manually when importing data. In other words, skin authors should ignore this method since it only intended for system maintenance.
Parameters:
  modifiedDate - the date the thread was modified.
throws:
  UnauthorizedException - if does not have ADMIN permissions.



setSticky
public void setSticky(boolean param) throws UnauthorizedException(Code)



treeWalker
public TreeWalker treeWalker()(Code)
Returns a TreeWalker for the entire thread. A TreeWalker is used to navigate through the tree of messages in a hierarchical manner.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.