org.exoplatform.faq.service
Interface FAQService

All Superinterfaces:
FAQServiceLegacy
All Known Implementing Classes:
FAQServiceImpl

public interface FAQService
extends FAQServiceLegacy

APIs for FAQ and all operations of other related objects (Categories, Questions and Answers).


Method Summary
 void addInitialDataPlugin(InitialDataPlugin plugin)
          Adds a plugin which initializes the default FAQ data.
 void addLanguage(javax.jcr.Node questionNode, QuestionLanguage language)
          Adds a language to a question.
 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 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.
 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".
 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 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 deleteCommentQuestionLang(String questionPath, String commentId, String language, boolean isPromoted)
          Deletes a comment's language.
 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<String> getAllFAQAdmin()
          Gets all users who are administrators of FAQ.
 QuestionPageList getAllQuestions()
          Gets all questions.
 QuestionPageList getAllQuestionsByCatetory(String categoryId, FAQSetting faqSetting)
          Gets all questions of a category by its Id.
 Answer getAnswerById(String questionId, String answerid)
          Gets a question's answer.
 Answer getAnswerById(String questionPath, String answerid, String language)
          Gets an answer by its Id.
 Category getCategoryById(String categoryId)
          Gets a category by its Id.
 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.
 String getCategoryNameOf(String categoryPath)
          Gets a category name.
 javax.jcr.Node getCategoryNodeById(String categoryId)
          Gets a category by its Id.
 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 categoryId)
          Gets a question path.
 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.
 List<String> getListCateIdByModerator(String user)
          Get all categories of a given user.
 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.
 long getMaxindexCategory(String parentId)
          Gets the maximum index of categories.
 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(String questionId, boolean isSortByVote)
          Gets answers of a question.
 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()
          Gets messages which are not yet sent.
 QuestionPageList getPendingQuestionsByCategory(String categoryId, FAQSetting faqSetting)
          Gets a list of pending questions in a category.
 Question getQuestionById(String questionId)
          Gets a question by its Id.
 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.
 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 getQuestionsByListCatetory(List<String> listCategoryId, boolean isNotYetAnswer)
          Gets all questions from a list of categories by its Id.
 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)
          Searches for information in FAQ.
 List<Category> getSubCategories(String categoryId, FAQSetting faqSetting, boolean isGetAll, List<String> userView)
          Gets all sub-categories of a category.
 byte[] getTemplate()
          Gets a question's template.
 FileAttachment getUserAvatar(String userName)
          Gets a user's avatar.
 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.
 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.
 boolean isAdminRole(String userName)
          Checks if a user is administrator or not.
 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 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 absPathOfItem)
          Updates the last active information of a question.
 void removeCategory(String categoryId)
          Removes a specific category by its provided Id.
 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 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 answer, boolean isNew)
          Saves an answer.
 void saveAnswer(String questionPath, Answer answer, String languge)
          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 saveComment(String questionId, Comment comment, boolean isNew)
          Saves a question's comment.
 void saveComment(String questionPath, Comment comment, String languge)
          Saves a question's comment.
 void saveFAQSetting(FAQSetting faqSetting, String userName)
          Updates the settings information of FAQ.
 javax.jcr.Node saveQuestion(Question question, boolean isAddNew, FAQSetting faqSetting)
          Saves information for a question which is added or updated.
 void saveTemplate(String str)
          Saves a template.
 void saveTopicIdDiscussQuestion(String questionId, String pathDiscuss)
          Saves a topic.
 void saveUserAvatar(String userId, FileAttachment fileAttachment)
          Saves an avatar of the user.
 void setDefaultAvatar(String userName)
          Sets a default avatar for a user.
 void swapCategories(String cateId1, String cateId2)
          Swaps two categories.
 void unVoteQuestion(String questionPath, String userName)
          Removes a vote from a question.
 void unWatchCategory(String categoryId, String userCurrent)
          Unwatches a 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.
 

Method Detail

addPlugin

void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
               throws Exception
Adds a plugin to the list of FAQ plugins.

Parameters:
plugin - The plugin to be added.
Throws:
Exception - the exception

