org.exoplatform.faq.service.impl
Class JCRDataStorage

java.lang.Object
  extended by org.exoplatform.faq.service.impl.JCRDataStorage

public class JCRDataStorage
extends java.lang.Object

Created by The eXo Platform SARL Author : Hung Nguyen Quang hung.nguyen@exoplatform.com Jul 10, 2007


Constructor Summary
JCRDataStorage()
           
JCRDataStorage(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, org.exoplatform.services.jcr.RepositoryService rService)
           
 
Method Summary
 void addInitRssPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
           
 void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
           
 void addRolePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
           
protected  void addRSSListener(javax.jcr.Node node)
           
 void addWatchCategory(java.lang.String id, Watch watch)
           
 void addWatchQuestion(java.lang.String questionId, Watch watch, boolean isNew)
           
protected  javax.jcr.Value[] booleanToValues(javax.jcr.Node node, java.lang.Boolean[] bools)
           
 void changeStatusCategoryView(java.util.List<java.lang.String> listCateIds)
           
 void deleteAnswer(java.lang.String questionId, java.lang.String answerId)
           
 void deleteCategoryWatch(java.lang.String categoryId, java.lang.String user)
           
 void deleteComment(java.lang.String questionId, java.lang.String commentId)
           
 long existingCategories()
           
 java.io.InputStream exportData(java.lang.String categoryId, boolean createZipFile)
           
 java.util.List<Category> findCategoriesByName(java.lang.String categoryName)
           
 java.util.List<Category> getAllCategories()
           
 java.util.List<java.lang.String> getAllFAQAdmin()
           
 QuestionPageList getAllQuestions()
           
 QuestionPageList getAllQuestionsByCatetory(java.lang.String categoryId, FAQSetting faqSetting)
           
 Answer getAnswerById(java.lang.String questionId, java.lang.String answerid)
           
 Category getCategoryById(java.lang.String categoryId)
           
 long[] getCategoryInfo(java.lang.String categoryId, FAQSetting faqSetting)
           
 CategoryInfo getCategoryInfo(java.lang.String categoryPath, java.util.List<java.lang.String> categoryIdScoped)
           
 java.lang.String getCategoryNameOf(java.lang.String categoryPath)
           
 javax.jcr.Node getCategoryNodeById(java.lang.String categoryId)
           
 java.util.List<java.lang.String> getCategoryPath(java.lang.String categoryId)
           
 java.lang.String getCategoryPathOf(java.lang.String id)
           
 java.lang.String getCategoryPathOfQuestion(java.lang.String questionPath)
           
 Comment getCommentById(javax.jcr.Node questionNode, java.lang.String commentId)
           
 Comment getCommentById(java.lang.String questionId, java.lang.String commentId)
           
