Class 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 -
Method Summary
Modifier and TypeMethodDescriptionfindNotClosedOrWithPublicReplies(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.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.findWithPublicReplies(String instanceId) Finds the questions of the given FAQ having at least one public reply.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, saveAndFlushMethods 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, updateFromNamedQueryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.silverpeas.core.persistence.datasource.repository.EntityRepository
delete, deleteById, getById, save, save
-
Constructor Details
-
QuestionRepository
public QuestionRepository()
-
-
Method Details
-
getInstanceIdOf
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
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
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
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
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
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
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.
-