org.exoplatform.faq.service
Class QuestionPageList

java.lang.Object
  extended by org.exoplatform.faq.service.JCRPageList
      extended by org.exoplatform.faq.service.QuestionPageList

public class QuestionPageList
extends JCRPageList

All questions and their properties, methods are getted from database to view in page will be restore in this class. And ratification, questions can be sorted by alphabet or by date time when quetsion is created.

Since:
Mar 08, 2008
Author:
Hung Nguyen (hung.nguyen@exoplatform.com)

Field Summary
 
Fields inherited from class org.exoplatform.faq.service.JCRPageList
available_, availablePage_, currentListCategory_, currentListObject_, currentListPage_, currentListResultSearch_, currentListWatch_, currentPage_
 
Constructor Summary
QuestionPageList(List<Category> listCategories)
          Instantiates a new question page list.
QuestionPageList(List<ObjectSearchResult> faqFormSearchs, long pageSize)
          Instantiates a new question page list.
QuestionPageList(List<Question> listQuestions, int size)
          Instantiates a new question page list.
QuestionPageList(List<Watch> listWatch, double page)
          Instantiates a new question page list.
QuestionPageList(javax.jcr.NodeIterator iter, long pageSize, String value, boolean isQuery)
          Class constructor specifying iter contain quetion nodes, value, it's query or not, how to sort all question.
QuestionPageList(javax.jcr.Node categoryNode, String quesQuerry, List<Object> listObject, FAQSetting setting)
          Instantiates a new question page list.
 
Method Summary
 List<Question> getAll()
          Get all nodes is stored in a NodeIterator and sort them by FAQSetting, with each node, system get all values of this node and set them into a question object, an this question object is push into a list questions.
 List<Watch> getAllWatch()
           
 Answer getAnswerByNode(javax.jcr.Node answerNode)
           
 Answer[] getAnswers(javax.jcr.Node questionNode)
           
 Comment[] getComment(javax.jcr.Node questionNode)
           
 Comment getCommentByNode(javax.jcr.Node commentNode)
           
protected  void populateCurrentPage(long page, String username)
          Get questions to view in page.
protected  void populateCurrentPageCategoriesQuestionsSearch(long page, String username)
           
protected  void populateCurrentPageCategoriesSearch(long page, String username)
           
protected  void populateCurrentPageItem(long page)
           
protected  void populateCurrentPageQuestionsSearch(long page, String username)
           
protected  void populateCurrentPageResultSearch(long page, String username)
           
protected  void populateCurrentPageWatch(long page, String username)
           
 void setList(List<Question> contacts)
          abtract funtion, set list question to view
 void setNotYetAnswered(boolean isNotYetAnswered)
          Sets the not yet answered.
 void setOpenQuestion(boolean isOpenQuestion)
           
 
Methods inherited from class org.exoplatform.faq.service.JCRPageList
checkAndSetPage, currentPage, getAvailable, getAvailablePage, getCurrentPage, getObjectId, getPage, getPageItem, getPageJump, getPageListCategoriesQuestions, getPageListWatch, getPageResultCategoriesSearch, getPageResultQuestionsSearch, getPageResultSearch, getPageSize, setAvailablePage, setObjectId, setPageJump, setPageSize, setQuestion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuestionPageList

public QuestionPageList(javax.jcr.NodeIterator iter,
                        long pageSize,
                        String value,
                        boolean isQuery)
                 throws Exception
Class constructor specifying iter contain quetion nodes, value, it's query or not, how to sort all question.

Parameters:
iter - NodeIterator use to store question nodes
pageSize - this param is used to set number of question per page
value - query string is used to get question node
isQuery - is true is param value is query string and is false if opposite
Throws:
Exception - if repository occur exception

QuestionPageList

public QuestionPageList(List<ObjectSearchResult> faqFormSearchs,
                        long pageSize)
Instantiates a new question page list.

Parameters:
faqFormSearchs - the faq form searchs
pageSize - the page size

QuestionPageList

public QuestionPageList(List<Watch> listWatch,
                        double page)
                 throws Exception
Instantiates a new question page list.

Parameters:
listWatch - the list watch
page - the page
Throws:
Exception - the exception

QuestionPageList

public QuestionPageList(List<Category> listCategories)
                 throws Exception
