Class QuestionRepository

java.lang.Object
org.silverpeas.core.persistence.datasource.repository.jpa.AbstractJpaEntityRepository<Question>
org.silverpeas.core.persistence.datasource.repository.jpa.BasicJpaEntityRepository<Question>
org.silverpeas.components.questionreply.repository.QuestionRepository
All Implemented Interfaces:
org.silverpeas.core.persistence.datasource.repository.EntityRepository<Question>, org.silverpeas.core.persistence.datasource.repository.WithSaveAndFlush<Question>

@Repository public class QuestionRepository extends org.silverpeas.core.persistence.datasource.repository.jpa.BasicJpaEntityRepository<Question>
Repository of the questions asked in the FAQs. Any access to the questions is done within a given FAQ, except for finding out the FAQ of a question.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Finds the questions of the given FAQ that aren't closed or that have at least one public reply, the more recent first.
    findReceivedBy(String userId, String instanceId)
    Finds the questions of the given FAQ addressed to the specified user and that aren't closed.
    findSentBy(String userId, String instanceId)
    Finds the questions asked by the specified user in the given FAQ that aren't closed or that have at least one private reply.
    Finds the questions of the given FAQ having at least one public reply.
    getById(long questionId, String instanceId)
    Gets the specified question of the given FAQ.
    getById(Collection<Integer> questionIds, String instanceId)
    Gets the specified questions of the given FAQ.
    getInstanceIdOf(long questionId)
    Gets the unique identifier of the FAQ in which is asked the specified question.

    Methods inherited from class org.silverpeas.core.persistence.datasource.repository.jpa.BasicJpaEntityRepository

    deleteByComponentInstanceId, saveAndFlush

    Methods inherited from class org.silverpeas.core.persistence.datasource.repository.jpa.AbstractJpaEntityRepository

    contains, countByCriteria, countFromJpqlString, delete, deleteById, deleteFromJpqlQuery, deleteFromNamedQuery, findByCriteria, findByNamedQuery, findFirstByNamedQuery, flush, getAll, getById, getById, getEntityClass, getEntityManager, getFromJpqlString, getFromJpqlString, getFromNamedQuery, getFromNamedQuery, getIdentifierConverter, getMaximumItemsInClause, listFromJpqlString, listFromJpqlString, listFromJpqlString, listFromJpqlString, listFromNamedQuery, listFromNamedQuery, newNamedParameters, noParameter, save, setMaximumItemsInClause, split, streamByNamedQuery, streamByNamedQuery, streamFromJpqlString, streamFromJpqlString, updateFromJpqlQuery, updateFromNamedQuery

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.silverpeas.core.persistence.datasource.repository.EntityRepository

    delete, deleteById, getById, save, save
  • Constructor Details

    • QuestionRepository

      public QuestionRepository()
  • Method Details

    • getInstanceIdOf

      public Optional<String> getInstanceIdOf(long questionId)
      Gets the unique identifier of the FAQ in which is asked the specified question.
      Parameters:
      questionId - the unique identifier of a question.
      Returns:
      the unique identifier of the FAQ or nothing if there is no such question.
    • getById

      public Question getById(long questionId, String instanceId)
      Gets the specified question of the given FAQ.
      Parameters:
      questionId - the unique identifier of the question.
      instanceId - the unique identifier of the FAQ.
      Returns:
      the question or null if the FAQ has no such question.
    • getById

      public List<Question> getById(Collection<Integer> questionIds, String instanceId)
      Gets the specified questions of the given FAQ. The questions of other FAQs are ignored.
      Parameters:
      questionIds - the unique identifiers of the questions.
      instanceId - the unique identifier of the FAQ.
      Returns:
      the questions of the FAQ among the specified ones.
    • findNotClosedOrWithPublicReplies

      public List<Question> findNotClosedOrWithPublicReplies(String instanceId)
      Finds the questions of the given FAQ that aren't closed or that have at least one public reply, the more recent first.
      Parameters:
      instanceId - the unique identifier of the FAQ.
      Returns:
      the questions found.
    • findWithPublicReplies

      public List<Question> findWithPublicReplies(String instanceId)
      Finds the questions of the given FAQ having at least one public reply.
      Parameters:
      instanceId - the unique identifier of the FAQ.
      Returns:
      the questions found.
    • findSentBy

      public List<Question> findSentBy(String userId, String instanceId)
      Finds the questions asked by the specified user in the given FAQ that aren't closed or that have at least one private reply.
      Parameters:
      userId - the unique identifier of the user.
      instanceId - the unique identifier of the FAQ.
      Returns:
      the questions found.
    • findReceivedBy

      public List<Question> findReceivedBy(String userId, String instanceId)
      Finds the questions of the given FAQ addressed to the specified user and that aren't closed.
      Parameters:
      userId - the unique identifier of the user.
      instanceId - the unique identifier of the FAQ.
      Returns:
      the questions found.