addInitialDataPlugin

void addInitialDataPlugin(InitialDataPlugin plugin)
                          throws Exception
Adds a plugin which initializes the default FAQ data.

Parameters:
plugin - The plugin to be added.
Throws:
Exception

saveCategory

void saveCategory(String parentId,
                  Category cat,
                  boolean isAddNew)
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.

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

CategoryTree buildCategoryTree(String categoryId)
                               throws Exception
Builds a category tree by its provided Id.

Parameters:
categoryId - Id of the category.
Returns:
The category tree.
Throws:
Exception

changeStatusCategoryView

void changeStatusCategoryView(List<String> listCateIds)
                              throws Exception
Changes status of a category to "hidden" or "shown".

Parameters:
listCateIds - Ids of a category which is changed.
Throws:
Exception - the exception

removeCategory

void removeCategory(String categoryId)
                    throws Exception
Removes a specific category by its provided Id.

Parameters:
categoryId - Id of the category which is removed.
Throws:
Exception - the exception

getCategoryById

Category getCategoryById(String categoryId)
                         throws Exception
Gets a category by its Id.

Parameters:
categoryId - Id of the category.
Returns:
The category.
Throws:
Exception - the exception

getAllCategories

List<Category> getAllCategories()
                                throws Exception
Gets all categories.

Returns:
Categories.
Throws:
Exception - the exception

getListCateIdByModerator

List<String> getListCateIdByModerator(String user)
                                      throws Exception
Get all categories of a given user.

Parameters:
user - Name of the user.
Returns:
Categories.
Throws:
Exception - if the given user is not found.

getSubCategories

List<Category> getSubCategories(String categoryId,
                                FAQSetting faqSetting,
                                boolean isGetAll,
                                List<String> userView)
                                throws Exception
Gets all sub-categories of a category.

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

moveCategory

void moveCategory(String categoryId,
                  String destCategoryId)
                  throws Exception
Moves a category to another one.

Parameters:
categoryId - Id of the category which is moved.
destCategoryId - Id of the destination category.
Throws:
Exception - the exception

saveQuestion

javax.jcr.Node saveQuestion(Question question,
                            boolean isAddNew,
                            FAQSetting faqSetting)
                            throws Exception
Saves information for a question which is added or updated.

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.

removeQuestion

void removeQuestion(String questionId)
                    throws Exception
Deletes a question by its Id.

Parameters:
questionId - Id of the question which is deleted.
Throws:
Exception - if the question is not found.

getQuestionById

Question getQuestionById(String questionId)
                         throws Exception
Gets a question by its Id.

Parameters:
questionId - Id of the question
Returns:
The question
Throws:
Exception - the exception

getAllQuestions

QuestionPageList getAllQuestions()
                                 throws Exception
Gets all questions.

Returns:
Questions.
Throws:
Exception - if the attachment is not found.

getQuestionsNotYetAnswer

QuestionPageList getQuestionsNotYetAnswer(String categoryId,
                                          boolean isApproved)
                                          throws Exception
Gets all questions which are not yet answered.

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.

getQuestionsByCatetory

QuestionPageList getQuestionsByCatetory(String categoryId,
                                        FAQSetting faqSetting)
                                        throws Exception
Gets activated and approved questions of a category by its Id.

Parameters:
categoryId - Id of the category.
faqSetting - Settings of FAQ.
Returns:
Questions.
Throws:
Exception - if the category is not found.

getAllQuestionsByCatetory

QuestionPageList getAllQuestionsByCatetory(String categoryId,
                                           FAQSetting faqSetting)
                                           throws Exception
Gets all questions of a category by its Id.

Parameters:
categoryId - Id of the category.
faqSetting - Settings of FAQ.
Returns:
Questions.
Throws:
Exception - when the category is not found.

getCategoryInfo

long[] getCategoryInfo(String categoryId,
                       FAQSetting setting)
                       throws Exception
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.

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.
Exception - the exception

getQuestionsByListCatetory

QuestionPageList getQuestionsByListCatetory(List<String> listCategoryId,
                                            boolean isNotYetAnswer)
                                            throws Exception
