Class QAEventServiceImpl

java.lang.Object
org.dspace.qaevent.service.impl.QAEventServiceImpl
All Implemented Interfaces:
QAEventService

public class QAEventServiceImpl extends Object implements 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 Details

  • Constructor Details

    • QAEventServiceImpl

      public QAEventServiceImpl()
  • Method Details

    • getSolr

      protected org.apache.solr.client.solrj.SolrClient getSolr()
    • countTopics

      public long countTopics()
      Description copied from interface: QAEventService
      Count all the event's topics.
      Specified by:
      countTopics in interface QAEventService
      Returns:
      the count result
    • countTopicsBySource

      public long countTopicsBySource(Context context, String sourceName)
      Description copied from interface: QAEventService
      Count all the event's topics related to the given source.
      Specified by:
      countTopicsBySource in interface QAEventService
      Parameters:
      context - the DSpace context
      sourceName - 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: QAEventService
      Find a specific topic by its name, source and optionally a target.
      Specified by:
      findTopicBySourceAndNameAndTarget in interface QAEventService
      Parameters:
      context - the DSpace context
      sourceName - the name of the source
      topicName - the topic name to search for
      target - (nullable) the uuid of the target to focus on
      Returns:
      the topic
    • deleteEventByEventId

      public void deleteEventByEventId(String id)
      Description copied from interface: QAEventService
      Delete an event by the given id.
      Specified by:
      deleteEventByEventId in interface QAEventService
      Parameters:
      id - the id of the event to delete
    • deleteEventsByTargetId

      public void deleteEventsByTargetId(UUID targetId)
      Description copied from interface: QAEventService
      Delete events by the given target id.
      Specified by:
      deleteEventsByTargetId in interface QAEventService
      Parameters:
      targetId - the id of the target id
    • findTopicByTopicId

      public QATopic findTopicByTopicId(String topicId)
      Description copied from interface: QAEventService
      Find a specific topid by the given id.
      Specified by:
      findTopicByTopicId in interface QAEventService
      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: QAEventService
      Find all the event's topics.
      Specified by:
      findAllTopics in interface QAEventService
      Parameters:
      context - the DSpace context
      offset - the offset to apply
      orderField - the field to order for
      ascending - 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: QAEventService
      Find all the event's topics related to the given source.
      Specified by:
      findAllTopicsBySource in interface QAEventService
      Parameters:
      context - the DSpace context
      source - the source to search for
      offset - the offset to apply
      count - the page size
      orderField - the field to order for
      ascending - 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: QAEventService
      Find all the event's topics related to the given source for a specific item
      Specified by:
      findAllTopicsBySourceAndTarget in interface QAEventService
      Parameters:
      context - the DSpace context
      source - (not null) the source to search for
      target - the item referring to
      offset - the offset to apply
      pageSize - the page size
      Returns:
      the topics list
    • store

      public void store(Context context, QAEvent dto)
      Description copied from interface: QAEventService
      Store the given event.
      Specified by:
      store in interface QAEventService
      Parameters:
      context - the DSpace context
      dto - the event to store
    • sentEmailToAdminAboutNewRequest

      public void sentEmailToAdminAboutNewRequest(QAEvent qaEvent)
      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

      public QAEvent findEventByEventId(String eventId)
      Description copied from interface: QAEventService
      Find an event by the given id. Please note that no security filter are applied by this method.
      Specified by:
      findEventByEventId in interface QAEventService
      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: QAEventService
      Find all the events by topic.
      Specified by:
      findEventsByTopic in interface QAEventService
      Parameters:
      context - the DSpace context
      sourceName - the source name
      topic - the topic to search for
      offset - the offset to apply
      pageSize - the page size
      orderField - the field to order for
      ascending - true if the order should be ascending, false otherwise
      Returns:
      the events
    • countEventsByTopic

      public long countEventsByTopic(Context context, String sourceName, String topic)
      Description copied from interface: QAEventService
      Find all the events by topic.
      Specified by:
      countEventsByTopic in interface QAEventService
      Parameters:
      context - the DSpace context
      sourceName - the source name
      topic - the topic to search for
      Returns:
      the events count
    • findSource

      public QASource findSource(Context context, String sourceName)
      Description copied from interface: QAEventService
      Find a specific source by the given name.
      Specified by:
      findSource in interface QAEventService
      Parameters:
      context - the DSpace context
      sourceName - the source name
      Returns:
      the source
    • findSource

      public QASource findSource(Context context, String sourceName, UUID target)
      Description copied from interface: QAEventService
      Find a specific source by the given name including the stats focused on the target item.
      Specified by:
      findSource in interface QAEventService
      Parameters:
      context - the DSpace context
      sourceName - the source name
      target - the uuid of the item target
      Returns:
      the source
    • findAllSources

      public List<QASource> findAllSources(Context context, long offset, int pageSize)
      Description copied from interface: QAEventService
      Find all the event's sources.
      Specified by:
      findAllSources in interface QAEventService
      Parameters:
      context - the DSpace context
      offset - the offset to apply
      pageSize - the page size
      Returns:
      the sources list
    • countSources

      public long countSources(Context context)
      Description copied from interface: QAEventService
      Count all the event's sources.
      Specified by:
      countSources in interface QAEventService
      Parameters:
      context - the DSpace context
      Returns:
      the count result
    • countSourcesByTarget

      public long countSourcesByTarget(Context context, UUID target)
      Description copied from interface: QAEventService
      Count all the event's sources related to a specific item
      Specified by:
      countSourcesByTarget in interface QAEventService
      Parameters:
      context - the DSpace context
      target - the item uuid
      Returns:
      the count result
    • isRelatedItemSupported

      public boolean isRelatedItemSupported(QAEvent qaevent)
      Description copied from interface: QAEventService
      Check if the given QA event supports a related item.
      Specified by:
      isRelatedItemSupported in interface QAEventService
      Parameters:
      qaevent - the event to be verified
      Returns:
      true if the event supports a related item, false otherwise.
    • qaEventsInSource

      public boolean qaEventsInSource(Context context, EPerson user, String eventId, String source)
      Description copied from interface: QAEventService
      Check if a qaevent with the provided id is visible to the current user according to the source security
      Specified by:
      qaEventsInSource in interface QAEventService
      Parameters:
      context - the DSpace context
      user - the user to consider for the security check
      eventId - the id of the event to check for existence
      source - the qa source name
      Returns:
      true if the event exists
    • countEventsByTopicAndTarget

      public long countEventsByTopicAndTarget(Context context, String sourceName, String topic, UUID target)
      Description copied from interface: QAEventService
      Count the QA events related to the specified topic and target
      Specified by:
      countEventsByTopicAndTarget in interface QAEventService
      Parameters:
      context - the DSpace context
      sourceName - the source name
      topic - the topic to search for
      target - 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: QAEventService
      Find a list of QA events according to the pagination parameters for the specified topic and target sorted by trust descending
      Specified by:
      findEventsByTopicAndTarget in interface QAEventService
      Parameters:
      context - the DSpace context
      source - the source name
      topic - the topic to search for
      target - the uuid of the QA event's target
      offset - the offset to apply
      pageSize - the page size
      Returns:
      the events
    • countTopicsBySourceAndTarget

      public long countTopicsBySourceAndTarget(Context context, String source, UUID target)
      Description copied from interface: QAEventService
      Count all the event's topics related to the given source referring to a specific item
      Specified by:
      countTopicsBySourceAndTarget in interface QAEventService
      Parameters:
      context - the DSpace context
      source - the source to search for
      target - the item uuid
      Returns:
      the count result
    • findAllSourcesByTarget

      public List<QASource> findAllSourcesByTarget(Context context, UUID target, long offset, int pageSize)
      Description copied from interface: QAEventService
      Find all the event's sources related to a specific item
      Specified by:
      findAllSourcesByTarget in interface QAEventService
      Parameters:
      context - the DSpace context
      target - the item referring to
      offset - the offset to apply
      pageSize - the page size
      Returns:
      the source list