org.exoplatform.faq.service
Class JCRPageList

java.lang.Object
  extended by org.exoplatform.faq.service.JCRPageList
Direct Known Subclasses:
QuestionPageList

public abstract class JCRPageList
extends Object

Abstract class JCRPageList provide functions for pagination when view question content in web page.

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

Field Summary
protected  long available_
           
protected  long availablePage_
           
protected  List<Category> currentListCategory_
           
protected  List currentListObject_
           
protected  List<Question> currentListPage_
           
protected  List<ObjectSearchResult> currentListResultSearch_
           
protected  List<Watch> currentListWatch_
           
protected  long currentPage_
           
 
Constructor Summary
JCRPageList(long pageSize)
          Constructor set pagesize for JCRPageList, pagesize is number of objects per page for example: pagesize = 10 it's mean view 10 object per page
 
Method Summary
protected  void checkAndSetPage(long page)
          Check the index of page, if page is less than max and larger than 0 then set page to be current page else throw exception
 List<Question> currentPage(String username)
          Get objects (question objects) is viewed in current page
abstract  List<Question> getAll()
          abstract function to get all question.
 long getAvailable()
          Get total of questions in list questions are contained
 long getAvailablePage()
          Get total pages
 long getCurrentPage()
          Get index of current page which is viewing
 String getObjectId()
           
 List<Question> getPage(long page, String username)
          get list questions are viewed in page which have index is specified.
 List getPageItem(long page)
           
 long getPageJump()
           
 List<Object> getPageListCategoriesQuestions(long page, String username)
           
 List<Watch> getPageListWatch(long page, String username)
           
 List<Category> getPageResultCategoriesSearch(long page, String username)
           
 List<Question> getPageResultQuestionsSearch(long page, String username)
           
 List<ObjectSearchResult> getPageResultSearch(long page, String username)
           
 long getPageSize()
          Get page size, return number of quesitons per page
protected abstract  void populateCurrentPage(long page, String username)
          Abstract funtion, get list question to view in current page
protected abstract  void populateCurrentPageCategoriesQuestionsSearch(long page, String username)
           
protected abstract  void populateCurrentPageCategoriesSearch(long page, String username)
           
protected abstract  void populateCurrentPageItem(long page)
           
protected abstract  void populateCurrentPageQuestionsSearch(long page, String username)
           
protected abstract  void populateCurrentPageResultSearch(long page, String username)
           
protected abstract  void populateCurrentPageWatch(long page, String username)
           
protected  void setAvailablePage(long available)
          Sets the available page.
abstract  void setList(List<Question> questions)
          abtract funtion, set list question to view
 void setObjectId(String id)
           
 void setPageJump(long pageJump)
           
 void setPageSize(long pageSize)
          Set pagesize for JCRPageList, pagesize is number of objects per page for example: pagesize = 10 it's mean view 10 object per page
 void setQuestion(List<Question> questions, boolean isUpdate)
          Set questions for current page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

available_

protected long available_

availablePage_

protected long availablePage_

currentPage_

protected long currentPage_

currentListPage_

protected List<Question> currentListPage_

currentListObject_

protected List currentListObject_

currentListCategory_

protected List<Category> currentListCategory_

currentListResultSearch_

protected List<ObjectSearchResult> currentListResultSearch_

currentListWatch_

protected List<Watch> currentListWatch_
Constructor Detail

JCRPageList

public JCRPageList(long pageSize)
Constructor set pagesize for JCRPageList, pagesize is number of objects per page for example: pagesize = 10 it's mean view 10 object per page

Parameters:
pageSize - the number of object per page
Method Detail

getObjectId

public String getObjectId()

setObjectId

public void setObjectId(String id)

getPageSize

public long getPageSize()
Get page size, return number of quesitons per page

Returns:
number of object per page

setPageSize

public void setPageSize(long pageSize)
Set pagesize for JCRPageList, pagesize is number of objects per page for example: pagesize = 10 it's mean view 10 object per page

Parameters:
pageSize - the number of object per page

getCurrentPage

public long getCurrentPage()
Get index of current page which is viewing

