Class RatingQuestionsAndAnswersProcess

java.lang.Object
com.skava.ratingandreviews.process.RatingQuestionsAndAnswersProcess

@Component public class RatingQuestionsAndAnswersProcess extends Object

Class RatingQuestionsAndAnswersProcess

this class provides the process of the Question and Answer

Author:
Infosys Equinox
  • Field Details

  • Constructor Details

  • 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

      public List<GetAnswersResponse> getAnswersByQuestionId(long questionId)
      Gets the answers by question id.
      Parameters:
      questionId - the question id
      Returns:
      the answers by question id
    • getAllAnswersByQuestionId

      public RatingAnswersResponse getAllAnswersByQuestionId(RatingsReviewsQAInfoDataRequest input)
      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 call
      page - the page number
      size - 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 call
      page - the page number
      size - the size of one page
      Returns:
      the page
    • deleteByIdQuestion

      public GetByIdQuestionAndAnswersResponse deleteByIdQuestion(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.
      Parameters:
      id - Holds the Identifier for the Question.
      collectionId - Holds the Idetifier of the collectiion for Question.
    • getVotesCountById

      public GetVotesResponse getVotesCountById(VotesRequest input)
      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

      public String 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