Class AnnotationServiceJpaImpl

java.lang.Object
org.opencastproject.annotation.impl.AnnotationServiceJpaImpl
All Implemented Interfaces:
AnnotationService

public class AnnotationServiceJpaImpl extends Object implements AnnotationService
JPA-based implementation of the AnnotationService
  • Field Details

    • PERSISTENCE_UNIT

      public static final String PERSISTENCE_UNIT
      JPA persistence unit name
      See Also:
    • emf

      protected javax.persistence.EntityManagerFactory emf
      The factory used to generate the entity manager
    • dbSessionFactory

      protected DBSessionFactory dbSessionFactory
    • db

      protected DBSession db
    • securityService

      protected SecurityService securityService
      Opencast's security service
  • Constructor Details

    • AnnotationServiceJpaImpl

      public AnnotationServiceJpaImpl()
  • Method Details

    • setDBSessionFactory

      public void setDBSessionFactory(DBSessionFactory dbSessionFactory)
    • activate

      public void activate()
    • deactivate

      public void deactivate()
    • setSecurityService

      public void setSecurityService(SecurityService securityService)
      Sets the opencast security service
      Parameters:
      securityService - the securityService to set
    • addAnnotation

      public Annotation addAnnotation(Annotation a)
      Description copied from interface: AnnotationService
      Adds a new annotation to the database and returns the event with an updated annotationId, to make sure the annotationId stays unique
      Specified by:
      addAnnotation in interface AnnotationService
      Parameters:
      a - The Annotation that will be added to the database
      Returns:
      the updated annotation, with a new ID. NULL if there are errors while adding the annotation.
    • removeAnnotation

      public boolean removeAnnotation(Annotation a)
      Description copied from interface: AnnotationService
      Remove a given annotation from database
      Specified by:
      removeAnnotation in interface AnnotationService
      Parameters:
      a - The Annotation that will be removed from the database
      Returns:
      true if successfull removed, false else.
    • changeAnnotation

      public Annotation changeAnnotation(Annotation a) throws NotFoundException
      Description copied from interface: AnnotationService
      Changes an annotation in the database it uses the annotationId to overwrite the value. It returns the event with an updated annotation.
      Specified by:
      changeAnnotation in interface AnnotationService
      Parameters:
      a - The Annotation that will be changed in the database
      Returns:
      the updated annotation. NULL if there are errors while changing the annotation.
      Throws:
      NotFoundException
    • getAnnotation

      public Annotation getAnnotation(long id) throws NotFoundException
      Description copied from interface: AnnotationService
      Gets an annotation by its identifier.
      Specified by:
      getAnnotation in interface AnnotationService
      Parameters:
      id - the annotation identifier
      Returns:
      the annotation
      Throws:
      NotFoundException - if there is no annotation with this identifier
    • getAnnotations

      public AnnotationList getAnnotations(int offset, int limit)
      Description copied from interface: AnnotationService
      Returns annotations
      Specified by:
      getAnnotations in interface AnnotationService
      Parameters:
      offset - the offset
      limit - the limit
      Returns:
      the annotation list
    • getAnnotationsByTypeAndMediapackageId

      public AnnotationList getAnnotationsByTypeAndMediapackageId(String type, String mediapackageId, int offset, int limit)
      Description copied from interface: AnnotationService
      Returns annotations of a given type and mediapackage id
      Specified by:
      getAnnotationsByTypeAndMediapackageId in interface AnnotationService
      Parameters:
      type - the annotation type
      mediapackageId - the mediapackage id
      offset - the offset
      limit - the limit
      Returns:
      the annotation list
    • getAnnotationsByMediapackageId

      public AnnotationList getAnnotationsByMediapackageId(String mediapackageId, int offset, int limit)
      Description copied from interface: AnnotationService
      Returns annotations of a given mediapackage ID
      Specified by:
      getAnnotationsByMediapackageId in interface AnnotationService
      Parameters:
      mediapackageId - The mediapackage ID
      offset - the offset
      limit - the limit
      Returns:
      the annotation list
    • getAnnotationsByTypeAndDay

      public AnnotationList getAnnotationsByTypeAndDay(String type, String day, int offset, int limit)
      Description copied from interface: AnnotationService
      Returns annotations of a given type and day
      Specified by:
      getAnnotationsByTypeAndDay in interface AnnotationService
      Parameters:
      type - the annotation type
      day - the day
      offset - the offset
      limit - the limit
      Returns:
      the annotation list
    • getAnnotationsByDay

      public AnnotationList getAnnotationsByDay(String day, int offset, int limit)
      Description copied from interface: AnnotationService
      Returns annotations of a given day (YYYYMMDD)
      Specified by:
      getAnnotationsByDay in interface AnnotationService
      Parameters:
      day - The day in the format of YYYYMMDD
      offset - the offset
      limit - the limit
      Returns:
      the annotation list
    • getAnnotationsByType

      public AnnotationList getAnnotationsByType(String type, int offset, int limit)
      Description copied from interface: AnnotationService
      Returns annotations of a given type
      Specified by:
      getAnnotationsByType in interface AnnotationService
      Parameters:
      type - The annotation type
      offset - the offset
      limit - the limit
      Returns:
      the annotation list