Instantiates a new question page list.

Parameters:
listCategories - the list categories
Throws:
Exception - the exception

QuestionPageList

public QuestionPageList(List<Question> listQuestions,
                        int size)
                 throws Exception
Instantiates a new question page list.

Parameters:
listQuestions - the list questions
size - the size
Throws:
Exception - the exception

QuestionPageList

public QuestionPageList(javax.jcr.Node categoryNode,
                        String quesQuerry,
                        List<Object> listObject,
                        FAQSetting setting)
                 throws Exception
Instantiates a new question page list.

Parameters:
categoryNode - the category node
quesQuerry - the ques querry
listObject - the list object
setting - the setting
Throws:
Exception - the exception
Method Detail

setNotYetAnswered

public void setNotYetAnswered(boolean isNotYetAnswered)
Sets the not yet answered. Set parameter is true if want get questions are not yet answered opposite set is false or don't do (default value is false)

Parameters:
isNotYetAnswered - the new not yet answered, is true if want get questoins not yet answered and is false if opposite

setOpenQuestion

public void setOpenQuestion(boolean isOpenQuestion)

populateCurrentPage

protected void populateCurrentPage(long page,
                                   String username)
                            throws Exception
Get questions to view in page. Base on total questions, number of question per page, current page, this function get right questions. For example: have 100 questions, view 10 questions per page, and current page is 1, this function will get questions form first question to tenth question and put them into a list which is viewed.

Specified by:
populateCurrentPage in class JCRPageList
Parameters:
username - the name of current user
page - number of current page
Throws:
Exception - the exception
See Also:
JCRPageList.populateCurrentPage(long, java.lang.String)

populateCurrentPageItem

protected void populateCurrentPageItem(long page)
                                throws Exception
Specified by:
populateCurrentPageItem in class JCRPageList
Throws:
Exception

populateCurrentPageWatch

protected void populateCurrentPageWatch(long page,
                                        String username)
                                 throws Exception
Specified by:
populateCurrentPageWatch in class JCRPageList
Throws:
Exception

populateCurrentPageResultSearch

protected void populateCurrentPageResultSearch(long page,
                                               String username)
                                        throws Exception
Specified by:
populateCurrentPageResultSearch in class JCRPageList
Throws:
Exception

populateCurrentPageCategoriesSearch

protected void populateCurrentPageCategoriesSearch(long page,
                                                   String username)
                                            throws Exception
Specified by:
populateCurrentPageCategoriesSearch in class JCRPageList
Throws:
Exception

populateCurrentPageQuestionsSearch

protected void populateCurrentPageQuestionsSearch(long page,
                                                  String username)
                                           throws Exception
Specified by:
populateCurrentPageQuestionsSearch in class JCRPageList
Throws:
Exception

populateCurrentPageCategoriesQuestionsSearch

protected void populateCurrentPageCategoriesQuestionsSearch(long page,
                                                            String username)
                                                     throws Exception
Specified by:
populateCurrentPageCategoriesQuestionsSearch in class JCRPageList
Throws:
Exception

getAnswers

public Answer[] getAnswers(javax.jcr.Node questionNode)
                    throws Exception
Throws:
Exception

getAnswerByNode

public Answer getAnswerByNode(javax.jcr.Node answerNode)
                       throws Exception
Throws:
Exception

getComment

public Comment[] getComment(javax.jcr.Node questionNode)
                     throws Exception
Throws:
Exception

getCommentByNode

public Comment getCommentByNode(javax.jcr.Node commentNode)
                         throws Exception
Throws:
Exception

getAll

public List<Question> getAll()
                      throws Exception
Get all nodes is stored in a NodeIterator and sort them by FAQSetting, with each node, system get all values of this node and set them into a question object, an this question object is push into a list questions.

Specified by:
getAll in class JCRPageList
Returns:
list questions
Throws:
Exception - if query or repository or path of node is occur Exception
Exception - the exception
See Also:
Question, List

getAllWatch

public List<Watch> getAllWatch()
                        throws Exception
Throws:
Exception

setList

public void setList(List<Question> contacts)
Description copied from class: JCRPageList
abtract funtion, set list question to view

Specified by:
setList in class JCRPageList
Parameters:
contacts - list question


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.