Interface SearchServiceDatabase

All Known Implementing Classes:
SearchServiceDatabaseImpl

public interface SearchServiceDatabase
API that defines persistent storage of series.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of mediapackages in persistent storage, including deleted entries.
    void
    deleteMediaPackage(String mediaPackageId, Date deletionDate)
    Removes media package from persistent storage.
    org.opencastproject.security.api.AccessControlList
    getAccessControlList(String mediaPackageId)
    Retrieves ACL for episode with given ID.
    Collection<org.apache.commons.lang3.tuple.Pair<String,org.opencastproject.security.api.AccessControlList>>
    getAccessControlLists(String seriesId, String... excludeIds)
    Retrieves ACLs for series with given ID.
    Stream<org.opencastproject.util.data.Tuple<org.opencastproject.mediapackage.MediaPackage,String>>
    getAllMediaPackages(int pagesize, int offset)
    Returns all search entries in persistent storage.
    getDeletionDate(String mediaPackageId)
    Returns the deletion date from the selected media package.
    org.opencastproject.mediapackage.MediaPackage
    getMediaPackage(String mediaPackageId)
    Gets a single media package by its identifier.
    getModificationDate(String mediaPackageId)
    Returns the modification date from the selected media package.
    getOrganizationId(String mediaPackageId)
    Returns the organization id of the selected media package
    Collection<org.apache.commons.lang3.tuple.Pair<org.opencastproject.security.api.Organization,org.opencastproject.mediapackage.MediaPackage>>
    getSeries(String seriesId)
    Gets media packages from a specific series
    boolean
    isAvailable(String mediaPackageId)
    Checks if a mediapackage is available.
    void
    storeMediaPackage(org.opencastproject.mediapackage.MediaPackage mediaPackage, org.opencastproject.security.api.AccessControlList acl, Date now)
    Store (or update) media package.
  • Method Details

    • getAllMediaPackages

      Stream<org.opencastproject.util.data.Tuple<org.opencastproject.mediapackage.MediaPackage,String>> getAllMediaPackages(int pagesize, int offset) throws SearchServiceDatabaseException
      Returns all search entries in persistent storage.
      Parameters:
      pagesize - the number of results to get from the database at once
      offset - the offset into the full result list to fetch
      Returns:
      Tuple array of mediapackage-orgid pairs representing stored media packages
      Throws:
      SearchServiceDatabaseException - if exception occurs
    • getOrganizationId

      String getOrganizationId(String mediaPackageId) throws org.opencastproject.util.NotFoundException, SearchServiceDatabaseException
      Returns the organization id of the selected media package
      Parameters:
      mediaPackageId - the media package id to select
      Returns:
      the organization id
      Throws:
      org.opencastproject.util.NotFoundException - if media package with specified id and version does not exist
      SearchServiceDatabaseException - if an error occurs
    • countMediaPackages

      int countMediaPackages() throws SearchServiceDatabaseException
      Returns the number of mediapackages in persistent storage, including deleted entries.
      Returns:
      the number of mediapackages in storage
      Throws:
      SearchServiceDatabaseException - if an error occurs
    • getMediaPackage

      org.opencastproject.mediapackage.MediaPackage getMediaPackage(String mediaPackageId) throws org.opencastproject.util.NotFoundException, SearchServiceDatabaseException, org.opencastproject.security.api.UnauthorizedException
      Gets a single media package by its identifier.
      Parameters:
      mediaPackageId - the media package identifier
      Returns:
      the media package
      Throws:
      org.opencastproject.util.NotFoundException - if there is no media package with this identifier
      SearchServiceDatabaseException - if there is a problem communicating with the underlying data store
      org.opencastproject.security.api.UnauthorizedException
    • getSeries

      Collection<org.apache.commons.lang3.tuple.Pair<org.opencastproject.security.api.Organization,org.opencastproject.mediapackage.MediaPackage>> getSeries(String seriesId) throws SearchServiceDatabaseException
      Gets media packages from a specific series
      Parameters:
      seriesId - the series identifier
      Returns:
      collection of media packages
      Throws:
      SearchServiceDatabaseException - if there is a problem communicating with the underlying data store
    • getAccessControlList

      org.opencastproject.security.api.AccessControlList getAccessControlList(String mediaPackageId) throws org.opencastproject.util.NotFoundException, SearchServiceDatabaseException
      Retrieves ACL for episode with given ID.
      Parameters:
      mediaPackageId - media package for which ACL will be retrieved
      Returns:
      AccessControlList of media package or null if media package does not have ACL associated with it
      Throws:
      org.opencastproject.util.NotFoundException - if media package with given ID does not exist
      SearchServiceDatabaseException - if exception occurred
    • getAccessControlLists

      Collection<org.apache.commons.lang3.tuple.Pair<String,org.opencastproject.security.api.AccessControlList>> getAccessControlLists(String seriesId, String... excludeIds) throws SearchServiceDatabaseException
      Retrieves ACLs for series with given ID.
      Parameters:
      seriesId - series identifier for which ACL will be retrieved
      excludeIds - list of media package identifier to exclude from the list
      Returns:
      Collection of pairs of media package id and its AccessControlList of media packages from the series
      Throws:
      SearchServiceDatabaseException - if exception occurred
    • getModificationDate

      Date getModificationDate(String mediaPackageId) throws org.opencastproject.util.NotFoundException, SearchServiceDatabaseException
      Returns the modification date from the selected media package.
      Parameters:
      mediaPackageId - the media package id to select
      Returns:
      the modification date
      Throws:
      org.opencastproject.util.NotFoundException - if media package with specified id and version does not exist
      SearchServiceDatabaseException - if an error occurs
    • getDeletionDate

      Date getDeletionDate(String mediaPackageId) throws org.opencastproject.util.NotFoundException, SearchServiceDatabaseException
      Returns the deletion date from the selected media package.
      Parameters:
      mediaPackageId - the media package id to select
      Returns:
      the deletion date
      Throws:
      org.opencastproject.util.NotFoundException - if media package with specified id does not exist
      SearchServiceDatabaseException - if an error occurs
    • deleteMediaPackage

      void deleteMediaPackage(String mediaPackageId, Date deletionDate) throws SearchServiceDatabaseException, org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException
      Removes media package from persistent storage.
      Parameters:
      mediaPackageId - id of the media package to be removed
      deletionDate - the deletion date to set
      Throws:
      SearchServiceDatabaseException - if exception occurs
      org.opencastproject.util.NotFoundException - if media package with specified id is not found
      org.opencastproject.security.api.UnauthorizedException - if the current user is not authorized to perform this action
    • storeMediaPackage

      void storeMediaPackage(org.opencastproject.mediapackage.MediaPackage mediaPackage, org.opencastproject.security.api.AccessControlList acl, Date now) throws SearchServiceDatabaseException, org.opencastproject.security.api.UnauthorizedException
      Store (or update) media package.
      Parameters:
      mediaPackage - MediaPackage to store
      acl - the acl of the media package
      now - the store date
      Throws:
      SearchServiceDatabaseException - if exception occurs
      org.opencastproject.security.api.UnauthorizedException - if the current user is not authorized to perform this action
    • isAvailable

      boolean isAvailable(String mediaPackageId) throws SearchServiceDatabaseException
      Checks if a mediapackage is available.
      Parameters:
      mediaPackageId - The ID of the MediaPackage for which the availability is to be checked
      Returns:
      True if two conditions are met: The mediapackage exists in the database and the deletion date is not set
      Throws:
      SearchServiceDatabaseException - if an exception occurs