Gets all questions from a list of categories by its Id.

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

String getCategoryPathOfQuestion(String categoryId)
                                 throws Exception
Gets a question path.

Parameters:
categoryId - Id of the category containing the question.
Returns:
The category path.
Throws:
Exception

getQuestionLanguages

List<QuestionLanguage> getQuestionLanguages(String questionId)
Gets all languages of a question by its Id.

Parameters:
questionId - Id of the question.
Returns:
Languages.

moveQuestions

void moveQuestions(List<String> questions,
                   String destCategoryId,
                   String questionLink,
                   FAQSetting faqSetting)
                   throws Exception
Moves questions to a category.

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

saveFAQSetting

void saveFAQSetting(FAQSetting faqSetting,
                    String userName)
                    throws Exception
Updates the settings information of FAQ.

Parameters:
faqSetting - Settings of FAQ.
userName - Name of the user for whom the FAQ settings are updated.
Throws:
Exception - the exception

addWatchCategory

void addWatchCategory(String id,
                      Watch watch)
                      throws Exception
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.

Parameters:
id - Id of the category which is watched.
watch - The user who watches the category.
Throws:
Exception - the exception

deleteCategoryWatch

void deleteCategoryWatch(String categoryId,
                         String user)
                         throws Exception
Deletes a watch from a category.

Parameters:
categoryId - Id of the category.
user - The user whose watch is removed by himself or someone else.
Throws:
Exception - the exception

unWatchCategory

void unWatchCategory(String categoryId,
                     String userCurrent)
                     throws Exception
Unwatches a category.

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

void unWatchQuestion(String questionID,
                     String userCurrent)
                     throws Exception
Unwatches a question.

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

getSearchResults

List<ObjectSearchResult> getSearchResults(FAQEventQuery eventQuery)
                                          throws Exception
Searches for information in FAQ.

Parameters:
eventQuery - The Search condition.
Returns:
The FAQ information matching with the search condition.
Throws:
Exception

getCategoryPath

List<String> getCategoryPath(String categoryId)
                             throws Exception
Gets paths of a category by its Id.

Parameters:
categoryId - Id of the category.
Returns:
Paths of the category and of its sub-categories.
Throws:
Exception - the exception

getPendingMessages

Iterator<org.exoplatform.forum.common.NotifyInfo> getPendingMessages()
Gets messages which are not yet sent.


addLanguage

void addLanguage(javax.jcr.Node questionNode,
                 QuestionLanguage language)
                 throws Exception
Adds a language to a question. The added language is never set as default.

This method checks if a language node exists or not. If the language node does not exist, it will be added. Next, this method sets properties for the language node: name, content of question and response.

Parameters:
questionNode - The question to which a language is added.
language - Information of the added language.
Throws:
Exception - the exception

getUserSetting

void getUserSetting(String userName,
                    FAQSetting faqSetting)
                    throws Exception
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.

Parameters:
userName - Name of the user.
faqSetting - Settings of FAQ.
Throws:
Exception - when the user or FAQ settings is/are not found.

getMessageInfo

org.exoplatform.forum.common.NotifyInfo getMessageInfo(String name)
                                                       throws Exception
Gets information of a message.

Parameters:
name - Key to get the message.
Returns:
Information which contains message and email addresses.
Throws:
Exception

isAdminRole

boolean isAdminRole(String userName)
                    throws Exception
Checks if a user is administrator or not.

Parameters:
userName - Name of the checked user.
Returns:
The "true" value is returned if the user is admin.
Throws:
Exception

getAllFAQAdmin

List<String> getAllFAQAdmin()
                            throws Exception
Gets all users who are administrators of FAQ.

Throws:
Exception - the exception

addRolePlugin

void addRolePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
                   throws Exception
Adds a plugin which defines the "administrator" role.

Parameters:
plugin - The plugin to be added.
Throws:
Exception - the exception

addWatchQuestion

void addWatchQuestion(String questionId,
                      Watch watch,
                      boolean isNew)
                      throws Exception
