Class ResultDAO

java.lang.Object
com.ubs.backend.classes.database.dao.DAO<Result>
com.ubs.backend.classes.database.dao.ResultDAO

public class ResultDAO extends DAO<Result>
DAO for com.ubs.backend.classes.database.Result
Since:
17.07.2021
Author:
Marc, Magnus, Tim Irmler
  • Constructor Details

    • ResultDAO

      public ResultDAO()
  • Method Details

    • selectByAnswer

      public List<Result> selectByAnswer(long id, int max, javax.persistence.EntityManager em)
      Select by answer list.
      Parameters:
      id - the id
      max - the max
      em - the em
      Returns:
      list
      Since:
      17.07.2021
    • selectByAnswer

      public List<Result> selectByAnswer(long id, javax.persistence.EntityManager em)
      Select by answer list.
      Parameters:
      id - the id
      em - the em
      Returns:
      list
      Since:
      17.07.2021
    • selectByAnswer

      public List<Result> selectByAnswer(long id)
      Select by answer list.
      Parameters:
      id - the id
      Returns:
      list
      Since:
      17.07.2021
    • selectByType

      public List<Result> selectByType(AnswerType type, javax.persistence.EntityManager em)
      Select by type list.
      Parameters:
      type - the type
      em - the em
      Returns:
      list
      Since:
      17.07.2021
    • selectByAnswerAndType

      public List<Result> selectByAnswerAndType(long id, AnswerType type, javax.persistence.EntityManager em)
      selects all result sets that have the specified answer, with the specified type
      Parameters:
      id - the id of the answer
      type - the answer type
      em - the entity manager
      Returns:
      all result sets that have the specified answer with the specified type
      Since:
      17.07.2021
    • selectByTagAndAnswer

      public Result selectByTagAndAnswer(long answerId, long tagId, javax.persistence.EntityManager em)
      selects a single result, that has the specified answer and tag
      Parameters:
      answerId - the id of the answer
      tagId - the id of the tag
      em - the entity manager
      Returns:
      selects a single result, that has the specified answer and tag
      Since:
      17.07.2021
    • selectByTagAndType

      public List<Result> selectByTagAndType(long tagId, AnswerType type, javax.persistence.EntityManager em)
    • selectByTag

      public List<Result> selectByTag(long id, javax.persistence.EntityManager em)
      get all results that have the specified tag
      Parameters:
      id - the id of the tag
      em - the entity manager
      Returns:
      all results that have the specified tag
      Since:
      17.07.2021
    • selectByTag

      public List<Result> selectByTag(long id)
      Parameters:
      id -
      Returns:
      Since:
      17.07.2021
    • view

      public void view(ResultParent result)
      Adds a usage to a Result
      Parameters:
      result - the result which should receive a usage
      Since:
      17.07.2021
    • removeByAnswer

      public void removeByAnswer(long id)
      Parameters:
      id -
      Since:
      17.07.2021
    • removeByAnswer

      public void removeByAnswer(long id, javax.persistence.EntityManager em)
      removes all results with specified answer
      Parameters:
      id - the id of the answer
      em - the EntityManager
      Since:
      17.07.2021
    • removeTagFromAnswer

      public void removeTagFromAnswer(long answerID, long tagID)
      Removes a tag from an answer
      Parameters:
      answerID - the ID of the answer
      tagID - the ID of the tag
      Since:
      17.07.2021
    • removeTagFromAnswer

      public void removeTagFromAnswer(long answerID, long tagID, javax.persistence.EntityManager em)
      removes result set that has the specified answer and tag
      Parameters:
      answerID - the id of the answer
      tagID - the id of the tag
      em - the entity manager
      Since:
      17.07.2021
    • removeTag

      public void removeTag(long id, javax.persistence.EntityManager em)
      Parameters:
      id -
      em -
      Since:
      19.07.2021
    • vote

      public void vote(long answerID, Long tagID, boolean isUpvote, boolean revert, String question, javax.persistence.EntityManager em)
      Votes a Result
      Parameters:
      answerID - the ID of the Answer
      tagID - the ID of the Tag
      isUpvote - if the vote is positive
      Since:
      17.07.2021