Wiki features implemented during Sprint May-09

  • Developer: Uros
  • Leadership Sponsor: Roger Bly

From user perspective

During this sprint the following wiki user stories were implemented in pnet:

  1. every user can access wiki features from within project workspace (meaning that every project has link for it’s wiki page),
  2. by clicking on wiki navbar link within selected project, if wiki page for that project doesn’t exist in database (isn’t created yet) the welcome page is displayed saying the user that wiki page for specified project doesn’t exist and giving the user link for creating wiki page with same name as the name of the project you are currently working with,

  1. if the wiki page for that specific project is already created (if it exists), the page will be presented to the user (in HTML), with possibility to edit it (link Edit this page?).

Viewing existing wiki page

  1. By clicking on edit link you are on the page for editing (with textarea and menu links for Save/Preview/Cancel functionalities).

  1. User has option to delete existing wiki page by cliking on Delete Page menu link.
  2. User has possibility to navigate through pages by cilcking on the name of previous page (parent page of the current that the user is on), or the Start Page link in the wiki menu.

Database layer

For now only one wiki database table exists for wiki features:

PN_WIKI_PAGE (wiki_page_id, page_name, content, edit_date, edited_by, owner_object_id, parent_page_name).

This object has following columns and constraints:

WIKI_PAGE_ID NUMBER(20,0),

PAGE_NAME VARCHAR2(240 BYTE),
CONTENT CLOB,
PARENT_PAGE_NAME VARCHAR2(240 BYTE),
EDIT_DATE DATE,
EDITED_BY NUMBER(20,0),
OWNER_OBJECT_ID NUMBER(20),

CONSTRAINT WIKI_PAGE_PK PRIMARY KEY (WIKI_PAGE_ID) ENABLE, CONSTRAINT WIKI_PAGE_EDITED_BY_FK FOREIGN KEY (EDITED_BY) REFERENCES PNET.PN_PERSON (PERSON_ID) ENABLE, CONSTRAINT WIKI_PAGE_OWNER_OBJECT_FK FOREIGN KEY (OWNER_OBJECT_ID) REFERENCES PNET.PN_OBJECT (OBJECT_ID) ENABLE, CONSTRAINT WIKI_PAGE_UQ UNIQUE (PAGE_NAME, OWNER_OBJECT_ID)

Service layer

Service layer has been implemented using hibernate and spring layer, as it is with other objects in pnet.

Hibernate Persistence class for PN_WIKI_PAGE is:

public class PnWikiPage? implements Serializable {

// primary key
private java.lang.Integer wikiPageId;
// fields
private java.lang.String pageName;
private java.lang.String content;
private java.util.Date editDate;
private java.lang.String parentPageName;
// many to one
private net.project.hibernate.model.PnPerson? editedBy;
private net.project.hibernate.model.PnObject? ownerObjectId;
...

}

This class has its sprint service interface and implementation class. Service interface has:

public interface IPnWikiPageService {

public java.lang.Integer save(net.project.hibernate.model.PnWikiPage? pnWikiPage);
public void update(net.project.hibernate.model.PnWikiPage? pnWikiPage);
public net.project.hibernate.model.PnWikiPage? get(java.lang.Integer key);
public java.util.List<net.project.hibernate.model.PnWikiPage?> findAll ();
public void delete(net.project.hibernate.model.PnWikiPage? pnWikiPage);
public PnWikiPage? getWikiPageWithName(String pageName, Integer ownerObjectId);
public void deletePageWithSubpages(PnWikiPage? pnWikiPage);

}

Spring Controller

For this sprint I have been using spring's MultiActinController? for wiki implementation, which offers possibility to aggregate multiple actions into one controller, and allowing to group functionality together. Controller for wiki features is:

public class WikiActionController? extends MultiActionController? {

  • Method used for viewing wiki pages.

public ModelAndView? view(HttpServletRequest? request, HttpServletResponse? response) {

  • Method used for editing wiki pages.

public ModelAndView? edit(HttpServletRequest? request, HttpServletResponse? response) {

  • Method used for saving wiki pages.

public ModelAndView? save(HttpServletRequest? request, HttpServletResponse? response) {

  • Shows the welcome page (by clicking on <b>wiki</b> link for specific project) that has no wiki page created. Called from NavBar?.jsp

public ModelAndView? welcome(HttpServletRequest? request, HttpServletResponse? response) {

  • Method used for previewing wiki pages.

public ModelAndView? preview(HttpServletRequest? request, HttpServletResponse? response) {

  • Method used for deleting wiki pages.

public ModelAndView? delete(HttpServletRequest? request, HttpServletResponse? response) {

  • Method used for help wiki page.

public ModelAndView? help(HttpServletRequest? request, HttpServletResponse? response) {

And helper methods

  • Method for converting wiki marcup text to html marcup. All links are parsed correctly.

private String convertToHtml(String wikiText, String parentPage) {

  • Method that finds CamelCase words and converts them in wiki links.

public String camelCaseRecognition(String wikiText) {

User Interface

For front end during this sprint the jsp pages have been used. The next sprint plan is to transform presentation layer to use Tapestry 5.

UI Interface

The following jsp pages are used for wiki:

  • View.jsp
  • Edit.jsp
  • Create.jsp
  • Help.jsp

Testing

For possibility to test wiki features I wrote the following test cases: Test Cases Sprint May-09.

And related to them the following acceptance tests can be found in package test\acceptance\src\net\project\test\acceptance\wiki:

Attachments