Adds a watch to a question.

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

saveTopicIdDiscussQuestion

void saveTopicIdDiscussQuestion(String questionId,
                                String pathDiscuss)
                                throws Exception
Saves a topic.

Parameters:
questionId - Id of the question which is discussed in the topic.
pathDiscuss - Path to the discussion.
Throws:
Exception

getListQuestionsWatch

QuestionPageList getListQuestionsWatch(FAQSetting faqSetting,
                                       String currentUser)
                                       throws Exception
Gets a list of questions watched by a user.

Parameters:
faqSetting - Settings of FAQ.
currentUser - Name of the user who watches questions.
Returns:
Questions.
Throws:
Exception

getCategoryNodeById

javax.jcr.Node getCategoryNodeById(String categoryId)
                                   throws Exception
Gets a category by its Id.

Parameters:
categoryId - Id of the category.
Returns:
The category.
Throws:
Exception

importData

boolean importData(String categoryId,
                   InputStream inputStream,
                   boolean isZip)
                   throws Exception
Imports data to a category.

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

swapCategories

void swapCategories(String cateId1,
                    String cateId2)
                    throws Exception
Swaps two categories.

Parameters:
cateId1 - Id of the Category 1.
cateId2 - Id of the Category 2.
Throws:
Exception

getMaxindexCategory

long getMaxindexCategory(String parentId)
                         throws Exception
Gets the maximum index of categories.

Parameters:
parentId - Id of the parent category.
Returns:
An index value.
Throws:
Exception

deleteAnswer

void deleteAnswer(String questionId,
                  String answerId)
                  throws Exception
Removes an answer.

Parameters:
questionId - Id of the question whose answer is removed.
answerId - Id of the answer.
Throws:
Exception

deleteComment

void deleteComment(String questionId,
                   String commentId)
                   throws Exception
Removes a question's comment.

Parameters:
questionId - Id of the question whose comment is removed.
commentId - Id of the comment.
Throws:
Exception

saveAnswer

void saveAnswer(String questionId,
                Answer answer,
                boolean isNew)
                throws Exception
Saves an answer.

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

void saveComment(String questionId,
                 Comment comment,
                 boolean isNew)
                 throws Exception
Saves a question's comment.

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

Comment getCommentById(String questionId,
                       String commentId)
                       throws Exception
Gets a question's comment.

Parameters:
questionId - Id of the question.
commentId - Id of the comment.
Returns:
A comment.
Throws:
Exception

getAnswerById

Answer getAnswerById(String questionId,
                     String answerid)
                     throws Exception
Gets a question's answer.

Parameters:
questionId - Id of the question.
answerid - Id of the answer.
Returns:
The answer.
Throws:
Exception

saveAnswer

void saveAnswer(String questionId,
                Answer[] answers)
                throws Exception
Saves answers.

Parameters:
questionId - Id of the question which contains the saved answers.
answers - The saved answers.
Throws:
Exception

getPageListComment

JCRPageList getPageListComment(String questionId)
                               throws Exception
Gets comments of a question.

Parameters:
questionId - Id of the question.
Returns:
Comments.
Throws:
Exception

getPageListAnswer

JCRPageList getPageListAnswer(String questionId,
                              boolean isSortByVote)
                              throws Exception
Gets answers of a question.

Parameters:
questionId - Id of the question.
isSortByVote - If "true", the returned answers will be sorted by vote.
Returns:
Answers.
Throws:
Exception

getWatchedCategoryByUser

QuestionPageList getWatchedCategoryByUser(String userId)
                                          throws Exception
Gets a list of questions watched by a user.

Parameters:
userId - Name of the user who watches questions.
Returns:
Questions.
Throws:
Exception

getUserAvatar

FileAttachment getUserAvatar(String userName)
                             throws Exception
Gets a user's avatar.

Parameters:
userName - Name of the user.
Returns:
The avatar
Throws:
Exception

saveUserAvatar

void saveUserAvatar(String userId,
                    FileAttachment fileAttachment)
                    throws Exception
Saves an avatar of the user.

