Lucky Dip Logo
Powered by PlusNet. PlusNet broadband.
Patrick's Lucky Dip
Home > Java > wiki > wiki Java Classes

Patrick Haston
27 November 2008

wiki Java Classes

Click on the name of the class to view the source code.

Page

Most of the top-level processing is done by this class.

Class Attributes:
  • private String page_name - The name of the current page.
  • private String page_html - The html that to be displayed.
  • private Database db - the database connection information.
  • private OracleDataSource ods - the Oracle data source.
Class Methods:
  • public String viewPage(String page_name, String user_id, String search_for)
    Returns the html of the page content for displaying in the view tab. The page_name is the name of the page, the user_id is the oid user id of the person viewing the page. This is used to decide whether or not to display the edit links. The search_for value is set if the page is being displayed as the result of a search, in which case the search terms are highlighted on the page.
  • public String discussionPage(String page_name, String user_id, String reply_to )
  • public String historyPage(String page_name, String user_id)
  • public String editPage(String page_name, String user_id)
  • public String getPageInfo(String page_name, String user_id)
  • public String addPage(String new_page_name, String user_id)
  • public String renamePage(String page_name, String new_page_name)
  • public String getName(String page_name, String section_id, String text_id)
  • public String setPageOwner(String page_name, String owner)
  • public String setModeration(String page_name, String moderation)
  • public String searchResults(String search_for, String user_id, String search_page_title, String search_section_title, String search_in_text, String search_page, String search_id)
  • private String highlightSearchTerms(String text, String search_for)

Section

This class handles the creation and display of sections. Versioning is done at a section level rather than a page level.

Class Attributes:
  • private Database db - the database connection information.
  • private OracleDataSource ods - the Oracle data source.
Class Methods:
  • public String showHistory(String section_id, String user_id)
  • public String addSection(String page_name, String section_name)
  • public String insertSection(String section_name, String before_section_id)
  • public String moveSectionUp(String section_id)
  • public String moveSectionDown(String section_id)
  • public String renameSection(String section_id, String new_section_name)
  • public String deleteSection(String section_id)
  • public String unDeleteSection(String section_id)
  • private String addSectionText(String page_id)

Text

Each section of text is stored in the wiki_text table. Every time this text is edited a new row is created, keeping a full version history. I've not written any housekeeping routines yet, that will no doubt follow in a future version.

Class Attributes:
  • private Database db - the database connection information.
  • private OracleDataSource ods - the Oracle data source.
Class Methods:
  • public String edit(String section_id)
  • public String update(String section_id, String text, String updater)
  • public String authorise(String text_id, String authoriser)
    Not implemented yet
  • public String parseText(String text)
  • public String parseLink(String link)
  • public boolean isUnmoderated(String section_id, String user_id)

User

The only function of this class so far is to create a select list of the current wiki users so that page ownership can be re-assigned. If you wanted, you could replace this with a free text box, but this would be a risky approach.

Class Attributes:
  • private OracleDataSource ods - the Oracle data source.
  • private String dbUrl
  • private String dbUser
  • private String dbPassword
Class Methods:
  • public String getSelect(String selectName, String network_id)

Comment

Helps manage the comments in the discussion page.

Class Attributes:
  • private OracleDataSource ods - the Oracle data source.
  • private String dbUrl
  • private String dbUser
  • private String dbPassword
Class Methods:
  • public String showComments(String comment_id, String user_id, String reply_to, String page_id)
  • public String saveComment(String page_id, String comment_type, String comment_title, String comment_text, String reply_to, String user_id)

CommentType

Provides a mechanism to generate a drop-down list of comment types.

Class Attributes:
  • private OracleDataSource ods - the Oracle data source.
  • private String dbUrl
  • private String dbUser
  • private String dbPassword
Class Methods:
  • public String getSelect(String selectName)

Database

This is a "helper" class. It is used to simply store the connection information to the database. You will have to edit this to point this at your own database.

Class Attributes:
  • private String dbUrl
  • private String dbUser
  • private String dbPassword
Class Methods:
  • public String getDbUrl()
  • public String getDbUser()
  • public String getDbPassword()