Class EventCommentDatabaseServiceImpl

java.lang.Object
org.opencastproject.elasticsearch.index.rebuild.AbstractIndexProducer
org.opencastproject.event.comment.persistence.EventCommentDatabaseServiceImpl
All Implemented Interfaces:
org.opencastproject.elasticsearch.index.rebuild.IndexProducer, EventCommentDatabaseService

public class EventCommentDatabaseServiceImpl extends org.opencastproject.elasticsearch.index.rebuild.AbstractIndexProducer implements EventCommentDatabaseService
Implements permanent storage for event comments.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(org.osgi.service.component.ComponentContext cc)
    OSGi component activation callback
    int
     
    void
    deleteComment(long commentId)
    Delete a comment from an event.
    void
    Delete all comments from an event.
    getComment(long commentId)
    Get a comment for a particular event.
     
    Get all of the comments for an event.
    Return all known event ID's with existing comments, grouped by organization ID
    Get the available reasons for commenting on an event.
    org.opencastproject.elasticsearch.index.rebuild.IndexRebuildService.Service
     
    void
    repopulate(org.opencastproject.elasticsearch.index.rebuild.IndexRebuildService.DataType type)
     
    void
    setDBSessionFactory(org.opencastproject.db.DBSessionFactory dbSessionFactory)
     
    void
    setEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
    OSGi DI
    void
    setIndex(org.opencastproject.elasticsearch.index.ElasticsearchIndex index)
    OSgi callback for the Elasticsearch index.
    void
    setOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService)
    OSGi callback to set the organization directory service.
    void
    setSecurityService(org.opencastproject.security.api.SecurityService securityService)
    OSGi callback to set the security context to run with.
    void
    setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
    OSGi callback to set the user directory service.
    Update a comment.

    Methods inherited from class org.opencastproject.elasticsearch.index.rebuild.AbstractIndexProducer

    logIndexRebuildBegin, logIndexRebuildBegin, logIndexRebuildError, logIndexRebuildError, logIndexRebuildError, logIndexRebuildProgress, logIndexRebuildProgress, logIndexRebuildProgress, logIndexRebuildProgress, logSkippingElement, logSkippingElement

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.opencastproject.elasticsearch.index.rebuild.IndexProducer

    dataTypeSupported, getSupportedDataTypes
  • Field Details

  • Constructor Details

    • EventCommentDatabaseServiceImpl

      public EventCommentDatabaseServiceImpl()
  • Method Details

    • activate

      public void activate(org.osgi.service.component.ComponentContext cc)
      OSGi component activation callback
    • setEntityManagerFactory

      public void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
      OSGi DI
    • setDBSessionFactory

      public void setDBSessionFactory(org.opencastproject.db.DBSessionFactory dbSessionFactory)
    • setSecurityService

      public void setSecurityService(org.opencastproject.security.api.SecurityService securityService)
      OSGi callback to set the security context to run with.
      Parameters:
      securityService - The security service
    • setUserDirectoryService

      public void setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
      OSGi callback to set the user directory service.
      Parameters:
      userDirectoryService - the user directory service
    • setOrganizationDirectoryService

      public void setOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService)
      OSGi callback to set the organization directory service.
      Parameters:
      organizationDirectoryService - the organization directory service
    • setIndex

      public void setIndex(org.opencastproject.elasticsearch.index.ElasticsearchIndex index)
      OSgi callback for the Elasticsearch index.
      Parameters:
      index - the Elasticsearch index.
    • getReasons

      public List<String> getReasons() throws EventCommentDatabaseException
      Description copied from interface: EventCommentDatabaseService
      Get the available reasons for commenting on an event.
      Specified by:
      getReasons in interface EventCommentDatabaseService
      Returns:
      A list of reasons of why a comment was made.
      Throws:
      EventCommentDatabaseException - Thrown if there was an issue getting the comment reasons.
    • getComment

      public EventComment getComment(long commentId) throws org.opencastproject.util.NotFoundException, EventCommentDatabaseException
      Description copied from interface: EventCommentDatabaseService
      Get a comment for a particular event.
      Specified by:
      getComment in interface EventCommentDatabaseService
      Parameters:
      commentId - The id for the comment.
      Returns:
      The comment
      Throws:
      org.opencastproject.util.NotFoundException - Thrown if the comment cannot be found.
      EventCommentDatabaseException - Thrown if there was an issue getting the comment from the database.
    • deleteComment

      public void deleteComment(long commentId) throws org.opencastproject.util.NotFoundException, EventCommentDatabaseException
      Description copied from interface: EventCommentDatabaseService
      Delete a comment from an event.
      Specified by:
      deleteComment in interface EventCommentDatabaseService
      Parameters:
      commentId - The id of the comment.
      Throws:
      org.opencastproject.util.NotFoundException - Thrown if cannot find the event / comment.
      EventCommentDatabaseException - Thrown if there is a problem deleting the comment.
    • deleteComments

      public void deleteComments(String eventId) throws org.opencastproject.util.NotFoundException, EventCommentDatabaseException
      Description copied from interface: EventCommentDatabaseService
      Delete all comments from an event.
      Specified by:
      deleteComments in interface EventCommentDatabaseService
      Parameters:
      eventId - The id of the event.
      Throws:
      org.opencastproject.util.NotFoundException - Thrown if cannot find the event.
      EventCommentDatabaseException - Thrown if there is a problem deleting the comments.
    • updateComment

      public EventComment updateComment(EventComment comment) throws EventCommentDatabaseException
      Description copied from interface: EventCommentDatabaseService
      Update a comment.
      Specified by:
      updateComment in interface EventCommentDatabaseService
      Parameters:
      comment - The new comment status to update to.
      Returns:
      The comment updated.
      Throws:
      EventCommentDatabaseException - Thrown if there is a problem updating the comment.
    • getComments

      public List<EventComment> getComments(String eventId) throws EventCommentDatabaseException
      Description copied from interface: EventCommentDatabaseService
      Get all of the comments for an event.
      Specified by:
      getComments in interface EventCommentDatabaseService
      Parameters:
      eventId - The id of the event to get the comments for (mediapackage id).
      Returns:
      The List of comments.
      Throws:
      EventCommentDatabaseException - Thrown if there was a problem getting the comments from the database.
    • getComments

      Throws:
      EventCommentDatabaseException
    • countComments

      public int countComments() throws EventCommentDatabaseException
      Throws:
      EventCommentDatabaseException
    • getEventsWithComments

      public Map<String,List<String>> getEventsWithComments()
      Return all known event ID's with existing comments, grouped by organization ID
      Returns:
      a list of all event ID's grouped by organization ID
    • repopulate

      public void repopulate(org.opencastproject.elasticsearch.index.rebuild.IndexRebuildService.DataType type) throws org.opencastproject.elasticsearch.index.rebuild.IndexRebuildException
      Specified by:
      repopulate in interface org.opencastproject.elasticsearch.index.rebuild.IndexProducer
      Throws:
      org.opencastproject.elasticsearch.index.rebuild.IndexRebuildException
    • getService

      public org.opencastproject.elasticsearch.index.rebuild.IndexRebuildService.Service getService()
      Specified by:
      getService in interface org.opencastproject.elasticsearch.index.rebuild.IndexProducer