Parameters:
userId - Name of the user.
fileAttachment - Avatar of the user.
Throws:
Exception

isUserWatched

boolean isUserWatched(String userId,
                      String cateId)
Checks if a user is watching a category or not.

Parameters:
userId - Name of the user.
cateId - Id of the category.
Returns:
The returned value is "true" if the user is watching the category.
Throws:
Exception

setDefaultAvatar

void setDefaultAvatar(String userName)
                      throws Exception
Sets a default avatar for a user.

Parameters:
userName - Name of the user.
Throws:
Exception

getPendingQuestionsByCategory

QuestionPageList getPendingQuestionsByCategory(String categoryId,
                                               FAQSetting faqSetting)
                                               throws Exception
Gets a list of pending questions in a category.

Parameters:
categoryId - Id of the category.
faqSetting - Settings of FAQ.
Returns:
Pending questions.
Throws:
Exception

exportData

InputStream exportData(String categoryId,
                       boolean createZipFile)
                       throws Exception
Exports a category.

Parameters:
categoryId - Id of the exported category.
createZipFile - The category is exported into a zip file or not.
Returns:
The exported data.
Throws:
Exception

isExisting

boolean isExisting(String path)
                   throws Exception
Checks if a path exists or not.

Parameters:
path - The path to be checked.
Returns:
The returned value is "true" if the path has already existed.
Throws:
Exception

getCategoryPathOf

String getCategoryPathOf(String id)
                         throws Exception
Gets a category path by its Id.

Parameters:
id - Id of the category.
Returns:
The category path.
Throws:
Exception

getRelationQuestion

Map<String,String> getRelationQuestion(List<String> paths)
                                       throws Exception
Gets titles of questions, then maps them to their paths.

Parameters:
paths - Paths to the questions.
Returns:
Titles of questions which are mapped to their paths.
Throws:
Exception

getQuestionContents

List<String> getQuestionContents(List<String> paths)
                                 throws Exception
Gets titles of questions.

Parameters:
paths - Paths to the questions.
Returns:
The titles of questions.
Throws:
Exception

isModerateAnswer

boolean isModerateAnswer(String id)
                         throws Exception
Checks if moderation is applied to answers of a category or not.

Parameters:
id - Id of the category.
Returns:
The returned value is "true" if moderation is enabled.
Throws:
Exception

getQuestionNodeById

javax.jcr.Node getQuestionNodeById(String path)
                                   throws Exception
Gets a question by its Id.

Parameters:
path - Path to the question.
Returns:
The question.
Throws:
Exception

getParentCategoriesName

String getParentCategoriesName(String path)
                               throws Exception
Gets name of a parent category.

Parameters:
path - Path to the parent category.
Returns:
Name of the parent category.
Throws:
Exception

getListMailInWatch

QuestionPageList getListMailInWatch(String categoryId)
                                    throws Exception
Gets email addresses that are watched in a category.

Parameters:
categoryId - Id of the category.
Returns:
The email addresses.
Throws:
Exception

isCategoryModerator

boolean isCategoryModerator(String categoryId,
                            String user)
                            throws Exception
Checks if a user is moderator of a category or not.

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

void addLanguage(String questionPath,
                 QuestionLanguage language)
                 throws Exception
Adds a language to a question.

Parameters:
questionPath - Path to the question.
language - Information of the added language.
Throws:
Exception

deleteAnswerQuestionLang

void deleteAnswerQuestionLang(String questionPath,
                              String answerId,
                              String language)
                              throws Exception
Deletes an answer's language.

Parameters:
questionPath - Path to the question.
answerId - Id of the answer.
language - The language to be deleted.
Throws:
Exception

deleteCommentQuestionLang

void deleteCommentQuestionLang(String questionPath,
                               String commentId,
                               String language,
                               boolean isPromoted)
                               throws Exception
Deletes a comment's language.

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

QuestionLanguage getQuestionLanguageByLanguage(String questionPath,
                                               String language)
                                               throws Exception
Gets a question's language.

Parameters:
questionPath - Path to the question.
language - Type of the language.
Returns:
Language of the question.
Throws:
Exception

