Class RatingQuestionsAndAnswersProcess
java.lang.Object
com.skava.ratingandreviews.process.RatingQuestionsAndAnswersProcess
Class RatingQuestionsAndAnswersProcess
this class provides the process of the Question and Answer
- Author:
- Infosys Equinox
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRatingQuestionsAndAnswersProcess
(RatingQuestionsAndAnswersFactory ratingQuestionsAndAnswersFactory, RatingQuestionsRepository ratingQuestionsRepository, RatingAnswersRepository ratingAnswersRepository, RatingsReviewsRepository ratingsReviewsRepository, CollectionProcess collectionProcess, RatingVotesRepository ratingVotesRepository, com.skava.core.auth.AuthTokenHandler authTokenHandler) -
Method Summary
Modifier and TypeMethodDescriptioncreateRatingQuestionAndAnswers
(RatingQuestionsAnswersDomain ratingQuestionsAnswersDomain) method createRatingQuestionAndAnswers This method is used to create getQuestionsAndAnswers with the help of the createRatingQuestionAndAnswersdeleteByIdQuestion
(long id, long collectionId) method deleteByIdQuestion This method is used to delete the Question with the help of QuestionId and CollectionId passed to it as argument.Gets the answers by question id.method getAllQuestions - This method is used to create get Questions And Answers with the help of the itemIdgetAnswersByQuestionId
(long questionId) Gets the answers by question id.method getQuestionsAndAnswerById This method is used to create getQuestionsAndAnswerById with the help of the questionIdGetUserId MethodgetVotesCountById
(VotesRequest input) method getVotesCountByIdQuestion This method is used to find the likes with the help of answerId passed to it as argument.org.springframework.data.domain.Page<RatingQuestionsEntity>
method Search.org.springframework.data.domain.Page<RatingAnswersEntity>
searchAnswers
(String filters, org.springframework.data.domain.Sort sort, int page, int size) method Search.method updateAnswer This method is used to update the status of answer.method updateQuestion This method is used to update the status of question.
-
Field Details
-
PAGE_CONSTANT
public static final int PAGE_CONSTANTpage_constant- See Also:
-
-
Constructor Details
-
RatingQuestionsAndAnswersProcess
@Autowired public RatingQuestionsAndAnswersProcess(RatingQuestionsAndAnswersFactory ratingQuestionsAndAnswersFactory, RatingQuestionsRepository ratingQuestionsRepository, RatingAnswersRepository ratingAnswersRepository, RatingsReviewsRepository ratingsReviewsRepository, CollectionProcess collectionProcess, RatingVotesRepository ratingVotesRepository, com.skava.core.auth.AuthTokenHandler authTokenHandler)
-
-
Method Details
-
createRatingQuestionAndAnswers
public RatingQuestionsAnswersDomain createRatingQuestionAndAnswers(RatingQuestionsAnswersDomain ratingQuestionsAnswersDomain) method createRatingQuestionAndAnswers This method is used to create getQuestionsAndAnswers with the help of the createRatingQuestionAndAnswers- Parameters:
ratingQuestionsAnswersDomain
- - Holds the value of ratingQuestionsAnswersDomain.- Returns:
- ratingQADomainResponse - The create question and answers is returned in the type of ratingQADomainResponse.
-
updateQuestion
method updateQuestion This method is used to update the status of question. updates the status as APPROVED, PENDING, REJECTED.- Parameters:
request
- - This holds the value of RatingsReviewsQAInfoDataRequest.- Returns:
- ratingQuestionsDo The updated question is returned in the type of ratingQuestionsDo.
-
updateAnswer
method updateAnswer This method is used to update the status of answer. updates the status as APPROVED, PENDING, REJECTED.- Parameters:
request
- - Holds the value of RatingsReviewsQAInfoDataRequest.- Returns:
- ratingAnswersDo The updated question is returned in the type of ratingAnswersDo.
-
getQuestionsAndAnswerById
public GetByIdQuestionAndAnswersResponse getQuestionsAndAnswerById(RatingsReviewsQAInfoDataRequest request) method getQuestionsAndAnswerById This method is used to create getQuestionsAndAnswerById with the help of the questionId- Parameters:
request
- Holds the request for which getQuestionsAndAnswerById is Created.- Returns:
- questionAndAnswersResponse The get question and answers is returned in the type of questionAndAnswersResponse.
-
getAnswersByQuestionId
Gets the answers by question id.- Parameters:
questionId
- the question id- Returns:
- the answers by question id
-
getAllAnswersByQuestionId
Gets the answers by question id.- Parameters:
questionId
- the question id- Returns:
- the answers by question id
-
getAllQuestions
method getAllQuestions - This method is used to create get Questions And Answers with the help of the itemId- Parameters:
request
- Holds the request for which getQuestionsAndAnswers is Created.- Returns:
- ratingQuestionsAnswersResponse The get question and answers is returned in the type of questionsAnswersResponse.
-
search
public org.springframework.data.domain.Page<RatingQuestionsEntity> search(String filters, int page, int size) method Search.- Parameters:
filters
- the filters for search callpage
- the page numbersize
- the size of one page- Returns:
- the page
-
searchAnswers
public org.springframework.data.domain.Page<RatingAnswersEntity> searchAnswers(String filters, org.springframework.data.domain.Sort sort, int page, int size) method Search.- Parameters:
filters
- the filters for search callpage
- the page numbersize
- the size of one page- Returns:
- the page
-
deleteByIdQuestion
method deleteByIdQuestion This method is used to delete the Question with the help of QuestionId and CollectionId passed to it as argument.- Parameters:
id
- Holds the Identifier for the Question.collectionId
- Holds the Idetifier of the collectiion for Question.
-
getVotesCountById
method getVotesCountByIdQuestion This method is used to find the likes with the help of answerId passed to it as argument.- Parameters:
input
- Holds the Identifier for the Answer.- Returns:
- GetVotesResponse - Holds the GetVotesResponse
-
getUserId
GetUserId Method
This method used to get the userId based on the role or privileges If logged user check it is empty to set userId other wise throw exception.
- Returns:
- the user id
-