org.exoplatform.faq.service.impl
Class FAQServiceImpl

java.lang.Object
  extended by org.exoplatform.faq.service.impl.FAQServiceImpl
All Implemented Interfaces:
FAQService, FAQServiceLegacy, org.picocontainer.Startable

public class FAQServiceImpl
extends Object
implements FAQService, org.picocontainer.Startable


Field Summary
static int CATEGORY
           
protected  List<AnswerEventListener> listeners_
           
static int QUESTION
           
static int SEND_EMAIL
           
 
Constructor Summary
FAQServiceImpl(org.exoplatform.container.xml.InitParams params, org.exoplatform.forum.common.jcr.KSDataLocation locator, org.exoplatform.container.configuration.ConfigurationManager configManager)
           
 
Method Summary
 void addInitialDataPlugin(InitialDataPlugin plugin)
          Adds plugin to initialize default FAQ data.
 void addLanguage(javax.jcr.Node questionNode, QuestionLanguage language)
          Adds the language node, when question have multiple language, each language is a child node of question node.
 void addLanguage(String questionPath, QuestionLanguage language)
          Adds language to a question.
 void addListenerPlugin(AnswerEventListener listener)
          Adds listener for answer.
 void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
          Adds the plugin.
 void addRolePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
          Adds the plugin.
 void addTemplatePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
           
 void addWatch(String id, Watch watch, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This function is used to allow user can watch a category.
 void addWatchCategory(String id, Watch watch)
          Adds watch a category.
 void addWatchQuestion(String questionId, Watch watch, boolean isNew)
          Adds watch for a question.
 void addWatchQuestion(String questionId, Watch watch, boolean isNew, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 CategoryTree buildCategoryTree(String categoryId)
          Builds category tree of provided id.
 void calculateDeletedUser(String userName)
          Calculates deleted user.
 void changeStatusCategoryView(List<String> listCateIds)
          Changes status of view of category.
 void changeStatusCategoryView(List<String> listCateIds, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 InputStream createAnswerRSS(String cateId)
          Creates RSS for answer.
 void deleteAnswer(String questionId, String answerId)
          Removes an answer.
 void deleteAnswer(String questionId, String answerId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void deleteAnswerQuestionLang(String questionPath, String answerId, String language)
          Deletes language in a answer.
 void deleteCategoryWatch(String categoryId, String user)
          Deletes watch in one category.
 void deleteComment(String questionId, String commentId)
          Removes comment of question.
 void deleteComment(String questionId, String commentId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void deleteCommentQuestionLang(String questionPath, String commentId, String language, boolean isPromoted)
          Deletes language in a comment.
 void deleteMailInWatch(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String user)
          This function will delete watch in one category
 long existingCategories()
          Gets number of categories.
 InputStream exportData(String categoryId, boolean createZipFile)
          Exports category to stream.
 String getActivityIdForAnswer(String ownerPath, Answer answer)
          Gets value of exo:activityId property in answer node via path.
 String getActivityIdForComment(String ownerPath, String commentId, String language)
          Gets value of exo:activityId property in comment node base on provided path.
 String getActivityIdForQuestion(String ownerPath)
          Gets value of exo:activityId property in question node via path.
 List<Category> getAllCategories()
          Gets all categories.
 List<Category> getAllCategories(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This method get all the category
 List<String> getAllFAQAdmin()
          This method get all admin in FAQ
 QuestionPageList getAllQuestions()
          Gets all questions
 QuestionPageList getAllQuestions(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This method get all the question and convert to list of question object (QuestionPageList)
 QuestionPageList getAllQuestionsByCatetory(String categoryId, FAQSetting faqSetting)
          Gets all questions of the category.
 QuestionPageList getAllQuestionsByCatetory(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, FAQSetting faqSetting)
          This method get all questions via category identify and convert to list of question list
 Answer getAnswerById(String questionId, String answerid)
          Gets answer of question.
 Answer getAnswerById(String questionId, String answerid, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 Answer getAnswerById(String questionPath, String answerid, String language)
          Gets answer object.
 Category getCategoryById(String categoryId)
          Gets category by id.
 Category getCategoryById(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          Returns an category that can then be get property of this category.
 long[] getCategoryInfo(String categoryId, FAQSetting setting)
          Gets some informations of category: Lookup category node by category's id and count sub-categories and questions are contained in this category.
 CategoryInfo getCategoryInfo(String categoryPath, List<String> categoryIdScoped)
          Gets informations about category.
 long[] getCategoryInfo(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, FAQSetting setting)
          This method get some informations of category: to count sub-categories, to count questions, to count question have not yet answer, to count question is not approved are contained in this category
 String getCategoryNameOf(String categoryPath)
          Gets name of category.
 javax.jcr.Node getCategoryNodeById(String categoryId)
          Gets category node.
 javax.jcr.Node getCategoryNodeById(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 List<String> getCategoryPath(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String categoryId)
          This method return path of category identify
 List<String> getCategoryPath(String categoryId)
          Gets path of category by category id.
 String getCategoryPathOf(String id)
          Gets path of Category by id.
 String getCategoryPathOfQuestion(String questionPath)
          Gets path of question.
 String getCategoryPathOfQuestion(String questionPath, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 Comment getCommentById(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String questionId, String commentId)
           
 Comment getCommentById(String questionId, String commentId)
          Gets comment of question.
 Comment getCommentById(String questionPath, String commentId, String language)
          Gets Comment of question.
 Comment[] getComments(String questionId)
          Gets comments of a question.
 QuestionPageList getListCategoriesWatch(String userId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 List<String> getListCateIdByModerator(String user)
          Get all categories of specific provided user.
 List<String> getListCateIdByModerator(String user, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This method should lookup all the categories node so find category have user in moderators and convert to category object and return list of category object
 QuestionPageList getListMailInWatch(String categoryId)
          Gets email addresses that watch in a category.
 QuestionPageList getListQuestionsWatch(FAQSetting faqSetting, String currentUser)
          Gets list of questions that user watches.
 QuestionPageList getListQuestionsWatch(FAQSetting faqSetting, String currentUser, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 long getMaxindexCategory(String parentId)
          Gets max index of categories.
 long getMaxindexCategory(String parentId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 org.exoplatform.forum.common.NotifyInfo getMessageInfo(String name)
          Gets informations about message.
 String[] getModeratorsOf(String path)
          Gets moderators of question or category.
 JCRPageList getPageListAnswer(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String questionId, boolean isSortByVote)
           
 JCRPageList getPageListAnswer(String questionId, boolean isSortByVote)
          Gets answers of question.
 JCRPageList getPageListComment(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String questionId)
           
 JCRPageList getPageListComment(String questionId)
          Gets comments of question.
 String getParentCategoriesName(String path)
          Gets name of parent category.
 Iterator<org.exoplatform.forum.common.NotifyInfo> getPendingMessages()
          This function will send all the pending notification message
 QuestionPageList getPendingQuestionsByCategory(String categoryId, FAQSetting faqSetting)
          Gets list pending questions in a category.
 QuestionPageList getPendingQuestionsByCategory(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, FAQSetting faqSetting)
           
 Question getQuestionById(String questionId)
          Gets a question by id.
 Question getQuestionById(String questionId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This method should get question node via identify
 List<String> getQuestionContents(List<String> paths)
          Gets titles of questions.
 QuestionLanguage getQuestionLanguageByLanguage(String questionPath, String language)
          Gets language of question.
 List<QuestionLanguage> getQuestionLanguages(String questionId)
          Gets all language nodes of question node which have id is specified, with each language node get properties of them and set into QuestionLanguage object.
 List<QuestionLanguage> getQuestionLanguages(String questionId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This method should lookup languageNode of question and find all child node of language node
 javax.jcr.Node getQuestionNodeById(String path)
          Gets question node.
 QuestionPageList getQuestionsByCatetory(String categoryId, FAQSetting faqSetting)
          Gets questions are activated and approved in the category.
 QuestionPageList getQuestionsByCatetory(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, FAQSetting faqSetting)
          This method should view questions, only question node is activated and approved via category identify and convert to list of question object
 QuestionPageList getQuestionsByListCatetory(List<String> listCategoryId, boolean isNotYetAnswer)
          Gets questions in list categories.
 QuestionPageList getQuestionsByListCatetory(List<String> listCategoryId, boolean isNotYetAnswer, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This method every category should get list question, all question convert to list of question object
 QuestionPageList getQuestionsNotYetAnswer(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String categoryId, FAQSetting setting)
          This method get all question node have not yet answer and convert to list of question object (QuestionPageList)
 QuestionPageList getQuestionsNotYetAnswer(String categoryId, boolean isApproved)
          Gets all questions not yet answered, the first get all questions which have property response is null (have not yet answer) then convert to list of question object
 List<Question> getQuickQuestionsByListCatetory(List<String> listCategoryId, boolean isNotYetAnswer)
          Gets quick questions.
 Map<String,String> getRelationQuestion(List<String> paths)
          Gets titles of questions active.
 List<ObjectSearchResult> getSearchResults(FAQEventQuery eventQuery)
          This method will return list question when user input value search
 List<Category> getSubCategories(String categoryId, FAQSetting faqSetting, boolean isGetAll, List<String> userView)
          Gets all sub-categories of a category.
 List<Category> getSubCategories(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, FAQSetting faqSetting, boolean isGetAll, List<String> userView)
          Returns an list category that can then be view on the screen.
 byte[] getTemplate()
          Gets template of questions.
 FileAttachment getUserAvatar(String userName)
          Gets avatar of user.
 FileAttachment getUserAvatar(String userName, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void getUserSetting(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String userName, FAQSetting faqSetting)
           
 void getUserSetting(String userName, FAQSetting faqSetting)
          Gets setting of user to view data (categories and questions).
 List<Watch> getWatchByCategory(String categoryId)
          Gets list of watches.
 boolean getWatchByUser(String userId, String cateId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 QuestionPageList getWatchedCategoryByUser(String userId)
          Get list questions that user watches
 boolean hasWatch(String categoryPath)
          Gets information has watch or not.
 boolean importData(String categoryId, InputStream inputStream, boolean isZip)
          Imports data to category.
 void importData(String categoryId, javax.jcr.Session session, InputStream inputStream, boolean isZip, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 boolean isAdminRole(String userName)
          Checks permission of user.
 boolean isAdminRole(String userName, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 boolean isCategoryExist(String name, String path)
          Checks category is exist or not.
 boolean isCategoryModerator(String categoryId, String user)
          Checks user is moderator or not.
 boolean isExisting(String path)
          Checks a path exist or not.
 boolean isModerateAnswer(String id)
          Checks moderate answer or not.
 boolean isModerateQuestion(String id)
          Checks question has moderator or not.
 boolean isUserWatched(String userId, String cateId)
          Checks that user is watching a category.
 boolean isViewAuthorInfo(String id)
          Checks view author information or not.
 List<Cate> listingCategoryTree()
          Gets list of categories.
 void moveCategory(String categoryId, String destCategoryId)
          Moves a category to another one.
 void moveCategory(String categoryId, String destCategoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          Move one category in list to another plate in project.
 void moveQuestions(List<String> questions, String destCategoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This method should lookup questions via question identify and from category identify so lookup destination category and move questions to destination category
 void moveQuestions(List<String> questions, String destCategoryId, String questionLink, FAQSetting faqSetting)
          Moves all of questions to category which have id is specified.
 Object readCategoryProperty(String categoryId, String propertyName, Class returnType)
          Reads property of the category by its name.
 Object readQuestionProperty(String questionId, String propertyName, Class returnType)
          Reads property of the question by its name.
 void reCalculateLastActivityOfQuestion(String absPathOfProp)
          Saves last active information of question.
 void removeCategory(String categoryId)
          Removes specific category by provided id.
 void removeCategory(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          Remove one category in list
 void removeLanguage(String questionPath, List<String> listLanguage)
          Removes languages from question.
 void removeListenerPlugin(AnswerEventListener listener)
          Removes listener for answer.
 void removeQuestion(String questionId)
          Deletes question by question's id.
 void removeQuestion(String questionId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          Remove one question in list
 void saveActivityIdForAnswer(String ownerPath, Answer answer, String activityId)
          Defines Mixin type exo:activityInfo for answer node that means to add exo:activityId property into Node what is owner created activity via patch
 void saveActivityIdForComment(String ownerPath, String commentId, String language, String activityId)
          Defines Mixin type exo:activityInfo for comment node that means to add exo:activityId property into Node what is owner created activity base on provided path.
 void saveActivityIdForQuestion(String ownerPath, String activityId)
          Defines Mixin type exo:activityInfo for question node that means to add exo:activityId property into Node what is owner created activity via patch
 void saveAnswer(String questionId, Answer[] answers)
          Saves an answer.
 void saveAnswer(String questionId, Answer[] answers, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          Deprecated. use saveAnswer(String questionId, Answer[] answers)
 void saveAnswer(String questionId, Answer answer, boolean isNew)
          Saves an answer.
 void saveAnswer(String questionId, Answer answer, boolean isNew, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void saveAnswer(String questionPath, Answer answer, String language)
          Saves an answer of question.
 void saveAnswer(String questionPath, QuestionLanguage questionLanguage)
          Saves an answer of question.
 void saveCategory(String parentId, Category cat, boolean isAddNew)
          This method should check exists category or NOT to create new or update exists category
 void saveCategory(String parentId, Category cat, boolean isAddNew, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          Add new or edit category in list.
 void saveComment(String questionId, Comment comment, boolean isNew)
          Saves comment of question.
 void saveComment(String questionId, Comment comment, boolean isNew, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void saveComment(String questionPath, Comment comment, String language)
          Saves comment of a question.
 void saveFAQSetting(FAQSetting faqSetting, String userName)
          Updates FAQ setting information.
 void saveFAQSetting(FAQSetting faqSetting, String userName, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
          This function is used to set some properties of FAQ.
 javax.jcr.Node saveQuestion(Question question, boolean isAddNew, FAQSetting faqSetting)
          Saves question after create new question or edit infor of quesiton which is existed.
 javax.jcr.Node saveQuestion(Question question, boolean isAddNew, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, FAQSetting faqSetting)
          This method should create new question or update exists question
 void saveTemplate(String str)
          Saves a template.
 void saveTopicIdDiscussQuestion(String questionId, String pathDiscuss)
          Saves topic.
 void saveTopicIdDiscussQuestion(String questionId, String pathDiscuss, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void saveUserAvatar(String userId, FileAttachment fileAttachment)
          Saves avatar of an user.
 void saveUserAvatar(String userId, FileAttachment fileAttachment, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void setDefaultAvatar(String userName)
          Sets default avatar for an user.
 void setDefaultAvatar(String userName, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void start()
           
 void stop()
           
 void swapCategories(String cateId1, String cateId2)
          Swaps two categories.
 void swapCategories(String parentCateId, String cateId1, String cateId2, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void unVoteQuestion(String questionPath, String userName)
          Removes vote for question.
 void UnWatch(String categoryId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String userCurrent)
          This function will un watch in one category
 void unWatchCategory(String categoryId, String userCurrent)
          Un-watches in one category.
 void UnWatchQuestion(String questionID, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String userCurrent)
          This function will un watch in one category
 void unWatchQuestion(String questionID, String userCurrent)
          Un-watches one question.
 void updateQuestionRelatives(String questionPath, String[] relatives)
          Updates relatives for a question.
 void voteAnswer(String answerPath, String userName, boolean isUp)
          Votes for an answer.
 void voteQuestion(String questionPath, String userName, int number)
          Votes for a question.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY

public static final int CATEGORY
See Also:
Constant Field Values

QUESTION

public static final int QUESTION
See Also:
Constant Field Values

SEND_EMAIL

public static final int SEND_EMAIL
See Also:
Constant Field Values

listeners_

protected List<AnswerEventListener> listeners_
Constructor Detail

FAQServiceImpl

public FAQServiceImpl(org.exoplatform.container.xml.InitParams params,
                      org.exoplatform.forum.common.jcr.KSDataLocation locator,
                      org.exoplatform.container.configuration.ConfigurationManager configManager)
               throws Exception
Throws:
Exception
Method Detail

addPlugin

public void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
               throws Exception
Description copied from interface: FAQService
Adds the plugin.

Specified by:
addPlugin in interface FAQService
Parameters:
plugin - the plugin
Throws:
Exception - the exception

addRolePlugin

public void addRolePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
                   throws Exception
Description copied from interface: FAQService
Adds the plugin.

Specified by:
addRolePlugin in interface FAQService
Parameters:
plugin - the plugin
Throws:
Exception - the exception

addInitialDataPlugin

public void addInitialDataPlugin(InitialDataPlugin plugin)
                          throws Exception
Description copied from interface: FAQService
Adds plugin to initialize default FAQ data.

Specified by:
addInitialDataPlugin in interface FAQService
Throws:
Exception

addTemplatePlugin

public void addTemplatePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
                       throws Exception
Throws:
Exception

start

public void start()
Specified by:
start in interface org.picocontainer.Startable

stop

public void stop()
Specified by:
stop in interface org.picocontainer.Startable

getAllFAQAdmin

public List<String> getAllFAQAdmin()
                            throws Exception
This method get all admin in FAQ

Specified by:
getAllFAQAdmin in interface FAQService
Returns:
userName list
Throws:
Exception - the exception

getAllCategories

public List<Category> getAllCategories(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                throws Exception
This method get all the category

Parameters:
sProvider - is session provider
Returns:
Category list
Throws:
Exception - the exception

getAllCategories

public List<Category> getAllCategories()
                                throws Exception
Description copied from interface: FAQService
Gets all categories.

Specified by:
getAllCategories in interface FAQService
Returns:
Category list
Throws:
Exception - the exception

getAllQuestions

public QuestionPageList getAllQuestions(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                 throws Exception
This method get all the question and convert to list of question object (QuestionPageList)

Parameters:
sProvider -
Returns:
QuestionPageList
Throws:
Exception - the exception

getAllQuestions

public QuestionPageList getAllQuestions()
                                 throws Exception
Description copied from interface: FAQService
Gets all questions

Specified by:
getAllQuestions in interface FAQService
Returns:
List of question
Throws:
Exception - if attachment not foune

getQuestionsNotYetAnswer

public QuestionPageList getQuestionsNotYetAnswer(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                                 String categoryId,
                                                 FAQSetting setting)
                                          throws Exception
This method get all question node have not yet answer and convert to list of question object (QuestionPageList)

Parameters:
sProvider -
Returns:
QuestionPageList
Throws:
Exception - the exception

getQuestionsNotYetAnswer

public QuestionPageList getQuestionsNotYetAnswer(String categoryId,
                                                 boolean isApproved)
                                          throws Exception
Description copied from interface: FAQService
Gets all questions not yet answered, the first get all questions which have property response is null (have not yet answer) then convert to list of question object

Specified by:
getQuestionsNotYetAnswer in interface FAQService
Parameters:
categoryId - the id of category
isApproved - Question approved or not
Returns:
List of question
Throws:
Exception - if lost attachment

getCategoryInfo

public long[] getCategoryInfo(String categoryId,
                              org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                              FAQSetting setting)
                       throws Exception
This method get some informations of category: to count sub-categories, to count questions, to count question have not yet answer, to count question is not approved are contained in this category

Parameters:
categoryId -
sProvider -
Returns:
number of (sub-categories, questions, questions is not approved,question is have not yet answered)
Throws:
Exception - the exception

getCategoryInfo

public long[] getCategoryInfo(String categoryId,
                              FAQSetting setting)
                       throws Exception
Description copied from interface: FAQService
Gets some informations of category: Lookup category node by category's id and count sub-categories and questions are contained in this category.

Specified by:
getCategoryInfo in interface FAQService
Parameters:
categoryId - the category id
setting - FAQ setting information
Returns:
number of sub-categories number of questions number of questions is not approved number of question is have not yet answered
Throws:
Exception - if not found category by id if not found question or lose file attach

getCategoryById

public Category getCategoryById(String categoryId,
                                org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                         throws Exception
Returns an category that can then be get property of this category.

Parameters:
categoryId - is address id of the category so you want get
sProvider -
Returns:
category is id equal categoryId
Throws:
Exception - the exception
See Also:
category

getCategoryById

public Category getCategoryById(String categoryId)
                         throws Exception
Description copied from interface: FAQService
Gets category by id.

Specified by:
getCategoryById in interface FAQService
Parameters:
categoryId - is address id of the category so you want get
Returns:
The category of specific provided id.
Throws:
Exception - the exception

getQuestionById

public Question getQuestionById(String questionId,
                                org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                         throws Exception
This method should get question node via identify

Parameters:
question - identify
sProvider -
Returns:
Question
Throws:
Exception - the exception

getComments

public Comment[] getComments(String questionId)
                      throws Exception
Description copied from interface: FAQService
Gets comments of a question.

Specified by:
getComments in interface FAQService
Parameters:
questionId - id of question
Returns:
comments of question
Throws:
Exception

getQuestionById

public Question getQuestionById(String questionId)
                         throws Exception
Description copied from interface: FAQService
Gets a question by id.

Specified by:
getQuestionById in interface FAQService
Parameters:
questionId - the question id
Returns:
Question
Throws:
Exception - the exception

getQuestionsByCatetory

public QuestionPageList getQuestionsByCatetory(String categoryId,
                                               org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                               FAQSetting faqSetting)
                                        throws Exception
This method should view questions, only question node is activated and approved via category identify and convert to list of question object

Parameters:
Category - identify
sProvider -
Returns:
QuestionPageList
Throws:
Exception - the exception

getQuestionsByCatetory

public QuestionPageList getQuestionsByCatetory(String categoryId,
                                               FAQSetting faqSetting)
                                        throws Exception
Description copied from interface: FAQService
Gets questions are activated and approved in the category. The first get category from id which is specified by param categoryId then lookup questions of this category, only question is activated and approved via category identify, the last convert to list of question object

Specified by:
getQuestionsByCatetory in interface FAQService
Parameters:
categoryId - the category id
faqSetting - FAQ setting information
Returns:
Question list
Throws:
Exception - if can't found category

getAllQuestionsByCatetory

public QuestionPageList getAllQuestionsByCatetory(String categoryId,
                                                  org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                                  FAQSetting faqSetting)
                                           throws Exception
This method get all questions via category identify and convert to list of question list

Parameters:
Category - identify
sProvider -
Returns:
QuestionPageList
Throws:
Exception - the exception

getAllQuestionsByCatetory

public QuestionPageList getAllQuestionsByCatetory(String categoryId,
                                                  FAQSetting faqSetting)
                                           throws Exception
Description copied from interface: FAQService
Gets all questions of the category. The first get category from id which is specified by param categoryId then get all questions of this category and put them into an question page list object

Specified by:
getAllQuestionsByCatetory in interface FAQService
Parameters:
categoryId - the id of category
faqSetting - FAQ setting information
Returns:
Question page list
Throws:
Exception - when category not found

getQuestionsByListCatetory

public QuestionPageList getQuestionsByListCatetory(List<String> listCategoryId,
                                                   boolean isNotYetAnswer,
                                                   org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                            throws Exception
This method every category should get list question, all question convert to list of question object

Parameters:
listCategoryId - is list via identify
isNotYetAnswer - if isNotYetAnswer equal true then return list question is not yet answer isNotYetAnswer if isNotYetAnswer equal false then return list all questions
sProvider -
Returns:
QuestionPageList
Throws:
Exception - the exception

getQuestionsByListCatetory

public QuestionPageList getQuestionsByListCatetory(List<String> listCategoryId,
                                                   boolean isNotYetAnswer)
                                            throws Exception
Description copied from interface: FAQService
Gets questions in list categories.

With each category in the list categories, if isNotYetAnswer is false get all questoin in this catgory else get questions which is not yet answered, and put them in to a QuestionPageList object

Specified by:
getQuestionsByListCatetory in interface FAQService
Parameters:
listCategoryId - the list category id
isNotYetAnswer - is true if get qeustions not yet answered is false if want get all questions in list categories
Returns:
Question page list
Throws:
Exception - the exception

getCategoryPathOfQuestion

public String getCategoryPathOfQuestion(String questionPath,
                                        org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                 throws Exception
Throws:
Exception

getCategoryPathOfQuestion

public String getCategoryPathOfQuestion(String questionPath)
                                 throws Exception
Description copied from interface: FAQService
Gets path of question. For example question A is included in category C and C is child of category B, then, this function will be return C > B

Specified by:
getCategoryPathOfQuestion in interface FAQService
Parameters:
questionPath - id of category is contain question
Returns:
name of categories
Throws:
Exception

getQuestionLanguages

public List<QuestionLanguage> getQuestionLanguages(String questionId,
                                                   org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                            throws Exception
This method should lookup languageNode of question and find all child node of language node

Parameters:
Question - identify
sProvider -
Returns:
language list
Throws:
Exception - the exception

getQuestionLanguages

public List<QuestionLanguage> getQuestionLanguages(String questionId)
Description copied from interface: FAQService
Gets all language nodes of question node which have id is specified, with each language node get properties of them and set into QuestionLanguage object. One QuestionLanguage object have properties:

Specified by:
getQuestionLanguages in interface FAQService
Parameters:
questionId - the id of question
Returns:
list languages are support by the question

getSubCategories

public List<Category> getSubCategories(String categoryId,
                                       org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                       FAQSetting faqSetting,
                                       boolean isGetAll,
                                       List<String> userView)
                                throws Exception
Returns an list category that can then be view on the screen.

This method always returns immediately, this view list category in screen. if categoryId equal null then list category is list parent category else this view list category of one value parent category that you communicate categoryId

Parameters:
categoryId - is address id of the category
sProvider -
Returns:
List parent category or list sub category
Throws:
Exception - the exception
See Also:
category

getSubCategories

public List<Category> getSubCategories(String categoryId,
                                       FAQSetting faqSetting,
                                       boolean isGetAll,
                                       List<String> userView)
                                throws Exception
Description copied from interface: FAQService
Gets all sub-categories of a category.

Specified by:
getSubCategories in interface FAQService
Parameters:
categoryId - the category id
userView - the list of users to view categories.
Returns:
Category list
Throws:
Exception - the exception

moveQuestions

public void moveQuestions(List<String> questions,
                          String destCategoryId,
                          org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                   throws Exception
This method should lookup questions via question identify and from category identify so lookup destination category and move questions to destination category

Parameters:
Question - identify list
destination - category identify
sProvider -
Throws:
Exception - the exception

moveQuestions

public void moveQuestions(List<String> questions,
                          String destCategoryId,
                          String questionLink,
                          FAQSetting faqSetting)
                   throws Exception
Description copied from interface: FAQService
Moves all of questions to category which have id is specified.

Specified by:
moveQuestions in interface FAQService
Parameters:
questions - the questions
destCategoryId - the dest category id
questionLink - the question link
faqSetting - the FAQSetting
Throws:
Exception - the exception

removeCategory

public void removeCategory(String categoryId,
                           org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                    throws Exception
Remove one category in list

This function is used to remove one category in list

Parameters:
categoryId - is address id of the category need remove
sProvider -
Throws:
Exception - the exception

removeCategory

public void removeCategory(String categoryId)
                    throws Exception
Description copied from interface: FAQService
Removes specific category by provided id.

Specified by:
removeCategory in interface FAQService
Parameters:
categoryId - is address id of the category need remove
Throws:
Exception - the exception

removeQuestion

public void removeQuestion(String questionId,
                           org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                    throws Exception
Remove one question in list

This function is used to remove one question in list

Parameters:
question - identify
sProvider -
Throws:
Exception - the exception

removeQuestion

public void removeQuestion(String questionId)
                    throws Exception
Description copied from interface: FAQService
Deletes question by question's id. Check question if it's existed then remove it

Specified by:
removeQuestion in interface FAQService
Parameters:
questionId - the id of question is deleted
Throws:
Exception - if question not found

saveCategory

public void saveCategory(String parentId,
                         Category cat,
                         boolean isAddNew,
                         org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                  throws Exception
Add new or edit category in list.

This function is used to add new or edit category in list. User will input information of fields need in form add category, so user save then category will persistent in data

Parameters:
parentId - is address id of the category parent where user want add sub category when paretId equal null so this category is parent category else sub category
cat - is properties that user input to interface will save on data
isAddNew - is true when add new category else update category
sProvider -
Throws:
Exception - the exception
See Also:
category

saveCategory

public void saveCategory(String parentId,
                         Category cat,
                         boolean isAddNew)
Description copied from interface: FAQService
This method should check exists category or NOT to create new or update exists category

This function is used to add new or edit category in list. User will input information of fields need in form add category, so user save then category will persistent in data

Specified by:
saveCategory in interface FAQService
Parameters:
parentId - is address id of the category parent where user want add sub category when paretId = null so this category is parent category else sub category
cat - is properties that user input to interface will save on data
isAddNew - is true when add new category else update category
See Also:
category

buildCategoryTree

public CategoryTree buildCategoryTree(String categoryId)
                               throws Exception
Description copied from interface: FAQService
Builds category tree of provided id.

Specified by:
buildCategoryTree in interface FAQService
Parameters:
categoryId - Id of category to build tree.
Returns:
the CategoryTree
Throws:
Exception

changeStatusCategoryView

public void changeStatusCategoryView(List<String> listCateIds,
                                     org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                              throws Exception
Throws:
Exception

changeStatusCategoryView

public void changeStatusCategoryView(List<String> listCateIds)
                              throws Exception
Description copied from interface: FAQService
Changes status of view of category.

Specified by:
changeStatusCategoryView in interface FAQService
Parameters:
listCateIds - is address ids of the category need to change
Throws:
Exception - the exception

saveQuestion

public javax.jcr.Node saveQuestion(Question question,
                                   boolean isAddNew,
                                   org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                   FAQSetting faqSetting)
                            throws Exception
This method should create new question or update exists question

Parameters:
question - is information but user input or edit to form interface of question
isAddNew - equal true then add new question isAddNew equal false then update question
sProvider -
Throws:
Exception

saveQuestion

public javax.jcr.Node saveQuestion(Question question,
                                   boolean isAddNew,
                                   FAQSetting faqSetting)
                            throws Exception
Description copied from interface: FAQService
Saves question after create new question or edit infor of quesiton which is existed. If param isAddNew is true then create new question node and set properties of question object to this node else reset infor for this question node

Specified by:
saveQuestion in interface FAQService
Parameters:
question - the question
isAddNew - is true if create new question node and is false if edit question node
faqSetting - Setting FAQ information
Returns:
the question node
Throws:
Exception - if path of question nod not found

saveFAQSetting

public void saveFAQSetting(FAQSetting faqSetting,
                           String userName,
                           org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                    throws Exception
This function is used to set some properties of FAQ.

This function is used(Users of FAQ Administrator) choose some properties in object FAQSetting

Parameters:
newSetting - is properties of object FAQSetting that user input to interface will save on data
sProvider -
Throws:
Exception - the exception

saveFAQSetting

public void saveFAQSetting(FAQSetting faqSetting,
                           String userName)
                    throws Exception
Description copied from interface: FAQService
Updates FAQ setting information.

Specified by:
saveFAQSetting in interface FAQService
Parameters:
faqSetting - FAQ setting information
userName - name of user who setting
Throws:
Exception - the exception

moveCategory

public void moveCategory(String categoryId,
                         String destCategoryId,
                         org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                  throws Exception
Move one category in list to another plate in project.

This function is used to move category in list. User will right click on category need move, so user choose in list category one another category want to put

Parameters:
categoryId - is address id of the category that user want plate
destCategoryId - is address id of the category that user want put( destination )
sProvider -
Throws:
Exception - the exception
See Also:
see category this plate but user see that category at new plate

moveCategory

public void moveCategory(String categoryId,
                         String destCategoryId)
                  throws Exception
Description copied from interface: FAQService
Moves a category to another one.

Specified by:
moveCategory in interface FAQService
Parameters:
categoryId - the category id should move
destCategoryId - : category is moved
Throws:
Exception - the exception

addWatch

public void addWatch(String id,
                     Watch watch,
                     org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
              throws Exception
This function is used to allow user can watch a category. You have to register your email for whenever there is new question is inserted in the category or new category then there will a notification sent to you.

Parameters:
id - of category with user want add watch on that category
value, - this address email (multiple value) with input to interface will save on data
sProvider -
Throws:
Exception - the exception

addWatchCategory

public void addWatchCategory(String id,
                             Watch watch)
                      throws Exception
Description copied from interface: FAQService
Adds watch a category. You have to register your email for whenever there is new question is inserted in the category or new category then there will a notification sent to you.

Specified by:
addWatchCategory in interface FAQService
Parameters:
id - of category with user want add watch on that category
watch - added watch object
Throws:
Exception - the exception

deleteMailInWatch

public void deleteMailInWatch(String categoryId,
                              org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                              String user)
                       throws Exception
This function will delete watch in one category

Parameters:
categoryId - is id of current category
sProvider -
emails - is location current of one watch with user want delete
Throws:
Exception - the exception

deleteCategoryWatch

public void deleteCategoryWatch(String categoryId,
                                String user)
                         throws Exception
Description copied from interface: FAQService
Deletes watch in one category.

Specified by:
deleteCategoryWatch in interface FAQService
Parameters:
categoryId - is id of current category
user - user want delete watch
Throws:
Exception - the exception

UnWatch

public void UnWatch(String categoryId,
                    org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                    String userCurrent)
             throws Exception
This function will un watch in one category

Parameters:
categoryId - is id of current category
sProvider -
emails - is location current of one watch with user want delete
Throws:
Exception - the exception

unWatchCategory

public void unWatchCategory(String categoryId,
                            String userCurrent)
                     throws Exception
Description copied from interface: FAQService
Un-watches in one category.

Specified by:
unWatchCategory in interface FAQService
Parameters:
categoryId - is id of current category
userCurrent - is user current then you unwatch
Throws:
Exception - the exception

UnWatchQuestion

public void UnWatchQuestion(String questionID,
                            org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                            String userCurrent)
                     throws Exception
This function will un watch in one category

Parameters:
categoryId - is id of current category
sProvider -
emails - is location current of one watch with user want delete
Throws:
Exception - the exception

unWatchQuestion

public void unWatchQuestion(String questionID,
                            String userCurrent)
                     throws Exception
Description copied from interface: FAQService
Un-watches one question.

Specified by:
unWatchQuestion in interface FAQService
Parameters:
questionID - is id of current category
userCurrent - is user current then you un watch
Throws:
Exception - the exception

getListCateIdByModerator

public List<String> getListCateIdByModerator(String user,
                                             org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                      throws Exception
This method should lookup all the categories node so find category have user in moderators and convert to category object and return list of category object

Parameters:
user - is name when user login
sProvider -
Returns:
Category list
Throws:
Exception - the exception

getListCateIdByModerator

public List<String> getListCateIdByModerator(String user)
                                      throws Exception
Description copied from interface: FAQService
Get all categories of specific provided user.

Specified by:
getListCateIdByModerator in interface FAQService
Parameters:
user - the name of user
Returns:
Category list
Throws:
Exception - if can't found user

getSearchResults

public List<ObjectSearchResult> getSearchResults(FAQEventQuery eventQuery)
                                          throws Exception
This method will return list question when user input value search

With many questions , it's difficult to find a question which user want to see. So to support to users can find their questions more quickly and accurate, user can use 'Search Question' function

Specified by:
getSearchResults in interface FAQService
Parameters:
sProvider -
eventQuery - is object save value in form advanced search
Returns:
FAQs that match the search condition.
Throws:
Exception - the exception

getCategoryPath

public List<String> getCategoryPath(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                    String categoryId)
                             throws Exception
This method return path of category identify

Parameters:
category - identify
sProvider -
Returns:
list category name is sort(path of this category)
Throws:
Exception - the exception

getCategoryPath

public List<String> getCategoryPath(String categoryId)
                             throws Exception
Description copied from interface: FAQService
Gets path of category by category id.

Specified by:
getCategoryPath in interface FAQService
Parameters:
categoryId - id of category
Returns:
list category name is sort(path of this category)
Throws:
Exception - the exception

getPendingMessages

public Iterator<org.exoplatform.forum.common.NotifyInfo> getPendingMessages()
This function will send all the pending notification message

Specified by:
getPendingMessages in interface FAQService

addLanguage

public void addLanguage(javax.jcr.Node questionNode,
                        QuestionLanguage language)
                 throws Exception
Adds the language node, when question have multiple language, each language is a child node of question node.

Specified by:
addLanguage in interface FAQService
Parameters:
questionNode - the question node which have multiple language
language - the language which is added in to questionNode
Throws:
Exception - throw an exception when save a new language node

getUserSetting

public void getUserSetting(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                           String userName,
                           FAQSetting faqSetting)
                    throws Exception
Throws:
Exception

getUserSetting

public void getUserSetting(String userName,
                           FAQSetting faqSetting)
                    throws Exception
Description copied from interface: FAQService
Gets setting of user to view data (categories and questions). At first time user come, system will create setting for user (automatically) base on setting of admin (Default setting of FAQ system). After that, when user login again, his setting is getted.

Specified by:
getUserSetting in interface FAQService
Parameters:
userName - the name of user
faqSetting - the setting of user
Throws:
Exception - when can't find user or faqSetting

getMessageInfo

public org.exoplatform.forum.common.NotifyInfo getMessageInfo(String name)
                                                       throws Exception
Description copied from interface: FAQService
Gets informations about message.

Specified by:
getMessageInfo in interface FAQService
Parameters:
name - key of message
Returns:
informations contain message and email addresses.
Throws:
Exception

isAdminRole

public boolean isAdminRole(String userName,
                           org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                    throws Exception
Throws:
Exception

isAdminRole

public boolean isAdminRole(String userName)
                    throws Exception
Description copied from interface: FAQService
Checks permission of user.

Specified by:
isAdminRole in interface FAQService
Parameters:
userName - id or user name of user who is checked permission
Returns:
return true if user is admin. The current user is implied if userName is null.
Throws:
Exception

getCategoryNodeById

public javax.jcr.Node getCategoryNodeById(String categoryId,
                                          org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                   throws Exception
Throws:
Exception

getCategoryNodeById

public javax.jcr.Node getCategoryNodeById(String categoryId)
                                   throws Exception
Description copied from interface: FAQService
Gets category node.

Specified by:
getCategoryNodeById in interface FAQService
Parameters:
categoryId - id of category
Returns:
node of category
Throws:
Exception

addWatchQuestion

public void addWatchQuestion(String questionId,
                             Watch watch,
                             boolean isNew,
                             org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                      throws Exception
Throws:
Exception

addWatchQuestion

public void addWatchQuestion(String questionId,
                             Watch watch,
                             boolean isNew)
                      throws Exception
Description copied from interface: FAQService
Adds watch for a question.

Specified by:
addWatchQuestion in interface FAQService
Parameters:
questionId - id of question
watch - contains information of users
isNew - add new or edit
Throws:
Exception

getListQuestionsWatch

public QuestionPageList getListQuestionsWatch(FAQSetting faqSetting,
                                              String currentUser,
                                              org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                       throws Exception
Throws:
Exception

getListQuestionsWatch

public QuestionPageList getListQuestionsWatch(FAQSetting faqSetting,
                                              String currentUser)
                                       throws Exception
Description copied from interface: FAQService
Gets list of questions that user watches.

Specified by:
getListQuestionsWatch in interface FAQService
Parameters:
faqSetting - setting of user
currentUser - username
Returns:
List of questions
Throws:
Exception

importData

public void importData(String categoryId,
                       javax.jcr.Session session,
                       InputStream inputStream,
                       boolean isZip,
                       org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                throws Exception
Throws:
Exception

importData

public boolean importData(String categoryId,
                          InputStream inputStream,
                          boolean isZip)
                   throws Exception
Description copied from interface: FAQService
Imports data to category.

Specified by:
importData in interface FAQService
Parameters:
categoryId - the id of category
inputStream - the data
isZip - data is zip or not
Returns:
informations contain message and email addresses.
Throws:
Exception

exportData

public InputStream exportData(String categoryId,
                              boolean createZipFile)
                       throws Exception
Description copied from interface: FAQService
Exports category to stream.

Specified by:
exportData in interface FAQService
Parameters:
categoryId - id of category
createZipFile - create zip file or not
Returns:
input stream of category
Throws:
Exception

swapCategories

public void swapCategories(String parentCateId,
                           String cateId1,
                           String cateId2,
                           org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                    throws Exception
Throws:
Exception

swapCategories

public void swapCategories(String cateId1,
                           String cateId2)
                    throws Exception
Description copied from interface: FAQService
Swaps two categories.

Specified by:
swapCategories in interface FAQService
Parameters:
cateId1 - id of category 1
cateId2 - id of category 2
Throws:
Exception

saveTopicIdDiscussQuestion

public void saveTopicIdDiscussQuestion(String questionId,
                                       String pathDiscuss,
                                       org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                throws Exception
Throws:
Exception

saveTopicIdDiscussQuestion

public void saveTopicIdDiscussQuestion(String questionId,
                                       String pathDiscuss)
                                throws Exception
Description copied from interface: FAQService
Saves topic.

Specified by:
saveTopicIdDiscussQuestion in interface FAQService
Parameters:
questionId - Question to discuss
pathDiscuss - path to discussion
Throws:
Exception

getMaxindexCategory

public long getMaxindexCategory(String parentId,
                                org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                         throws Exception
Throws:
Exception

getMaxindexCategory

public long getMaxindexCategory(String parentId)
                         throws Exception
Description copied from interface: FAQService
Gets max index of categories.

Specified by:
getMaxindexCategory in interface FAQService
Parameters:
parentId - id of parent
Returns:
index
Throws:
Exception

deleteAnswer

public void deleteAnswer(String questionId,
                         String answerId,
                         org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                  throws Exception
Throws:
Exception

deleteAnswer

public void deleteAnswer(String questionId,
                         String answerId)
                  throws Exception
Description copied from interface: FAQService
Removes an answer.

Specified by:
deleteAnswer in interface FAQService
Parameters:
questionId - id of question
answerId - id of answer
Throws:
Exception

deleteComment

public void deleteComment(String questionId,
                          String commentId,
                          org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                   throws Exception
Throws:
Exception

deleteComment

public void deleteComment(String questionId,
                          String commentId)
                   throws Exception
Description copied from interface: FAQService
Removes comment of question.

Specified by:
deleteComment in interface FAQService
Parameters:
questionId - id of question
commentId - id of comment
Throws:
Exception

saveAnswer

public void saveAnswer(String questionId,
                       Answer answer,
                       boolean isNew,
                       org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                throws Exception
Throws:
Exception

saveAnswer

public void saveAnswer(String questionId,
                       Answer answer,
                       boolean isNew)
                throws Exception
Description copied from interface: FAQService
Saves an answer.

Specified by:
saveAnswer in interface FAQService
Parameters:
questionId - id of question
answer - saved answer
isNew - save new or edit
Throws:
Exception

saveComment

public void saveComment(String questionId,
                        Comment comment,
                        boolean isNew,
                        org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                 throws Exception
Throws:
Exception

saveComment

public void saveComment(String questionId,
                        Comment comment,
                        boolean isNew)
                 throws Exception
Description copied from interface: FAQService
Saves comment of question.

Specified by:
saveComment in interface FAQService
Parameters:
questionId - id of question
comment - saved comment
isNew - save new or edit
Throws:
Exception

getCommentById

public Comment getCommentById(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                              String questionId,
                              String commentId)
                       throws Exception
Throws:
Exception

getCommentById

public Comment getCommentById(String questionId,
                              String commentId)
                       throws Exception
Description copied from interface: FAQService
Gets comment of question.

Specified by:
getCommentById in interface FAQService
Parameters:
questionId - id of question
commentId - id of comment
Returns:
comment
Throws:
Exception

getAnswerById

public Answer getAnswerById(String questionId,
                            String answerid,
                            org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                     throws Exception
Throws:
Exception

getAnswerById

public Answer getAnswerById(String questionId,
                            String answerid)
                     throws Exception
Description copied from interface: FAQService
Gets answer of question.

Specified by:
getAnswerById in interface FAQService
Parameters:
questionId - id of question
answerid - id of answer
Returns:
an Answer
Throws:
Exception

saveAnswer

public void saveAnswer(String questionId,
                       Answer[] answers,
                       org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                throws Exception
Deprecated. use saveAnswer(String questionId, Answer[] answers)

Throws:
Exception

saveAnswer

public void saveAnswer(String questionId,
                       Answer[] answers)
                throws Exception
Description copied from interface: FAQService
Saves an answer.

Specified by:
saveAnswer in interface FAQService
Parameters:
questionId - id of question
answers - saved answers
Throws:
Exception

getPageListAnswer

public JCRPageList getPageListAnswer(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                     String questionId,
                                     boolean isSortByVote)
                              throws Exception
Throws:
Exception

getPageListAnswer

public JCRPageList getPageListAnswer(String questionId,
                                     boolean isSortByVote)
                              throws Exception
Description copied from interface: FAQService
Gets answers of question.

Specified by:
getPageListAnswer in interface FAQService
Parameters:
questionId - id of question
isSortByVote - sort by vote
Returns:
answers page list
Throws:
Exception

getPageListComment

public JCRPageList getPageListComment(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                      String questionId)
                               throws Exception
Throws:
Exception

getPageListComment

public JCRPageList getPageListComment(String questionId)
                               throws Exception
Description copied from interface: FAQService
Gets comments of question.

Specified by:
getPageListComment in interface FAQService
Parameters:
questionId - id of question
Returns:
comment page list
Throws:
Exception

getListCategoriesWatch

public QuestionPageList getListCategoriesWatch(String userId,
                                               org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                        throws Exception
Throws:
Exception

getWatchedCategoryByUser

public QuestionPageList getWatchedCategoryByUser(String userId)
                                          throws Exception
Description copied from interface: FAQService
Get list questions that user watches

Specified by:
getWatchedCategoryByUser in interface FAQService
Parameters:
userId - username
Returns:
question page list
Throws:
Exception

getUserAvatar

public FileAttachment getUserAvatar(String userName,
                                    org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                             throws Exception
Throws:
Exception

getUserAvatar

public FileAttachment getUserAvatar(String userName)
                             throws Exception
Description copied from interface: FAQService
Gets avatar of user.

Specified by:
getUserAvatar in interface FAQService
Parameters:
userName - username
Returns:
avatar of user
Throws:
Exception

saveUserAvatar

public void saveUserAvatar(String userId,
                           FileAttachment fileAttachment,
                           org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                    throws Exception
Throws:
Exception

saveUserAvatar

public void saveUserAvatar(String userId,
                           FileAttachment fileAttachment)
                    throws Exception
Description copied from interface: FAQService
Saves avatar of an user.

Specified by:
saveUserAvatar in interface FAQService
Parameters:
userId - username
fileAttachment - avatar of user
Throws:
Exception

setDefaultAvatar

public void setDefaultAvatar(String userName,
                             org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                      throws Exception
Throws:
Exception

setDefaultAvatar

public void setDefaultAvatar(String userName)
                      throws Exception
Description copied from interface: FAQService
Sets default avatar for an user.

Specified by:
setDefaultAvatar in interface FAQService
Parameters:
userName - username
Throws:
Exception

getWatchByUser

public boolean getWatchByUser(String userId,
                              String cateId,
                              org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                       throws Exception
Throws:
Exception

isUserWatched

public boolean isUserWatched(String userId,
                             String cateId)
Description copied from interface: FAQService
Checks that user is watching a category.

Specified by:
isUserWatched in interface FAQService
Parameters:
userId - username
cateId - id of category
Returns:
true if user is watching and false if isn't

getPendingQuestionsByCategory

public QuestionPageList getPendingQuestionsByCategory(String categoryId,
                                                      org.exoplatform.services.jcr.ext.common.SessionProvider sProvider,
                                                      FAQSetting faqSetting)
                                               throws Exception
Throws:
Exception

getPendingQuestionsByCategory

public QuestionPageList getPendingQuestionsByCategory(String categoryId,
                                                      FAQSetting faqSetting)
                                               throws Exception
Description copied from interface: FAQService
Gets list pending questions in a category.

Specified by:
getPendingQuestionsByCategory in interface FAQService
Parameters:
categoryId - id of category
faqSetting - settings
Returns:
question page list
Throws:
Exception

isExisting

public boolean isExisting(String path)
                   throws Exception
Description copied from interface: FAQService
Checks a path exist or not.

Specified by:
isExisting in interface FAQService
Parameters:
path - path need check
Returns:
exist or not
Throws:
Exception

getCategoryPathOf

public String getCategoryPathOf(String id)
                         throws Exception
Description copied from interface: FAQService
Gets path of Category by id.

Specified by:
getCategoryPathOf in interface FAQService
Parameters:
id - category id
Returns:
path of category
Throws:
Exception

getQuestionContents

public List<String> getQuestionContents(List<String> paths)
                                 throws Exception
Description copied from interface: FAQService
Gets titles of questions.

Specified by:
getQuestionContents in interface FAQService
Parameters:
paths - path of questions
Returns:
list titles of questions
Throws:
Exception

getRelationQuestion

public Map<String,String> getRelationQuestion(List<String> paths)
                                       throws Exception
Description copied from interface: FAQService
Gets titles of questions active.

Specified by:
getRelationQuestion in interface FAQService
Parameters:
paths - path of questions
Returns:
list titles of questions
Throws:
Exception

getQuestionNodeById

public javax.jcr.Node getQuestionNodeById(String path)
                                   throws Exception
Description copied from interface: FAQService
Gets question node.

Specified by:
getQuestionNodeById in interface FAQService
Parameters:
path - id of question
Returns:
question node
Throws:
Exception

isModerateAnswer

public boolean isModerateAnswer(String id)
                         throws Exception
Description copied from interface: FAQService
Checks moderate answer or not.

Specified by:
isModerateAnswer in interface FAQService
Parameters:
id - id of category
Returns:
answer or not
Throws:
Exception

isModerateQuestion

public boolean isModerateQuestion(String id)
                           throws Exception
Description copied from interface: FAQService
Checks question has moderator or not.

Specified by:
isModerateQuestion in interface FAQService
Parameters:
id - id of question
Returns:
is moderate or not
Throws:
Exception

getParentCategoriesName

public String getParentCategoriesName(String path)
                               throws Exception
Description copied from interface: FAQService
Gets name of parent category.

Specified by:
getParentCategoriesName in interface FAQService
Parameters:
path - id of category
Returns:
name of parent category
Throws:
Exception

getListMailInWatch

public QuestionPageList getListMailInWatch(String categoryId)
                                    throws Exception
Description copied from interface: FAQService
Gets email addresses that watch in a category.

Specified by:
getListMailInWatch in interface FAQService
Parameters:
categoryId - id of category
Returns:
question page list
Throws:
Exception

isCategoryModerator

public boolean isCategoryModerator(String categoryId,
                                   String user)
                            throws Exception
Description copied from interface: FAQService
Checks user is moderator or not.

Specified by:
isCategoryModerator in interface FAQService
Parameters:
categoryId - id of category
user - username
Returns:
user is moderator or not. The current user is implied if user is null.
Throws:
Exception

addLanguage

public void addLanguage(String questionPath,
                        QuestionLanguage language)
                 throws Exception
Description copied from interface: FAQService
Adds language to a question.

Specified by:
addLanguage in interface FAQService
Parameters:
questionPath - patch of question
language - question language
Throws:
Exception

deleteAnswerQuestionLang

public void deleteAnswerQuestionLang(String questionPath,
                                     String answerId,
                                     String language)
                              throws Exception
Description copied from interface: FAQService
Deletes language in a answer.

Specified by:
deleteAnswerQuestionLang in interface FAQService
Parameters:
questionPath - path of question
answerId - id of answer
language - deleted language
Throws:
Exception

deleteCommentQuestionLang

public void deleteCommentQuestionLang(String questionPath,
                                      String commentId,
                                      String language,
                                      boolean isPromoted)
                               throws Exception
Description copied from interface: FAQService
Deletes language in a comment.

Specified by:
deleteCommentQuestionLang in interface FAQService
Parameters:
questionPath - path of question
commentId - id of comment
language - deleted language
isPromoted - true in case a comment is promoted to an answer
Throws:
Exception

getQuestionLanguageByLanguage

public QuestionLanguage getQuestionLanguageByLanguage(String questionPath,
                                                      String language)
                                               throws Exception
Description copied from interface: FAQService
Gets language of question.

Specified by:
getQuestionLanguageByLanguage in interface FAQService
Parameters:
questionPath - path of question
language - got language
Returns:
Language of question
Throws:
Exception

getCommentById

public Comment getCommentById(String questionPath,
                              String commentId,
                              String language)
                       throws Exception
Description copied from interface: FAQService
Gets Comment of question.

Specified by:
getCommentById in interface FAQService
Parameters:
questionPath - path of question
commentId - id of comment
Returns:
comment of question
Throws:
Exception

getAnswerById

public Answer getAnswerById(String questionPath,
                            String answerid,
                            String language)
                     throws Exception
Description copied from interface: FAQService
Gets answer object.

Specified by:
getAnswerById in interface FAQService
Parameters:
questionPath - path of question
answerid - id of answer
Returns:
answer has inputed id
Throws:
Exception

saveAnswer

public void saveAnswer(String questionPath,
                       Answer answer,
                       String language)
                throws Exception
Description copied from interface: FAQService
Saves an answer of question.

Specified by:
saveAnswer in interface FAQService
Parameters:
questionPath - path of question
answer - object answer want to save
language - language of answer
Throws:
Exception

saveAnswer

public void saveAnswer(String questionPath,
                       QuestionLanguage questionLanguage)
                throws Exception
Description copied from interface: FAQService
Saves an answer of question.

Specified by:
saveAnswer in interface FAQService
Parameters:
questionPath - path of question
questionLanguage - language of answer
Throws:
Exception

saveComment

public void saveComment(String questionPath,
                        Comment comment,
                        String language)
                 throws Exception
Description copied from interface: FAQService
Saves comment of a question.

Specified by:
saveComment in interface FAQService
Parameters:
questionPath - path of question
comment - comment want to save
language - language of comment
Throws:
Exception

removeLanguage

public void removeLanguage(String questionPath,
                           List<String> listLanguage)
Description copied from interface: FAQService
Removes languages from question.

Specified by:
removeLanguage in interface FAQService
Parameters:
questionPath - path of question
listLanguage - removed languages

voteAnswer

public void voteAnswer(String answerPath,
                       String userName,
                       boolean isUp)
                throws Exception
Description copied from interface: FAQService
Votes for an answer.

Specified by:
voteAnswer in interface FAQService
Parameters:
answerPath - path of answer
userName - username of user vote for answer
isUp - up or not
Throws:
Exception

voteQuestion

public void voteQuestion(String questionPath,
                         String userName,
                         int number)
                  throws Exception
Description copied from interface: FAQService
Votes for a question.

Specified by:
voteQuestion in interface FAQService
Parameters:
questionPath - path of question
userName - username of user vote for question
number - value user vote
Throws:
Exception

unVoteQuestion

public void unVoteQuestion(String questionPath,
                           String userName)
                    throws Exception
Description copied from interface: FAQService
Removes vote for question.

Specified by:
unVoteQuestion in interface FAQService
Parameters:
questionPath - path of question
userName - username remove vote
Throws:
Exception

getModeratorsOf

public String[] getModeratorsOf(String path)
                         throws Exception
Description copied from interface: FAQService
Gets moderators of question or category.

Specified by:
getModeratorsOf in interface FAQService
Parameters:
path - path of question or category
Returns:
array users are moderator
Throws:
Exception

isViewAuthorInfo

public boolean isViewAuthorInfo(String id)
Description copied from interface: FAQService
Checks view author information or not.

Specified by:
isViewAuthorInfo in interface FAQService
Parameters:
id - id of question
Returns:
is view author information or not

existingCategories

public long existingCategories()
                        throws Exception
Description copied from interface: FAQService
Gets number of categories.

Specified by:
existingCategories in interface FAQService
Returns:
number of categories
Throws:
Exception

getCategoryNameOf

public String getCategoryNameOf(String categoryPath)
                         throws Exception
Description copied from interface: FAQService
Gets name of category.

Specified by:
getCategoryNameOf in interface FAQService
Parameters:
categoryPath - path of category
Returns:
name of category
Throws:
Exception

getQuickQuestionsByListCatetory

public List<Question> getQuickQuestionsByListCatetory(List<String> listCategoryId,
                                                      boolean isNotYetAnswer)
                                               throws Exception
Description copied from interface: FAQService
Gets quick questions.

Specified by:
getQuickQuestionsByListCatetory in interface FAQService
Parameters:
listCategoryId - id of some categories
isNotYetAnswer - is answer or not
Returns:
list of questions
Throws:
Exception

listingCategoryTree

public List<Cate> listingCategoryTree()
                               throws Exception
Description copied from interface: FAQService
Gets list of categories.

Specified by:
listingCategoryTree in interface FAQService
Returns:
list of categories
Throws:
Exception

getWatchByCategory

public List<Watch> getWatchByCategory(String categoryId)
                               throws Exception
Description copied from interface: FAQService
Gets list of watches.

Specified by:
getWatchByCategory in interface FAQService
Parameters:
categoryId - id of category
Returns:
list of watches in a category
Throws:
Exception

hasWatch

public boolean hasWatch(String categoryPath)
Description copied from interface: FAQService
Gets information has watch or not.

Specified by:
hasWatch in interface FAQService
Parameters:
categoryPath - path of category
Returns:
has watch or has not

getCategoryInfo

public CategoryInfo getCategoryInfo(String categoryPath,
                                    List<String> categoryIdScoped)
                             throws Exception
Description copied from interface: FAQService
Gets informations about category.

Specified by:
getCategoryInfo in interface FAQService
Parameters:
categoryPath - path of category
categoryIdScoped - list sub of category
Returns:
informations in CategoryInfo object
Throws:
Exception

getTemplate

public byte[] getTemplate()
                   throws Exception
Description copied from interface: FAQService
Gets template of questions.

Specified by:
getTemplate in interface FAQService
Returns:
template
Throws:
Exception

saveTemplate

public void saveTemplate(String str)
                  throws Exception
Description copied from interface: FAQService
Saves a template.

Specified by:
saveTemplate in interface FAQService
Parameters:
str - template
Throws:
Exception

isCategoryExist

public boolean isCategoryExist(String name,
                               String path)
Description copied from interface: FAQService
Checks category is exist or not.

Specified by:
isCategoryExist in interface FAQService
Parameters:
name - name of category
path - path of category
Returns:
is exist or not

updateQuestionRelatives

public void updateQuestionRelatives(String questionPath,
                                    String[] relatives)
                             throws Exception
Description copied from interface: FAQService
Updates relatives for a question.

Specified by:
updateQuestionRelatives in interface FAQService
Parameters:
questionPath - path of question
relatives - input relatives
Throws:
Exception

createAnswerRSS

public InputStream createAnswerRSS(String cateId)
                            throws Exception
Description copied from interface: FAQService
Creates RSS for answer.

Specified by:
createAnswerRSS in interface FAQService
Parameters:
cateId - id of category
Returns:
stream of answer rss
Throws:
Exception

reCalculateLastActivityOfQuestion

public void reCalculateLastActivityOfQuestion(String absPathOfProp)
                                       throws Exception
Description copied from interface: FAQService
Saves last active information of question.

Specified by:
reCalculateLastActivityOfQuestion in interface FAQService
Parameters:
absPathOfProp - path of question
Throws:
Exception

addListenerPlugin

public void addListenerPlugin(AnswerEventListener listener)
                       throws Exception
Description copied from interface: FAQService
Adds listener for answer.

Specified by:
addListenerPlugin in interface FAQService
Parameters:
listener - answer event listener
Throws:
Exception

removeListenerPlugin

public void removeListenerPlugin(AnswerEventListener listener)
                          throws Exception
Description copied from interface: FAQService
Removes listener for answer.

Specified by:
removeListenerPlugin in interface FAQService
Parameters:
listener - answer event listener
Throws:
Exception

calculateDeletedUser

public void calculateDeletedUser(String userName)
                          throws Exception
Description copied from interface: FAQService
Calculates deleted user.

Specified by:
calculateDeletedUser in interface FAQService
Throws:
Exception

readCategoryProperty

public Object readCategoryProperty(String categoryId,
                                   String propertyName,
                                   Class returnType)
                            throws Exception
Description copied from interface: FAQService
Reads property of the category by its name.

Specified by:
readCategoryProperty in interface FAQService
Parameters:
categoryId - id of the category
propertyName - name of the property
returnType - expected return-type. The supported class are String[], String, Long, Boolean, Double and Date .
Returns:
Object contains property values of category.
Throws:
Exception

readQuestionProperty

public Object readQuestionProperty(String questionId,
                                   String propertyName,
                                   Class returnType)
                            throws Exception
Description copied from interface: FAQService
Reads property of the question by its name.

Specified by:
readQuestionProperty in interface FAQService
Parameters:
questionId - id of the question
propertyName - name of the property
returnType - expected return-type. The supported class are String[], String, Long, Boolean, Double and Date.
Returns:
Object contains property values of question.
Throws:
Exception

saveActivityIdForQuestion

public void saveActivityIdForQuestion(String ownerPath,
                                      String activityId)
Description copied from interface: FAQService
Defines Mixin type exo:activityInfo for question node that means to add exo:activityId property into Node what is owner created activity via patch

Specified by:
saveActivityIdForQuestion in interface FAQService
Parameters:
ownerPath - - the Path's Node what is owner created activity
activityId - - the Id's activity created.

getActivityIdForQuestion

public String getActivityIdForQuestion(String ownerPath)
Description copied from interface: FAQService
Gets value of exo:activityId property in question node via path. If property is not existing then return null.

Specified by:
getActivityIdForQuestion in interface FAQService
Parameters:
ownerPath - - the Path's Node what is owner created activity
Returns:
String - the Id's activity created.

saveActivityIdForAnswer

public void saveActivityIdForAnswer(String ownerPath,
                                    Answer answer,
                                    String activityId)
Description copied from interface: FAQService
Defines Mixin type exo:activityInfo for answer node that means to add exo:activityId property into Node what is owner created activity via patch

Specified by:
saveActivityIdForAnswer in interface FAQService
Parameters:
ownerPath - - the Path's Node what is owner created activity
activityId - - the Id's activity created.

getActivityIdForAnswer

public String getActivityIdForAnswer(String ownerPath,
                                     Answer answer)
Description copied from interface: FAQService
Gets value of exo:activityId property in answer node via path. If property is not existing then return null.

Specified by:
getActivityIdForAnswer in interface FAQService
Parameters:
ownerPath - - the Path's Node what is owner created activity
Returns:
String - the Id's activity created.

saveActivityIdForComment

public void saveActivityIdForComment(String ownerPath,
                                     String commentId,
                                     String language,
                                     String activityId)
Description copied from interface: FAQService
Defines Mixin type exo:activityInfo for comment node that means to add exo:activityId property into Node what is owner created activity base on provided path.

Specified by:
saveActivityIdForComment in interface FAQService
Parameters:
ownerPath - - the Path's Node what is owner created activity
commentId - - the id of comment posted for the question
language - - the language of comment
activityId - - the Id's activity created.

getActivityIdForComment

public String getActivityIdForComment(String ownerPath,
                                      String commentId,
                                      String language)
Description copied from interface: FAQService
Gets value of exo:activityId property in comment node base on provided path. If property is not existing then return null.

Specified by:
getActivityIdForComment in interface FAQService
Parameters:
ownerPath - - the Path's Node what is owner created activity
commentId - - the id of comment posted for the question
language - - the language of comment
Returns:
String - the Id's activity created.


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