getCommentById

Comment getCommentById(String questionPath,
                       String commentId,
                       String language)
                       throws Exception
Gets a question's comment by the question path and comment Id.

Parameters:
questionPath - Path to the question.
commentId - Id of the comment.
language - Type of the language.
Returns:
A question's comment.
Throws:
Exception

getAnswerById

Answer getAnswerById(String questionPath,
                     String answerid,
                     String language)
                     throws Exception
Gets an answer by its Id.

Parameters:
questionPath - Path to the question.
answerid - Id of the answer.
language - Type of the language.
Returns:
The answer.
Throws:
Exception

saveAnswer

void saveAnswer(String questionPath,
                Answer answer,
                String languge)
                throws Exception
Saves an answer.

Parameters:
questionPath - Path to the question.
answer - The answer to be saved.
languge - The language type of the saved answer.
Throws:
Exception

saveAnswer

void saveAnswer(String questionPath,
                QuestionLanguage questionLanguage)
                throws Exception
Saves an answer.

Parameters:
questionPath - Path to the question.
questionLanguage - The language type of the saved answer.
Throws:
Exception

saveComment

void saveComment(String questionPath,
                 Comment comment,
                 String languge)
                 throws Exception
Saves a question's comment.

Parameters:
questionPath - Path to the question.
comment - The comment to be saved.
languge - The language type of comment.
Throws:
Exception

removeLanguage

void removeLanguage(String questionPath,
                    List<String> listLanguage)
Removes languages from a question.

Parameters:
questionPath - Path to the question.
listLanguage - A list of removed languages.
Throws:
Exception

voteAnswer

void voteAnswer(String answerPath,
                String userName,
                boolean isUp)
                throws Exception
Votes for an answer.

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

void voteQuestion(String questionPath,
                  String userName,
                  int number)
                  throws Exception
Votes for a question.

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

getModeratorsOf

String[] getModeratorsOf(String path)
                         throws Exception
Gets moderators of a question or a category.

Parameters:
path - Path to the question or category.
Returns:
Moderators.
Throws:
Exception

unVoteQuestion

void unVoteQuestion(String questionPath,
                    String userName)
                    throws Exception
Removes a vote from a question.

Parameters:
questionPath - Path to the question.
userName - Name of the user who unvotes the question.
Throws:
Exception

isViewAuthorInfo

boolean isViewAuthorInfo(String id)
Checks if the author information is displayed or not.

Parameters:
id - Id of the question.
Returns:
The returned value is "true" if the author information is displayed.

existingCategories

long existingCategories()
                        throws Exception
Gets the number of existing categories.

Returns:
Categories.
Throws:
Exception

getCategoryNameOf

String getCategoryNameOf(String categoryPath)
                         throws Exception
Gets a category name.

Parameters:
categoryPath - Path to the category.
Returns:
The category name.
Throws:
Exception

getQuickQuestionsByListCatetory

List<Question> getQuickQuestionsByListCatetory(List<String> listCategoryId,
                                               boolean isNotYetAnswer)
                                               throws Exception
Gets quick questions from a list of categories.

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

List<Cate> listingCategoryTree()
                               throws Exception
Gets a list of categories.

Returns:
Categories.
Throws:
Exception

getWatchByCategory

List<Watch> getWatchByCategory(String categoryId)
                               throws Exception
Gets a list of watches in a category.

Parameters:
categoryId - Id of the category.
Returns:
Watches.
Throws:
Exception

hasWatch

boolean hasWatch(String categoryPath)
Checks if a category has been watched or not.

Parameters:
categoryPath - Path to the category.
Returns:
The returned value is "true" if the category has been watched.
Throws:
Exception

getCategoryInfo

CategoryInfo getCategoryInfo(String categoryPath,
                             List<String> categoryIdScoped)
                             throws Exception
Gets information of a category.

Parameters:
categoryPath - Path to the category.
categoryIdScoped - A list of sub-categories.
Returns:
The category information.
Throws:
Exception

getTemplate

byte[] getTemplate()
                   throws Exception
Gets a question's template.

