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 a plugin which initializes the 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 a language to a question.
 void addListenerPlugin(AnswerEventListener listener)
          Adds a listener plugin.
 void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
          Adds a plugin to the list of FAQ plugins.
 void addRolePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
          Adds a plugin which defines the "administrator" role.
 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 a watch to a category.
 void addWatchQuestion(String questionId, Watch watch, boolean isNew)
          Adds a watch to a question.
 void addWatchQuestion(String questionId, Watch watch, boolean isNew, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 CategoryTree buildCategoryTree(String categoryId)
          Builds a category tree by its provided Id.
 void calculateDeletedUser(String userName)
          Updates information of answers related to a deleted user.
 void changeStatusCategoryView(List<String> listCateIds)
          Changes status of a category to "hidden" or "shown".
 void changeStatusCategoryView(List<String> listCateIds, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 InputStream createAnswerRSS(String cateId)
          Creates an RSS for a set of answers under a category.
 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 an answer's language.
 void deleteCategoryWatch(String categoryId, String user)
          Deletes a watch from a category.
 void deleteComment(String questionId, String commentId)
          Removes a question's comment.
 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 a comment's language.
 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 the number of existing categories.
 InputStream exportData(String categoryId, boolean createZipFile)
          Exports a category.
 String getActivityIdForAnswer(String ownerPath, Answer answer)
          Gets information of an answer activity that is used for processing the activity streams.
 String getActivityIdForComment(String ownerPath, String commentId, String language)
          Get information of a comment activity that is used for processing the activity streams.
 String getActivityIdForQuestion(String ownerPath)
          Gets information of a question activity that is used for processing the activity streams.
 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 a category by its Id.
 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 a question's answer.
 Answer getAnswerById(String questionId, String answerid, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 Answer getAnswerById(String questionPath, String answerid, String language)
          Gets an answer by its Id.
 Category getCategoryById(String categoryId)
          Gets a category by its 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 information of a category by its Id, including the number of its sub-categories, total of questions, the number of questions which are unapproved and not yet answered.
 CategoryInfo getCategoryInfo(String categoryPath, List<String> categoryIdScoped)
          Gets information of a 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 a category name.
 javax.jcr.Node getCategoryNodeById(String categoryId)
          Gets a category by its Id.
 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 paths of a category by its Id.
 String getCategoryPathOf(String id)
          Gets a category path by its Id.
 String getCategoryPathOfQuestion(String questionPath)
          Gets a question path.
 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 a question's comment.
 Comment getCommentById(String questionPath, String commentId, String language)
          Gets a question's comment by the question path and comment Id.
 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 a given 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 are watched in a category.
 QuestionPageList getListQuestionsWatch(FAQSetting faqSetting, String currentUser)
          Gets a list of questions watched by a user.
 QuestionPageList getListQuestionsWatch(FAQSetting faqSetting, String currentUser, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 long getMaxindexCategory(String parentId)
          Gets the maximum index of categories.
 long getMaxindexCategory(String parentId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 org.exoplatform.forum.common.NotifyInfo getMessageInfo(String name)
          Gets information of a message.
 String[] getModeratorsOf(String path)
          Gets moderators of a question or a category.
 JCRPageList getPageListAnswer(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String questionId, boolean isSortByVote)
           
 JCRPageList getPageListAnswer(String questionId, boolean isSortByVote)
          Gets answers of a question.
 JCRPageList getPageListComment(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider, String questionId)
           
 JCRPageList getPageListComment(String questionId)
          Gets comments of a question.
 String getParentCategoriesName(String path)
          Gets name of a 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 a list of 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 its 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 a question's language.
 List<QuestionLanguage> getQuestionLanguages(String questionId)
          Gets all languages of a question by its Id.
 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 a question by its Id.
 QuestionPageList getQuestionsByCatetory(String categoryId, FAQSetting faqSetting)
          Gets activated and approved questions of a category by its Id.
 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 all questions from a list of categories by its Id.
 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 which are not yet answered.
 List<Question> getQuickQuestionsByListCatetory(List<String> listCategoryId, boolean isNotYetAnswer)
          Gets quick questions from a list of categories.
 Map<String,String> getRelationQuestion(List<String> paths)
          Gets titles of questions, then maps them to their paths.
 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 a question's template.
 FileAttachment getUserAvatar(String userName)
          Gets a user's avatar.
 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 settings of a user that are used for displaying categories and questions.
 List<Watch> getWatchByCategory(String categoryId)
          Gets a list of watches in a category.
 boolean getWatchByUser(String userId, String cateId, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 QuestionPageList getWatchedCategoryByUser(String userId)
          Gets a list of questions watched by a user.
 boolean hasWatch(String categoryPath)
          Checks if a category has been watched or not.
 boolean importData(String categoryId, InputStream inputStream, boolean isZip)
          Imports data to a 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 if a user is administrator or not.
 boolean isAdminRole(String userName, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 boolean isCategoryExist(String name, String path)
          Checks if a category exists or not.
 boolean isCategoryModerator(String categoryId, String user)
          Checks if a user is moderator of a category or not.
 boolean isExisting(String path)
          Checks if a path exists or not.
 boolean isModerateAnswer(String id)
          Checks if moderation is applied to answers of a category or not.
 boolean isModerateQuestion(String id)
          Checks if moderation is applied to a question or not.
 boolean isUserWatched(String userId, String cateId)
          Checks if a user is watching a category or not.
 boolean isViewAuthorInfo(String id)
          Checks if the author information is displayed or not.
 List<Cate> listingCategoryTree()
          Gets a 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 questions to a category.
 Object readCategoryProperty(String categoryId, String propertyName, Class returnType)
          Reads a category property by its name.
 Object readQuestionProperty(String questionId, String propertyName, Class returnType)
          Reads a question property by its name.
 void reCalculateLastActivityOfQuestion(String absPathOfProp)
          Updates the last active information of a question.
 void removeCategory(String categoryId)
          Removes a specific category by its 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 a question.
 void removeListenerPlugin(AnswerEventListener listener)
          Removes a listener plugin.
 void removeQuestion(String questionId)
          Deletes a question by its 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)
          Saves information of an answer activity that is used for processing the activity streams.
 void saveActivityIdForComment(String ownerPath, String commentId, String language, String activityId)
          Saves information of a comment activity that is used for processing the activity streams.
 void saveActivityIdForQuestion(String ownerPath, String activityId)
          Saves information of a question activity that is used for processing the activity streams.
 void saveAnswer(String questionId, Answer[] answers)
          Saves answers.
 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.
 void saveAnswer(String questionPath, QuestionLanguage questionLanguage)
          Saves an answer.
 void saveCategory(String parentId, Category cat, boolean isAddNew)
          Checks if a category exists or not.
 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 a question's comment.
 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 a question's comment.
 void saveFAQSetting(FAQSetting faqSetting, String userName)
          Updates the settings information of FAQ.
 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 information for a question which is added or updated.
 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 a topic.
 void saveTopicIdDiscussQuestion(String questionId, String pathDiscuss, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void saveUserAvatar(String userId, FileAttachment fileAttachment)
          Saves an avatar of the user.
 void saveUserAvatar(String userId, FileAttachment fileAttachment, org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 void setDefaultAvatar(String userName)
          Sets a default avatar for a 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 a vote from a 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)
          Unwatches a 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)
          Unwatches a question.
 void updateQuestionRelatives(String questionPath, String[] relatives)
          Updates relatives of 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 a plugin to the list of FAQ plugins.

Specified by:
addPlugin in interface FAQService
Parameters:
plugin - The plugin to be added.
Throws:
Exception - the exception

addRolePlugin

public void addRolePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
                   throws Exception
Description copied from interface: FAQService
Adds a plugin which defines the "administrator" role.

Specified by:
addRolePlugin in interface FAQService
Parameters:
plugin - The plugin to be added.
Throws:
Exception - the exception

addInitialDataPlugin

public void addInitialDataPlugin(InitialDataPlugin plugin)
                          throws Exception
Description copied from interface: FAQService
Adds a plugin which initializes the default FAQ data.

Specified by:
addInitialDataPlugin in interface FAQService
Parameters:
plugin - The plugin to be added.
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:
Categories.
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:
Questions.
Throws:
Exception - if the attachment is not found.

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 which are not yet answered.

Specified by:
getQuestionsNotYetAnswer in interface FAQService
Parameters:
categoryId - Id of the category which contains unanswered questions.
isApproved - If "true", only approved questions are got.
Returns:
Questions.
Throws:
Exception - if the attachment is lost.

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 information of a category by its Id, including the number of its sub-categories, total of questions, the number of questions which are unapproved and not yet answered.

Specified by:
getCategoryInfo in interface FAQService
Parameters:
categoryId - Id of the category.
setting - Settings of FAQ.
Returns:
The number of sub-categories; The number of questions; The number of unapproved questions; The number of questions which are not yet answered;
Throws:
Exception - if the category or question is not found by its Id, or the attached file is lost.

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 a category by its Id.

Specified by:
getCategoryById in interface FAQService
Parameters:
categoryId - Id of the category.
Returns:
The category.
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 the question.
Returns:
Comments.
Throws:
Exception

getQuestionById

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

Specified by:
getQuestionById in interface FAQService
Parameters:
questionId - Id of the question
Returns:
The 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 activated and approved questions of a category by its Id.

Specified by:
getQuestionsByCatetory in interface FAQService
Parameters:
categoryId - Id of the category.
faqSetting - Settings of FAQ.
Returns:
Questions.
Throws:
Exception - if the category is not found.

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 a category by its Id.

Specified by:
getAllQuestionsByCatetory in interface FAQService
Parameters:
categoryId - Id of the category.
faqSetting - Settings of FAQ.
Returns:
Questions.
Throws:
Exception - when the category is 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 all questions from a list of categories by its Id.

Specified by:
getQuestionsByListCatetory in interface FAQService
Parameters:
listCategoryId - Id of the categories list.
isNotYetAnswer - If "true", all questions which are not yet answered are got. If "false", all questions are got.
Returns:
Questions at the 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 a question path.

Specified by:
getCategoryPathOfQuestion in interface FAQService
Parameters:
questionPath - Id of the category containing the question.
Returns:
The category path.
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 languages of a question by its Id.

Specified by:
getQuestionLanguages in interface FAQService
Parameters:
questionId - Id of the question.
Returns:
Languages.

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 - Id of the category.
faqSetting - Settings of FAQ.
isGetAll - Deprecated.
userView - Users who have the view permission on sub-categories of a category.
Returns:
Sub-categories.
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 questions to a category.

Specified by:
moveQuestions in interface FAQService
Parameters:
questions - The questions to be moved.
destCategoryId - Id of the destination category.
questionLink - URL of the question.
faqSetting - Settings of FAQ.
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 a specific category by its provided Id.

Specified by:
removeCategory in interface FAQService
Parameters:
categoryId - Id of the category which is removed.
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 a question by its Id.

Specified by:
removeQuestion in interface FAQService
Parameters:
questionId - Id of the question which is deleted.
Throws:
Exception - if the question is 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
Checks if a category exists or not. If "true", the new category is created. If "false", the category will be updated.

This function is used to add new or update the category. The user will input information into required fields of the Add Category form, then save the category into database.

Specified by:
saveCategory in interface FAQService
Parameters:
parentId - The address Id of the parent category where the user wants to add a sub-category. When paretId is "null", this category does not contain any sub-categories.
cat - The category information provided by the user.
isAddNew - If "true", the new category is added. If "false", the category is updated.
See Also:
category

buildCategoryTree

public CategoryTree buildCategoryTree(String categoryId)
                               throws Exception
Description copied from interface: FAQService
Builds a category tree by its provided Id.

Specified by:
buildCategoryTree in interface FAQService
Parameters:
categoryId - Id of the category.
Returns:
The category tree.
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 a category to "hidden" or "shown".

Specified by:
changeStatusCategoryView in interface FAQService
Parameters:
listCateIds - Ids of a category which is changed.
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 information for a question which is added or updated.

Specified by:
saveQuestion in interface FAQService
Parameters:
question - The question to be added or updated.
isAddNew - If "true", the new question node is added. If "false", the question is updated.
faqSetting - Settings of FAQ.
Returns:
The question node.
Throws:
Exception - if the question node's path is 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 the settings information of FAQ.

Specified by:
saveFAQSetting in interface FAQService
Parameters:
faqSetting - Settings of FAQ.
userName - Name of the user for whom the FAQ settings are updated.
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 - Id of the category which is moved.
destCategoryId - Id of the destination category.
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 a watch to a category. The notifications will be sent to your registered email when any new questions are added to the watched category.

Specified by:
addWatchCategory in interface FAQService
Parameters:
id - Id of the category which is watched.
watch - The user who watches the category.
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 a watch from a category.

Specified by:
deleteCategoryWatch in interface FAQService
Parameters:
categoryId - Id of the category.
user - The user whose watch is removed by himself or someone else.
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
Unwatches a category.

Specified by:
unWatchCategory in interface FAQService
Parameters:
categoryId - Id of the category which is unwatched.
userCurrent - The user whose watch is removed by himself or someone else.
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
Unwatches a question.

Specified by:
unWatchQuestion in interface FAQService
Parameters:
questionID - Id of the question which is unwatched.
userCurrent - The user whose watch is removed by himself or someone else.
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 a given user.

Specified by:
getListCateIdByModerator in interface FAQService
Parameters:
user - Name of the user.
Returns:
Categories.
Throws:
Exception - if the given user is not found.

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:
The FAQ information matching with 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 paths of a category by its Id.

Specified by:
getCategoryPath in interface FAQService
Parameters:
categoryId - Id of the category.
Returns:
Paths of the category and of its sub-categories.
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 settings of a user that are used for displaying categories and questions. When the user signs up, the system will automatically create settings based on settings of administrator.

Specified by:
getUserSetting in interface FAQService
Parameters:
userName - Name of the user.
faqSetting - Settings of FAQ.
Throws:
Exception - when the user or FAQ settings is/are not found.

getMessageInfo

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

Specified by:
getMessageInfo in interface FAQService
Parameters:
name - Key to get the message.
Returns:
Information which contains 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 if a user is administrator or not.

Specified by:
isAdminRole in interface FAQService
Parameters:
userName - Name of the checked user.
Returns:
The "true" value is returned if the user is admin.
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 a category by its Id.

Specified by:
getCategoryNodeById in interface FAQService
Parameters:
categoryId - Id of the category.
Returns:
The 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 a watch to a question.

Specified by:
addWatchQuestion in interface FAQService
Parameters:
questionId - Id of the question.
watch - Information of the user who watches the question.
isNew - If "true", a new watch is added. If "false", the watch is edited.
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 a list of questions watched by a user.

Specified by:
getListQuestionsWatch in interface FAQService
Parameters:
faqSetting - Settings of FAQ.
currentUser - Name of the user who watches questions.
Returns:
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 a category.

Specified by:
importData in interface FAQService
Parameters:
categoryId - Id of the category.
inputStream - The data.
isZip - Data is zip-typed or not.
Returns:
If the import is successful, the returned value is "true". If not, the returned value is "false".
Throws:
Exception

exportData

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

Specified by:
exportData in interface FAQService
Parameters:
categoryId - Id of the exported category.
createZipFile - The category is exported into a zip file or not.
Returns:
The exported data.
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 the Category 1.
cateId2 - Id of the 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 a topic.

Specified by:
saveTopicIdDiscussQuestion in interface FAQService
Parameters:
questionId - Id of the question which is discussed in the topic.
pathDiscuss - Path to the 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 the maximum index of categories.

Specified by:
getMaxindexCategory in interface FAQService
Parameters:
parentId - Id of the parent category.
Returns:
An index value.
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 the question whose answer is removed.
answerId - Id of the 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 a question's comment.

Specified by:
deleteComment in interface FAQService
Parameters:
questionId - Id of the question whose comment is removed.
commentId - Id of the 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 the question.
answer - The answer to be saved.
isNew - If "true", the new answer is added. If "false", the answer is updated.
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 a question's comment.

Specified by:
saveComment in interface FAQService
Parameters:
questionId - Id of the question.
comment - The saved comment.
isNew - If "true", the new answer is added. If "false", the answer is updated.
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 a question's comment.

Specified by:
getCommentById in interface FAQService
Parameters:
questionId - Id of the question.
commentId - Id of the comment.
Returns:
A 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 a question's answer.

Specified by:
getAnswerById in interface FAQService
Parameters:
questionId - Id of the question.
answerid - Id of the answer.
Returns:
The 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 answers.

Specified by:
saveAnswer in interface FAQService
Parameters:
questionId - Id of the question which contains the saved answers.
answers - The 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 a question.

Specified by:
getPageListAnswer in interface FAQService
Parameters:
questionId - Id of the question.
isSortByVote - If "true", the returned answers will be sorted by vote.
Returns:
Answers.
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 a question.

Specified by:
getPageListComment in interface FAQService
Parameters:
questionId - Id of the question.
Returns:
Comments.
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
Gets a list of questions watched by a user.

Specified by:
getWatchedCategoryByUser in interface FAQService
Parameters:
userId - Name of the user who watches questions.
Returns:
Questions.
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 a user's avatar.

Specified by:
getUserAvatar in interface FAQService
Parameters:
userName - Name of the user.
Returns:
The avatar
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 an avatar of the user.

Specified by:
saveUserAvatar in interface FAQService
Parameters:
userId - Name of the user.
fileAttachment - Avatar of the 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 a default avatar for a user.

Specified by:
setDefaultAvatar in interface FAQService
Parameters:
userName - Name of the user.
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 if a user is watching a category or not.

Specified by:
isUserWatched in interface FAQService
Parameters:
userId - Name of the user.
cateId - Id of the category.
Returns:
The returned value is "true" if the user is watching the category.

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 a list of pending questions in a category.

Specified by:
getPendingQuestionsByCategory in interface FAQService
Parameters:
categoryId - Id of the category.
faqSetting - Settings of FAQ.
Returns:
Pending questions.
Throws:
Exception

isExisting

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

Specified by:
isExisting in interface FAQService
Parameters:
path - The path to be checked.
Returns:
The returned value is "true" if the path has already existed.
Throws:
Exception

getCategoryPathOf

public String getCategoryPathOf(String id)
                         throws Exception
Description copied from interface: FAQService
Gets a category path by its Id.

Specified by:
getCategoryPathOf in interface FAQService
Parameters:
id - Id of the category.
Returns:
The category path.
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 - Paths to the questions.
Returns:
The 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, then maps them to their paths.

Specified by:
getRelationQuestion in interface FAQService
Parameters:
paths - Paths to the questions.
Returns:
Titles of questions which are mapped to their paths.
Throws:
Exception

getQuestionNodeById

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

Specified by:
getQuestionNodeById in interface FAQService
Parameters:
path - Path to the question.
Returns:
The question.
Throws:
Exception

isModerateAnswer

public boolean isModerateAnswer(String id)
                         throws Exception
Description copied from interface: FAQService
Checks if moderation is applied to answers of a category or not.

Specified by:
isModerateAnswer in interface FAQService
Parameters:
id - Id of the category.
Returns:
The returned value is "true" if moderation is enabled.
Throws:
Exception

isModerateQuestion

public boolean isModerateQuestion(String id)
                           throws Exception
Description copied from interface: FAQService
Checks if moderation is applied to a question or not.

Specified by:
isModerateQuestion in interface FAQService
Parameters:
id - Id of the question.
Returns:
The returned value is "true" if moderation is enabled.
Throws:
Exception

getParentCategoriesName

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

Specified by:
getParentCategoriesName in interface FAQService
Parameters:
path - Path to the parent category.
Returns:
Name of the parent category.
Throws:
Exception

getListMailInWatch

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

Specified by:
getListMailInWatch in interface FAQService
Parameters:
categoryId - Id of the category.
Returns:
The email addresses.
Throws:
Exception

isCategoryModerator

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

Specified by:
isCategoryModerator in interface FAQService
Parameters:
categoryId - Id of the category.
user - Name of the user.
Returns:
The returned value is "true" if the user is moderator of the category.
Throws:
Exception

addLanguage

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

Specified by:
addLanguage in interface FAQService
Parameters:
questionPath - Path to the question.
language - Information of the added language.
Throws:
Exception

deleteAnswerQuestionLang

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

Specified by:
deleteAnswerQuestionLang in interface FAQService
Parameters:
questionPath - Path to the question.
answerId - Id of the answer.
language - The language to be deleted.
Throws:
Exception

deleteCommentQuestionLang

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

Specified by:
deleteCommentQuestionLang in interface FAQService
Parameters:
questionPath - Path to the question.
commentId - Id of the comment.
language - The language to be deleted.
isPromoted - If "true", the comment is promoted to an answer.
Throws:
Exception

getQuestionLanguageByLanguage

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

Specified by:
getQuestionLanguageByLanguage in interface FAQService
Parameters:
questionPath - Path to the question.
language - Type of the language.
Returns:
Language of the question.
Throws:
Exception

getCommentById

public Comment getCommentById(String questionPath,
                              String commentId,
                              String language)
                       throws Exception
Description copied from interface: FAQService
Gets a question's comment by the question path and comment Id.

Specified by:
getCommentById in interface FAQService
Parameters:
questionPath - Path to the question.
commentId - Id of the comment.
language - Type of the language.
Returns:
A question's comment.
Throws:
Exception

getAnswerById

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

Specified by:
getAnswerById in interface FAQService
Parameters:
questionPath - Path to the question.
answerid - Id of the answer.
language - Type of the language.
Returns:
The answer.
Throws:
Exception

saveAnswer

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

Specified by:
saveAnswer in interface FAQService
Parameters:
questionPath - Path to the question.
answer - The answer to be saved.
language - The language type of the saved answer.
Throws:
Exception

saveAnswer

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

Specified by:
saveAnswer in interface FAQService
Parameters:
questionPath - Path to the question.
questionLanguage - The language type of the saved answer.
Throws:
Exception

saveComment

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

Specified by:
saveComment in interface FAQService
Parameters:
questionPath - Path to the question.
comment - The comment to be saved.
language - The language type of comment.
Throws:
Exception

removeLanguage

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

Specified by:
removeLanguage in interface FAQService
Parameters:
questionPath - Path to the question.
listLanguage - A list of 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 the answer.
userName - Name of the user who has voted for the answer.
isUp - If this value is "true", the answer is voted up. If "false", the answer is voted down.
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 to the question.
userName - Name of the user who has voted for the question.
number - The value of ratings (from 0 to 5 points).
Throws:
Exception

unVoteQuestion

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

Specified by:
unVoteQuestion in interface FAQService
Parameters:
questionPath - Path to the question.
userName - Name of the user who unvotes the question.
Throws:
Exception

getModeratorsOf

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

Specified by:
getModeratorsOf in interface FAQService
Parameters:
path - Path to the question or category.
Returns:
Moderators.
Throws:
Exception

isViewAuthorInfo

public boolean isViewAuthorInfo(String id)
Description copied from interface: FAQService
Checks if the author information is displayed or not.

Specified by:
isViewAuthorInfo in interface FAQService
Parameters:
id - Id of the question.
Returns:
The returned value is "true" if the author information is displayed.

existingCategories

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

Specified by:
existingCategories in interface FAQService
Returns:
Categories.
Throws:
Exception

getCategoryNameOf

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

Specified by:
getCategoryNameOf in interface FAQService
Parameters:
categoryPath - Path to the category.
Returns:
The category name.
Throws:
Exception

getQuickQuestionsByListCatetory

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

Specified by:
getQuickQuestionsByListCatetory in interface FAQService
Parameters:
listCategoryId - Id of the categories.
isNotYetAnswer - If this value is "true", only quick questions which are not yet answered are got.
Returns:
Quick questions.
Throws:
Exception

listingCategoryTree

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

Specified by:
listingCategoryTree in interface FAQService
Returns:
Categories.
Throws:
Exception

getWatchByCategory

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

Specified by:
getWatchByCategory in interface FAQService
Parameters:
categoryId - Id of the category.
Returns:
Watches.
Throws:
Exception

hasWatch

public boolean hasWatch(String categoryPath)
Description copied from interface: FAQService
Checks if a category has been watched or not.

Specified by:
hasWatch in interface FAQService
Parameters:
categoryPath - Path to the category.
Returns:
The returned value is "true" if the category has been watched.

getCategoryInfo

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

Specified by:
getCategoryInfo in interface FAQService
Parameters:
categoryPath - Path to the category.
categoryIdScoped - A list of sub-categories.
Returns:
The category information.
Throws:
Exception

getTemplate

public byte[] getTemplate()
                   throws Exception
Description copied from interface: FAQService
Gets a question's template.

Specified by:
getTemplate in interface FAQService
Returns:
The 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 - The template to be saved.
Throws:
Exception

isCategoryExist

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

Specified by:
isCategoryExist in interface FAQService
Parameters:
name - Name of the category.
path - Path to the category.
Returns:
The returned value is "true" if the category has already existed.

updateQuestionRelatives

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

Specified by:
updateQuestionRelatives in interface FAQService
Parameters:
questionPath - Path to the question.
relatives - Relative paths of the question.
Throws:
Exception

createAnswerRSS

public InputStream createAnswerRSS(String cateId)
                            throws Exception
Description copied from interface: FAQService
Creates an RSS for a set of answers under a category.

Specified by:
createAnswerRSS in interface FAQService
Parameters:
cateId - Id of the category.
Returns:
RSS.
Throws:
Exception

reCalculateLastActivityOfQuestion

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

Specified by:
reCalculateLastActivityOfQuestion in interface FAQService
Parameters:
absPathOfProp - Path to the question.
Throws:
Exception

addListenerPlugin

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

Specified by:
addListenerPlugin in interface FAQService
Parameters:
listener - The listener plugin to be added.
Throws:
Exception

removeListenerPlugin

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

Specified by:
removeListenerPlugin in interface FAQService
Parameters:
listener - The listener plugin to be removed.
Throws:
Exception

calculateDeletedUser

public void calculateDeletedUser(String userName)
                          throws Exception
Description copied from interface: FAQService
Updates information of answers related to a deleted user.

Specified by:
calculateDeletedUser in interface FAQService
Parameters:
userName - Name of the deleted user.
Throws:
Exception

readCategoryProperty

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

Specified by:
readCategoryProperty in interface FAQService
Parameters:
categoryId - Id of the category.
propertyName - Name of the property.
returnType - A returned type of the property. The supported types are String[], String, Long, Boolean, Double and Date.
Returns:
A property.
Throws:
Exception

readQuestionProperty

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

Specified by:
readQuestionProperty in interface FAQService
Parameters:
questionId - Id of the question.
propertyName - Name of the property.
returnType - A returned type of the property. The supported types are String[], String, Long, Boolean, Double and Date.
Returns:
A property.
Throws:
Exception

saveActivityIdForQuestion

public void saveActivityIdForQuestion(String ownerPath,
                                      String activityId)
Description copied from interface: FAQService
Saves information of a question activity that is used for processing the activity streams.

Specified by:
saveActivityIdForQuestion in interface FAQService
Parameters:
ownerPath - Path to the question activity.
activityId - Id of the question activity.

getActivityIdForQuestion

public String getActivityIdForQuestion(String ownerPath)
Description copied from interface: FAQService
Gets information of a question activity that is used for processing the activity streams.

Specified by:
getActivityIdForQuestion in interface FAQService
Parameters:
ownerPath - Path to the question activity.
Returns:
Id of the question activity.

saveActivityIdForAnswer

public void saveActivityIdForAnswer(String ownerPath,
                                    Answer answer,
                                    String activityId)
Description copied from interface: FAQService
Saves information of an answer activity that is used for processing the activity streams.

Specified by:
saveActivityIdForAnswer in interface FAQService
Parameters:
ownerPath - Path to the answer activity.
answer - Information of the answer which is used for creating or updating the activity.
activityId - Id of the answer activity.

getActivityIdForAnswer

public String getActivityIdForAnswer(String ownerPath,
                                     Answer answer)
Description copied from interface: FAQService
Gets information of an answer activity that is used for processing the activity streams.

Specified by:
getActivityIdForAnswer in interface FAQService
Parameters:
ownerPath - Path to the answer activity.
answer - Information of the answer which is used for getting the activity.
Returns:
Id of the answer activity.

saveActivityIdForComment

public void saveActivityIdForComment(String ownerPath,
                                     String commentId,
                                     String language,
                                     String activityId)
Description copied from interface: FAQService
Saves information of a comment activity that is used for processing the activity streams.

Specified by:
saveActivityIdForComment in interface FAQService
Parameters:
ownerPath - Path to the comment activity.
commentId - Id of the comment.
language - Language of the comment.
activityId - Id of the comment activity.

getActivityIdForComment

public String getActivityIdForComment(String ownerPath,
                                      String commentId,
                                      String language)
Description copied from interface: FAQService
Get information of a comment activity that is used for processing the activity streams.

Specified by:
getActivityIdForComment in interface FAQService
Parameters:
ownerPath - Path to the comment activity.
commentId - Id of the comment.
language - Language of the comment.
Returns:
Id of the comment activity.


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