Returns:

getAvailable

public long getAvailable()
Get total of questions in list questions are contained

Returns:
total of questions

getAvailablePage

public long getAvailablePage()
Get total pages

Returns:
total pages

currentPage

public List<Question> currentPage(String username)
                           throws Exception
Get objects (question objects) is viewed in current page

Parameters:
username - the name of current user
Returns:
list quesitons are viewed in current page
Throws:
Exception - the exception

setQuestion

public void setQuestion(List<Question> questions,
                        boolean isUpdate)
                 throws Exception
Set questions for current page. If isUpdate is true then change list question in current page by list quetions are specified, else delete all quesiton is viewed in current page

Parameters:
questions - List questions is used to update
isUpdate - is true if want update questions in current page is false if want delete questions in current page
Throws:
Exception - the exception

populateCurrentPage

protected abstract void populateCurrentPage(long page,
                                            String username)
                                     throws Exception
Abstract funtion, get list question to view in current page

Parameters:
page - index of page is viewed
username - the name of user
Throws:
Exception - the exception

getPage

public List<Question> getPage(long page,
                              String username)
                       throws Exception
get list questions are viewed in page which have index is specified. The first check index of page if it's less than max and larger than 0 then get questions in this page else throw exception

Parameters:
page - the index of page want process
username - the name of user
Returns:
list quesiton is view in the page which is specified
Throws:
Exception - if index of page is less than 0 or larger than max

populateCurrentPageItem

protected abstract void populateCurrentPageItem(long page)
                                         throws Exception
Throws:
Exception

getPageItem

public List getPageItem(long page)
                 throws Exception
Throws:
Exception

populateCurrentPageResultSearch

protected abstract void populateCurrentPageResultSearch(long page,
                                                        String username)
                                                 throws Exception
Throws:
Exception

getPageResultSearch

public List<ObjectSearchResult> getPageResultSearch(long page,
                                                    String username)
                                             throws Exception
Throws:
Exception

populateCurrentPageCategoriesSearch

protected abstract void populateCurrentPageCategoriesSearch(long page,
                                                            String username)
                                                     throws Exception
Throws:
Exception

getPageResultCategoriesSearch

public List<Category> getPageResultCategoriesSearch(long page,
                                                    String username)
                                             throws Exception
Throws:
Exception

populateCurrentPageQuestionsSearch

protected abstract void populateCurrentPageQuestionsSearch(long page,
                                                           String username)
                                                    throws Exception
Throws:
Exception

getPageResultQuestionsSearch

public List<Question> getPageResultQuestionsSearch(long page,
                                                   String username)
                                            throws Exception
Throws:
Exception

populateCurrentPageCategoriesQuestionsSearch

protected abstract void populateCurrentPageCategoriesQuestionsSearch(long page,
                                                                     String username)
                                                              throws Exception
Throws:
Exception

getPageListCategoriesQuestions

public List<Object> getPageListCategoriesQuestions(long page,
                                                   String username)
                                            throws Exception
Throws:
Exception

populateCurrentPageWatch

protected abstract void populateCurrentPageWatch(long page,
                                                 String username)
                                          throws Exception
Throws:
Exception

getPageListWatch

public List<Watch> getPageListWatch(long page,
                                    String username)
                             throws Exception
Throws:
Exception

getAll

public abstract List<Question> getAll()
                               throws Exception
abstract function to get all question.

Returns:
list of quesitons
Throws:
Exception - if question node not found

setList

public abstract void setList(List<Question> questions)
abtract funtion, set list question to view

Parameters:
questions - list question

checkAndSetPage

protected void checkAndSetPage(long page)
Check the index of page, if page is less than max and larger than 0 then set page to be current page else throw exception

Parameters:
page - index of page

setAvailablePage

protected void setAvailablePage(long available)
Sets the available page. Base on total objects available to set total pages for pagination.

Parameters:
available - the number of objects

setPageJump

public void setPageJump(long pageJump)

getPageJump

public long getPageJump()


Copyright © 2013 eXo Platform SAS. All Rights Reserved.