Returns:
The template.
Throws:
Exception

saveTemplate

void saveTemplate(String str)
                  throws Exception
Saves a template.

Parameters:
str - The template to be saved.
Throws:
Exception

isCategoryExist

boolean isCategoryExist(String name,
                        String path)
Checks if a category exists or not.

Parameters:
name - Name of the category.
path - Path to the category.
Returns:
The returned value is "true" if the category has already existed.
Throws:
Exception

updateQuestionRelatives

void updateQuestionRelatives(String questionPath,
                             String[] relatives)
                             throws Exception
Updates relatives of a question.

Parameters:
questionPath - Path to the question.
relatives - Relative paths of the question.
Throws:
Exception

isModerateQuestion

boolean isModerateQuestion(String id)
                           throws Exception
Checks if moderation is applied to a question or not.

Parameters:
id - Id of the question.
Returns:
The returned value is "true" if moderation is enabled.
Throws:
Exception

createAnswerRSS

InputStream createAnswerRSS(String cateId)
                            throws Exception
Creates an RSS for a set of answers under a category.

Parameters:
cateId - Id of the category.
Returns:
RSS.
Throws:
Exception

reCalculateLastActivityOfQuestion

void reCalculateLastActivityOfQuestion(String absPathOfItem)
                                       throws Exception
Updates the last active information of a question.

Parameters:
absPathOfItem - Path to the question.
Throws:
Exception

addListenerPlugin

void addListenerPlugin(AnswerEventListener listener)
                       throws Exception
Adds a listener plugin.

Parameters:
listener - The listener plugin to be added.
Throws:
Exception

removeListenerPlugin

void removeListenerPlugin(AnswerEventListener listener)
                          throws Exception
Removes a listener plugin.

Parameters:
listener - The listener plugin to be removed.
Throws:
Exception

getComments

Comment[] getComments(String questionId)
                      throws Exception
Gets comments of a question.

Parameters:
questionId - Id of the question.
Returns:
Comments.
Throws:
Exception

calculateDeletedUser

void calculateDeletedUser(String userName)
                          throws Exception
Updates information of answers related to a deleted user.

Parameters:
userName - Name of the deleted user.
Throws:
Exception

readCategoryProperty

Object readCategoryProperty(String categoryId,
                            String propertyName,
                            Class returnType)
                            throws Exception
Reads a category property by its name.

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

Object readQuestionProperty(String questionId,
                            String propertyName,
                            Class returnType)
                            throws Exception
Reads a question property by its name.

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

void saveActivityIdForQuestion(String ownerPath,
                               String activityId)
Saves information of a question activity that is used for processing the activity streams.

Parameters:
ownerPath - Path to the question activity.
activityId - Id of the question activity.
Since:
4.0

getActivityIdForQuestion

String getActivityIdForQuestion(String ownerPath)
Gets information of a question activity that is used for processing the activity streams.

Parameters:
ownerPath - Path to the question activity.
Returns:
Id of the question activity.
Since:
4.0

saveActivityIdForAnswer

void saveActivityIdForAnswer(String ownerPath,
                             Answer answer,
                             String activityId)
Saves information of an answer activity that is used for processing the activity streams.

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.
Since:
4.0

getActivityIdForAnswer

String getActivityIdForAnswer(String ownerPath,
                              Answer answer)
Gets information of an answer activity that is used for processing the activity streams.

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.
Since:
4.0

saveActivityIdForComment

void saveActivityIdForComment(String ownerPath,
                              String commentId,
                              String language,
                              String activityId)
Saves information of a comment activity that is used for processing the activity streams.

Parameters:
ownerPath - Path to the comment activity.
commentId - Id of the comment.
language - Language of the comment.
activityId - Id of the comment activity.
Since:
4.0

getActivityIdForComment

String getActivityIdForComment(String ownerPath,
                               String commentId,
                               String language)
Get information of a comment activity that is used for processing the activity streams.

Parameters:
ownerPath - Path to the comment activity.
commentId - Id of the comment.
language - Language of the comment.
Returns:
Id of the comment activity.
Since:
4.0


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