protected  javax.jcr.Node getFAQServiceHome(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 java.util.List<java.lang.String> getListCateIdByModerator(java.lang.String user)
           
 QuestionPageList getListMailInWatch(java.lang.String categoryId)
           
 QuestionPageList getListQuestionsWatch(FAQSetting faqSetting, java.lang.String currentUser)
           
 long getMaxindexCategory(java.lang.String parentId)
           
 NotifyInfo getMessageInfo(java.lang.String name)
           
 java.lang.String[] getModeratorsOf(java.lang.String path)
           
 JCRPageList getPageListAnswer(java.lang.String questionId, java.lang.Boolean isSortByVote)
           
 JCRPageList getPageListComment(java.lang.String questionId)
           
 java.lang.String getParentCategoriesName(java.lang.String path)
           
 QuestionPageList getPendingQuestionsByCategory(java.lang.String categoryId, FAQSetting faqSetting)
           
 Question getQuestionById(java.lang.String questionId)
           
 java.util.List<java.lang.String> getQuestionContents(java.util.List<java.lang.String> paths)
           
 java.util.List<QuestionLanguage> getQuestionLanguages(java.lang.String questionId)
           
 javax.jcr.Node getQuestionNodeById(java.lang.String path)
           
 QuestionPageList getQuestionsByCatetory(java.lang.String categoryId, FAQSetting faqSetting)
           
 QuestionPageList getQuestionsByListCatetory(java.util.List<java.lang.String> listCategoryId, boolean isNotYetAnswer)
           
 javax.jcr.NodeIterator getQuestionsIterator()
           
 QuestionPageList getQuestionsNotYetAnswer(java.lang.String categoryId, boolean isApproved)
           
 java.util.List<Question> getQuickQuestionsByListCatetory(java.util.List<java.lang.String> listCategoryId, boolean isNotYetAnswer)
           
 java.util.List<ObjectSearchResult> getSearchResults(FAQEventQuery eventQuery)
           
 java.util.List<Category> getSubCategories(java.lang.String categoryId, FAQSetting faqSetting, boolean isGetAll, java.util.List<java.lang.String> limitedUsers)
           
 byte[] getTemplate()
           
 FileAttachment getUserAvatar(java.lang.String userName)
           
 void getUserSetting(java.lang.String userName, FAQSetting faqSetting)
           
 java.util.List<Watch> getWatchByCategory(java.lang.String categoryId)
           
 java.util.List<Watch> getWatchByQuestion(java.lang.String questionId)
           
 QuestionPageList getWatchedCategoryByUser(java.lang.String userId)
           
 java.util.List<java.lang.String> getWatchedSubCategory(java.lang.String userId, java.lang.String cateId)
           
 boolean hasWatch(java.lang.String categoryPath)
           
 boolean importData(java.lang.String parentId, java.io.InputStream inputStream, boolean isZip)
           
 boolean initRootCategory()
           
 boolean isAdminRole(java.lang.String userName)
           
 boolean isCategoryExist(java.lang.String name, java.lang.String path)
           
 boolean isCategoryModerator(java.lang.String categoryPath, java.lang.String user)
           
 boolean isExisting(java.lang.String path)
           
 boolean isModerateAnswer(java.lang.String id)
           
 boolean isModerateQuestion(java.lang.String id)
           
 boolean isUserWatched(java.lang.String userId, java.lang.String cateId)
           
 boolean isViewAuthorInfo(java.lang.String id)
           
 java.util.List<Cate> listingCategoryTree()
           
 void moveCategory(java.lang.String categoryId, java.lang.String destCategoryId)
           
 void moveQuestions(java.util.List<java.lang.String> questions, java.lang.String destCategoryId, java.lang.String questionLink, FAQSetting faqSetting)
           
 void reInitRSSEvenListener()
           
 void removeCategory(java.lang.String categoryId)
           
 void removeQuestion(java.lang.String questionId)
           
 void saveAnswer(java.lang.String questionId, Answer[] answers)
           
 void saveAnswer(java.lang.String questionId, Answer answer, boolean isNew)
           
 void saveAnswerQuestionLang(java.lang.String questionId, Answer answer, java.lang.String language, boolean isNew)
           
 void saveCategory(java.lang.String parentId, Category cat, boolean isAddNew)
           
 void saveComment(java.lang.String questionId, Comment comment, boolean isNew)
           
 void saveFAQSetting(FAQSetting faqSetting, java.lang.String userName)
           
 javax.jcr.Node saveQuestion(Question question, boolean isAddNew, FAQSetting faqSetting)
           
 void saveTemplate(java.lang.String str)
           
 void saveTopicIdDiscussQuestion(java.lang.String questionId, java.lang.String topicId)
           
 void saveUserAvatar(java.lang.String userId, FileAttachment fileAttachment)
           
 void sendMessage(org.exoplatform.services.mail.Message message)
           
 void setDefaultAvatar(java.lang.String userName)
           
 void setEmailDefault(java.lang.String emailDefault)
           
 void swapCategories(java.lang.String cateId1, java.lang.String cateId2)
           
 void unWatchCategory(java.lang.String categoryId, java.lang.String user)
           
 void unWatchQuestion(java.lang.String questionId, java.lang.String user)
           
 void updateQuestionRelatives(java.lang.String questionPath, java.lang.String[] relatives)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCRDataStorage

public JCRDataStorage(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator,
                      org.exoplatform.services.jcr.RepositoryService rService)
               throws java.lang.Exception
Throws:
java.lang.Exception

JCRDataStorage

public JCRDataStorage()
Method Detail

setEmailDefault

public void setEmailDefault(java.lang.String emailDefault)

addPlugin

public void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
               throws java.lang.Exception
Throws:
java.lang.Exception

addRolePlugin

public void addRolePlugin(org.exoplatform.container.component.ComponentPlugin plugin)
                   throws java.lang.Exception
Throws:
java.lang.Exception

addInitRssPlugin

public void addInitRssPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
                      throws java.lang.Exception
Throws:
java.lang.Exception

isAdminRole

public boolean isAdminRole(java.lang.String userName)
                    throws java.lang.Exception
Throws:
java.lang.Exception

getAllFAQAdmin

public java.util.List<java.lang.String> getAllFAQAdmin()
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getUserSetting

public void getUserSetting(java.lang.String userName,
                           FAQSetting faqSetting)
                    throws java.lang.Exception
Throws:
java.lang.Exception

saveFAQSetting

public void saveFAQSetting(FAQSetting faqSetting,
                           java.lang.String userName)
                    throws java.lang.Exception
Throws:
java.lang.Exception

getUserAvatar

public FileAttachment getUserAvatar(java.lang.String userName)
                             throws java.lang.Exception
Throws:
java.lang.Exception

saveUserAvatar

public void saveUserAvatar(java.lang.String userId,
                           FileAttachment fileAttachment)
                    throws java.lang.Exception
Throws:
java.lang.Exception

setDefaultAvatar

public void setDefaultAvatar(java.lang.String userName)
                      throws java.lang.Exception
Throws:
java.lang.Exception

getFAQServiceHome

protected javax.jcr.Node getFAQServiceHome(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

getQuestionsIterator

public javax.jcr.NodeIterator getQuestionsIterator()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

addRSSListener

protected void addRSSListener(javax.jcr.Node node)
                       throws java.lang.Exception
Throws:
java.lang.Exception

reInitRSSEvenListener

public void reInitRSSEvenListener()
                           throws java.lang.Exception
Throws:
java.lang.Exception

initRootCategory

public boolean initRootCategory()
                         throws java.lang.Exception
Throws:
java.lang.Exception

getTemplate

public byte[] getTemplate()
                   throws java.lang.Exception
Throws:
java.lang.Exception

saveTemplate

public void saveTemplate(java.lang.String str)
                  throws java.lang.Exception
Throws:
java.lang.Exception

booleanToValues

protected javax.jcr.Value[] booleanToValues(javax.jcr.Node node,
                                            java.lang.Boolean[] bools)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

sendMessage

public void sendMessage(org.exoplatform.services.mail.Message message)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getQuestionLanguages

public java.util.List<QuestionLanguage> getQuestionLanguages(java.lang.String questionId)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

deleteAnswer

public void deleteAnswer(java.lang.String questionId,
                         java.lang.String answerId)
                  throws java.lang.Exception
Throws:
java.lang.Exception

deleteComment

public void deleteComment(java.lang.String questionId,
                          java.lang.String commentId)
                   throws java.lang.Exception
Throws:
java.lang.Exception

getPageListAnswer

public JCRPageList getPageListAnswer(java.lang.String questionId,
                                     java.lang.Boolean isSortByVote)
                              throws java.lang.Exception
Throws:
java.lang.Exception

saveAnswer

public void saveAnswer(java.lang.String questionId,
                       Answer answer,
                       boolean isNew)
                throws java.lang.Exception
Throws:
java.lang.Exception

saveAnswer

public void saveAnswer(java.lang.String questionId,
                       Answer[] answers)
                throws java.lang.Exception
Throws:
java.lang.Exception

saveComment

public void saveComment(java.lang.String questionId,
                        Comment comment,
                        boolean isNew)
                 throws java.lang.Exception
Throws:
java.lang.Exception

saveAnswerQuestionLang

public void saveAnswerQuestionLang(java.lang.String questionId,
                                   Answer answer,
                                   java.lang.String language,
                                   boolean isNew)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getAnswerById

public Answer getAnswerById(java.lang.String questionId,
                            java.lang.String answerid)
                     throws java.lang.Exception
Throws:
java.lang.Exception

getPageListComment

public JCRPageList getPageListComment(java.lang.String questionId)
                               throws java.lang.Exception
Throws:
java.lang.Exception

getCommentById

public Comment getCommentById(java.lang.String questionId,
                              java.lang.String commentId)
                       throws java.lang.Exception
Throws:
java.lang.Exception

saveQuestion

public javax.jcr.Node saveQuestion(Question question,
                                   boolean isAddNew,
                                   FAQSetting faqSetting)
                            throws java.lang.Exception
Throws:
java.lang.Exception

removeQuestion

public void removeQuestion(java.lang.String questionId)
                    throws java.lang.Exception
Throws:
java.lang.Exception

getCommentById

public Comment getCommentById(javax.jcr.Node questionNode,
                              java.lang.String commentId)
                       throws java.lang.Exception
Throws:
java.lang.Exception

getQuestionById

public Question getQuestionById(java.lang.String questionId)
                         throws java.lang.Exception
Throws:
java.lang.Exception

getAllQuestions

public QuestionPageList getAllQuestions()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

getQuestionsNotYetAnswer

public QuestionPageList getQuestionsNotYetAnswer(java.lang.String categoryId,
                                                 boolean isApproved)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

getPendingQuestionsByCategory

public QuestionPageList getPendingQuestionsByCategory(java.lang.String categoryId,
                                                      FAQSetting faqSetting)
                                               throws java.lang.Exception
Throws:
java.lang.Exception

getQuestionsByCatetory

public QuestionPageList getQuestionsByCatetory(java.lang.String categoryId,
                                               FAQSetting faqSetting)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

getAllQuestionsByCatetory

public QuestionPageList getAllQuestionsByCatetory(java.lang.String categoryId,
                                                  FAQSetting faqSetting)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

getQuestionsByListCatetory

public QuestionPageList getQuestionsByListCatetory(java.util.List<java.lang.String> listCategoryId,
                                                   boolean isNotYetAnswer)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

getQuickQuestionsByListCatetory

public java.util.List<Question> getQuickQuestionsByListCatetory(java.util.List<java.lang.String> listCategoryId,
                                                                boolean isNotYetAnswer)
                                                         throws java.lang.Exception
Throws:
java.lang.Exception

getCategoryPathOfQuestion

public java.lang.String getCategoryPathOfQuestion(java.lang.String questionPath)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

moveQuestions

public void moveQuestions(java.util.List<java.lang.String> questions,
                          java.lang.String destCategoryId,
                          java.lang.String questionLink,
                          FAQSetting faqSetting)
                   throws java.lang.Exception
Throws:
java.lang.Exception

changeStatusCategoryView

public void changeStatusCategoryView(java.util.List<java.lang.String> listCateIds)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getMaxindexCategory

public long getMaxindexCategory(java.lang.String parentId)
                         throws java.lang.Exception
Throws:
java.lang.Exception

saveCategory

public void saveCategory(java.lang.String parentId,
                         Category cat,
                         boolean isAddNew)
                  throws java.lang.Exception
Throws:
java.lang.Exception

listingCategoryTree

public java.util.List<Cate> listingCategoryTree()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

removeCategory

public void removeCategory(java.lang.String categoryId)
                    throws java.lang.Exception
Throws:
java.lang.Exception

getCategoryById

public Category getCategoryById(java.lang.String categoryId)
                         throws java.lang.Exception
Parameters:
categoryId - the path of the category starting from home. It should be in the form of "categories/CategoryXXX/CategoryXXX"
Returns:
Throws:
java.lang.Exception

findCategoriesByName

public java.util.List<Category> findCategoriesByName(java.lang.String categoryName)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

getListCateIdByModerator

public java.util.List<java.lang.String> getListCateIdByModerator(java.lang.String user)
                                                          throws java.lang.Exception
Throws:
java.lang.Exception

getAllCategories

public java.util.List<Category> getAllCategories()
                                          throws java.lang.Exception
Throws:
java.lang.Exception

existingCategories

public long existingCategories()
                        throws java.lang.Exception
Throws:
java.lang.Exception

getCategoryNodeById

public javax.jcr.Node getCategoryNodeById(java.lang.String categoryId)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

getSubCategories

public java.util.List<Category> getSubCategories(java.lang.String categoryId,
                                                 FAQSetting faqSetting,
                                                 boolean isGetAll,
                                                 java.util.List<java.lang.String> limitedUsers)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

getCategoryInfo

public long[] getCategoryInfo(java.lang.String categoryId,
                              FAQSetting faqSetting)
                       throws java.lang.Exception
Throws:
java.lang.Exception

moveCategory

public void moveCategory(java.lang.String categoryId,
                         java.lang.String destCategoryId)
                  throws java.lang.Exception
Throws:
java.lang.Exception

addWatchCategory

public void addWatchCategory(java.lang.String id,
                             Watch watch)
                      throws java.lang.Exception
Throws:
java.lang.Exception

getListMailInWatch

public QuestionPageList getListMailInWatch(java.lang.String categoryId)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

getWatchByCategory

public java.util.List<Watch> getWatchByCategory(java.lang.String categoryId)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

hasWatch

public boolean hasWatch(java.lang.String categoryPath)

addWatchQuestion

public void addWatchQuestion(java.lang.String questionId,
                             Watch watch,
                             boolean isNew)
                      throws java.lang.Exception
Throws:
java.lang.Exception

getWatchByQuestion

public java.util.List<Watch> getWatchByQuestion(java.lang.String questionId)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

getWatchedCategoryByUser

public QuestionPageList getWatchedCategoryByUser(java.lang.String userId)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

isUserWatched

public boolean isUserWatched(java.lang.String userId,
                             java.lang.String cateId)

getWatchedSubCategory

public java.util.List<java.lang.String> getWatchedSubCategory(java.lang.String userId,
                                                              java.lang.String cateId)
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

getListQuestionsWatch

public QuestionPageList getListQuestionsWatch(FAQSetting faqSetting,
                                              java.lang.String currentUser)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

deleteCategoryWatch

public void deleteCategoryWatch(java.lang.String categoryId,
                                java.lang.String user)
                         throws java.lang.Exception
Throws:
java.lang.Exception

unWatchCategory

public void unWatchCategory(java.lang.String categoryId,
                            java.lang.String user)
                     throws java.lang.Exception
Throws:
java.lang.Exception

unWatchQuestion

public void unWatchQuestion(java.lang.String questionId,
                            java.lang.String user)
                     throws java.lang.Exception
Throws:
java.lang.Exception

getSearchResults

public java.util.List<ObjectSearchResult> getSearchResults(FAQEventQuery eventQuery)
                                                    throws java.lang.Exception
Throws:
java.lang.Exception

getCategoryPath

public java.util.List<java.lang.String> getCategoryPath(java.lang.String categoryId)
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

getParentCategoriesName

public java.lang.String getParentCategoriesName(java.lang.String path)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

getMessageInfo

public NotifyInfo getMessageInfo(java.lang.String name)
                          throws java.lang.Exception
Throws:
java.lang.Exception

swapCategories

public void swapCategories(java.lang.String cateId1,
                           java.lang.String cateId2)
                    throws java.lang.Exception
Throws:
java.lang.Exception

saveTopicIdDiscussQuestion

public void saveTopicIdDiscussQuestion(java.lang.String questionId,
                                       java.lang.String topicId)
                                throws java.lang.Exception
Throws:
java.lang.Exception

exportData

public java.io.InputStream exportData(java.lang.String categoryId,
                                      boolean createZipFile)
                               throws java.lang.Exception
Throws:
java.lang.Exception

importData

public boolean importData(java.lang.String parentId,
                          java.io.InputStream inputStream,
                          boolean isZip)
                   throws java.lang.Exception
Throws:
java.lang.Exception

isExisting

public boolean isExisting(java.lang.String path)

getCategoryPathOf

public java.lang.String getCategoryPathOf(java.lang.String id)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

isModerateAnswer

public boolean isModerateAnswer(java.lang.String id)
                         throws java.lang.Exception
Throws:
java.lang.Exception

isModerateQuestion

public boolean isModerateQuestion(java.lang.String id)
                           throws java.lang.Exception
Throws:
java.lang.Exception

isViewAuthorInfo

public boolean isViewAuthorInfo(java.lang.String id)
                         throws java.lang.Exception
Throws:
java.lang.Exception

isCategoryModerator

public boolean isCategoryModerator(java.lang.String categoryPath,
                                   java.lang.String user)
                            throws java.lang.Exception
Throws:
java.lang.Exception

isCategoryExist

public boolean isCategoryExist(java.lang.String name,
                               java.lang.String path)

getQuestionContents

public java.util.List<java.lang.String> getQuestionContents(java.util.List<java.lang.String> paths)
                                                     throws java.lang.Exception
Throws:
java.lang.Exception

getQuestionNodeById

public javax.jcr.Node getQuestionNodeById(java.lang.String path)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

getModeratorsOf

public java.lang.String[] getModeratorsOf(java.lang.String path)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

getCategoryNameOf

public java.lang.String getCategoryNameOf(java.lang.String categoryPath)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

getCategoryInfo

public CategoryInfo getCategoryInfo(java.lang.String categoryPath,
                                    java.util.List<java.lang.String> categoryIdScoped)
                             throws java.lang.Exception
Throws:
java.lang.Exception

updateQuestionRelatives

public void updateQuestionRelatives(java.lang.String questionPath,
                                    java.lang.String[] relatives)
                             throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2011 eXo Platform SAS. All Rights Reserved.