Package org.dspace.qaevent.service.impl
Class QAEventServiceImpl
java.lang.Object
org.dspace.qaevent.service.impl.QAEventServiceImpl
- All Implemented Interfaces:
QAEventService
Implementation of
QAEventService that use Solr to store events. When
the user performs an action on the event (such as accepting the suggestion or
rejecting it) then the event is removed from solr and saved in the database
(see QAEventsDAO) so that it is no longer proposed.- Author:
- Andrea Bollini (andrea.bollini at 4science.it)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConfigurationServicestatic final Stringprotected ItemServicestatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected QAEventSecurityServicestatic final Stringstatic final Stringprotected org.apache.solr.client.solrj.SolrClientNon-Static CommonsHttpSolrServer for processing indexing events.static final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcountEventsByTopic(Context context, String sourceName, String topic) Find all the events by topic.longcountEventsByTopicAndTarget(Context context, String sourceName, String topic, UUID target) Count the QA events related to the specified topic and targetlongcountSources(Context context) Count all the event's sources.longcountSourcesByTarget(Context context, UUID target) Count all the event's sources related to a specific itemlongCount all the event's topics.longcountTopicsBySource(Context context, String sourceName) Count all the event's topics related to the given source.longcountTopicsBySourceAndTarget(Context context, String source, UUID target) Count all the event's topics related to the given source referring to a specific itemvoidDelete an event by the given id.voiddeleteEventsByTargetId(UUID targetId) Delete events by the given target id.findAllSources(Context context, long offset, int pageSize) Find all the event's sources.findAllSourcesByTarget(Context context, UUID target, long offset, int pageSize) Find all the event's sources related to a specific itemfindAllTopics(Context context, long offset, long count, String orderField, boolean ascending) Find all the event's topics.findAllTopicsBySource(Context context, String source, long offset, long count, String orderField, boolean ascending) Find all the event's topics related to the given source.findAllTopicsBySourceAndTarget(Context context, String source, UUID target, long offset, long pageSize, String orderField, boolean ascending) Find all the event's topics related to the given source for a specific itemfindEventByEventId(String eventId) Find an event by the given id.findEventsByTopic(Context context, String sourceName, String topic, long offset, int pageSize, String orderField, boolean ascending) Find all the events by topic.findEventsByTopicAndTarget(Context context, String source, String topic, UUID target, long offset, int pageSize) Find a list of QA events according to the pagination parameters for the specified topic and target sorted by trust descendingfindSource(Context context, String sourceName) Find a specific source by the given name.findSource(Context context, String sourceName, UUID target) Find a specific source by the given name including the stats focused on the target item.findTopicBySourceAndNameAndTarget(Context context, String sourceName, String topicName, UUID target) Find a specific topic by its name, source and optionally a target.findTopicByTopicId(String topicId) Find a specific topid by the given id.protected org.apache.solr.client.solrj.SolrClientgetSolr()booleanisRelatedItemSupported(QAEvent qaevent) Check if the given QA event supports a related item.booleanqaEventsInSource(Context context, EPerson user, String eventId, String source) Check if a qaevent with the provided id is visible to the current user according to the source securityvoidsentEmailToAdminAboutNewRequest(QAEvent qaEvent) Sends an email notification to the system administrator about a new Quality Assurance (QA) request event.voidStore the given event.
-
Field Details
-
QAEVENTS_SOURCES
- See Also:
-
configurationService
-
qaSecurityService
-
itemService
-
solr
protected org.apache.solr.client.solrj.SolrClient solrNon-Static CommonsHttpSolrServer for processing indexing events. -
SOURCE
- See Also:
-
ORIGINAL_ID
- See Also:
-
TITLE
- See Also:
-
TOPIC
- See Also:
-
TRUST
- See Also:
-
MESSAGE
- See Also:
-
EVENT_ID
- See Also:
-
RESOURCE_UUID
- See Also:
-
LAST_UPDATE
- See Also:
-
RELATED_UUID
- See Also:
-
-
Constructor Details
-
QAEventServiceImpl
public QAEventServiceImpl()
-
-
Method Details
-
getSolr
protected org.apache.solr.client.solrj.SolrClient getSolr() -
countTopics
public long countTopics()Description copied from interface:QAEventServiceCount all the event's topics.- Specified by:
countTopicsin interfaceQAEventService- Returns:
- the count result
-
countTopicsBySource
Description copied from interface:QAEventServiceCount all the event's topics related to the given source.- Specified by:
countTopicsBySourcein interfaceQAEventService- Parameters:
context- the DSpace contextsourceName- the source to search for- Returns:
- the count result
-
findTopicBySourceAndNameAndTarget
public QATopic findTopicBySourceAndNameAndTarget(Context context, String sourceName, String topicName, UUID target) Description copied from interface:QAEventServiceFind a specific topic by its name, source and optionally a target.- Specified by:
findTopicBySourceAndNameAndTargetin interfaceQAEventService- Parameters:
context- the DSpace contextsourceName- the name of the sourcetopicName- the topic name to search fortarget- (nullable) the uuid of the target to focus on- Returns:
- the topic
-
deleteEventByEventId
Description copied from interface:QAEventServiceDelete an event by the given id.- Specified by:
deleteEventByEventIdin interfaceQAEventService- Parameters:
id- the id of the event to delete
-
deleteEventsByTargetId
Description copied from interface:QAEventServiceDelete events by the given target id.- Specified by:
deleteEventsByTargetIdin interfaceQAEventService- Parameters:
targetId- the id of the target id
-
findTopicByTopicId
Description copied from interface:QAEventServiceFind a specific topid by the given id.- Specified by:
findTopicByTopicIdin interfaceQAEventService- Parameters:
topicId- the topic id to search for- Returns:
- the topic
-
findAllTopics
public List<QATopic> findAllTopics(Context context, long offset, long count, String orderField, boolean ascending) Description copied from interface:QAEventServiceFind all the event's topics.- Specified by:
findAllTopicsin interfaceQAEventService- Parameters:
context- the DSpace contextoffset- the offset to applyorderField- the field to order forascending- true if the order should be ascending, false otherwise- Returns:
- the topics list
-
findAllTopicsBySource
public List<QATopic> findAllTopicsBySource(Context context, String source, long offset, long count, String orderField, boolean ascending) Description copied from interface:QAEventServiceFind all the event's topics related to the given source.- Specified by:
findAllTopicsBySourcein interfaceQAEventService- Parameters:
context- the DSpace contextsource- the source to search foroffset- the offset to applycount- the page sizeorderField- the field to order forascending- true if the order should be ascending, false otherwise- Returns:
- the topics list
-
findAllTopicsBySourceAndTarget
public List<QATopic> findAllTopicsBySourceAndTarget(Context context, String source, UUID target, long offset, long pageSize, String orderField, boolean ascending) Description copied from interface:QAEventServiceFind all the event's topics related to the given source for a specific item- Specified by:
findAllTopicsBySourceAndTargetin interfaceQAEventService- Parameters:
context- the DSpace contextsource- (not null) the source to search fortarget- the item referring tooffset- the offset to applypageSize- the page size- Returns:
- the topics list
-
store
Description copied from interface:QAEventServiceStore the given event.- Specified by:
storein interfaceQAEventService- Parameters:
context- the DSpace contextdto- the event to store
-
sentEmailToAdminAboutNewRequest
Sends an email notification to the system administrator about a new Quality Assurance (QA) request event. The email includes details such as the topic, target, and message associated with the QA event.- Parameters:
qaEvent- The Quality Assurance event for which the notification is generated.
-
findEventByEventId
Description copied from interface:QAEventServiceFind an event by the given id. Please note that no security filter are applied by this method.- Specified by:
findEventByEventIdin interfaceQAEventService- Parameters:
eventId- the id of the event to search for- Returns:
- the event
-
findEventsByTopic
public List<QAEvent> findEventsByTopic(Context context, String sourceName, String topic, long offset, int pageSize, String orderField, boolean ascending) Description copied from interface:QAEventServiceFind all the events by topic.- Specified by:
findEventsByTopicin interfaceQAEventService- Parameters:
context- the DSpace contextsourceName- the source nametopic- the topic to search foroffset- the offset to applypageSize- the page sizeorderField- the field to order forascending- true if the order should be ascending, false otherwise- Returns:
- the events
-
countEventsByTopic
Description copied from interface:QAEventServiceFind all the events by topic.- Specified by:
countEventsByTopicin interfaceQAEventService- Parameters:
context- the DSpace contextsourceName- the source nametopic- the topic to search for- Returns:
- the events count
-
findSource
Description copied from interface:QAEventServiceFind a specific source by the given name.- Specified by:
findSourcein interfaceQAEventService- Parameters:
context- the DSpace contextsourceName- the source name- Returns:
- the source
-
findSource
Description copied from interface:QAEventServiceFind a specific source by the given name including the stats focused on the target item.- Specified by:
findSourcein interfaceQAEventService- Parameters:
context- the DSpace contextsourceName- the source nametarget- the uuid of the item target- Returns:
- the source
-
findAllSources
Description copied from interface:QAEventServiceFind all the event's sources.- Specified by:
findAllSourcesin interfaceQAEventService- Parameters:
context- the DSpace contextoffset- the offset to applypageSize- the page size- Returns:
- the sources list
-
countSources
Description copied from interface:QAEventServiceCount all the event's sources.- Specified by:
countSourcesin interfaceQAEventService- Parameters:
context- the DSpace context- Returns:
- the count result
-
countSourcesByTarget
Description copied from interface:QAEventServiceCount all the event's sources related to a specific item- Specified by:
countSourcesByTargetin interfaceQAEventService- Parameters:
context- the DSpace contexttarget- the item uuid- Returns:
- the count result
-
isRelatedItemSupported
Description copied from interface:QAEventServiceCheck if the given QA event supports a related item.- Specified by:
isRelatedItemSupportedin interfaceQAEventService- Parameters:
qaevent- the event to be verified- Returns:
- true if the event supports a related item, false otherwise.
-
qaEventsInSource
Description copied from interface:QAEventServiceCheck if a qaevent with the provided id is visible to the current user according to the source security- Specified by:
qaEventsInSourcein interfaceQAEventService- Parameters:
context- the DSpace contextuser- the user to consider for the security checkeventId- the id of the event to check for existencesource- the qa source name- Returns:
trueif the event exists
-
countEventsByTopicAndTarget
public long countEventsByTopicAndTarget(Context context, String sourceName, String topic, UUID target) Description copied from interface:QAEventServiceCount the QA events related to the specified topic and target- Specified by:
countEventsByTopicAndTargetin interfaceQAEventService- Parameters:
context- the DSpace contextsourceName- the source nametopic- the topic to search fortarget- the uuid of the QA event's target- Returns:
- the count result
-
findEventsByTopicAndTarget
public List<QAEvent> findEventsByTopicAndTarget(Context context, String source, String topic, UUID target, long offset, int pageSize) Description copied from interface:QAEventServiceFind a list of QA events according to the pagination parameters for the specified topic and target sorted by trust descending- Specified by:
findEventsByTopicAndTargetin interfaceQAEventService- Parameters:
context- the DSpace contextsource- the source nametopic- the topic to search fortarget- the uuid of the QA event's targetoffset- the offset to applypageSize- the page size- Returns:
- the events
-
countTopicsBySourceAndTarget
Description copied from interface:QAEventServiceCount all the event's topics related to the given source referring to a specific item- Specified by:
countTopicsBySourceAndTargetin interfaceQAEventService- Parameters:
context- the DSpace contextsource- the source to search fortarget- the item uuid- Returns:
- the count result
-
findAllSourcesByTarget
public List<QASource> findAllSourcesByTarget(Context context, UUID target, long offset, int pageSize) Description copied from interface:QAEventServiceFind all the event's sources related to a specific item- Specified by:
findAllSourcesByTargetin interfaceQAEventService- Parameters:
context- the DSpace contexttarget- the item referring tooffset- the offset to applypageSize- the page size- Returns:
- the source list
-