Interface SeriesServiceDatabase

All Known Implementing Classes:
SeriesServiceDatabaseImpl

public interface SeriesServiceDatabase
API that defines persistent storage of series.
  • Method Details

    • storeSeries

      org.opencastproject.metadata.dublincore.DublinCoreCatalog storeSeries(org.opencastproject.metadata.dublincore.DublinCoreCatalog dc) throws SeriesServiceDatabaseException, org.opencastproject.security.api.UnauthorizedException
      Store (or update) series.
      Parameters:
      dc - DublinCoreCatalog representing series
      Returns:
      Dublin Core catalog representing newly created series or null if series Dublin Core was updated
      Throws:
      SeriesServiceDatabaseException - if exception occurs
      org.opencastproject.security.api.UnauthorizedException - if the current user is not authorized to perform this action
    • storeSeriesAccessControl

      boolean storeSeriesAccessControl(String seriesID, org.opencastproject.security.api.AccessControlList accessControl) throws org.opencastproject.util.NotFoundException, SeriesServiceDatabaseException
      Store access control associated with specified series. IllegalArgumentException is thrown if accessControl parameter is null.
      Parameters:
      seriesID - ID of series to associate access control with
      accessControl - AccessControlList representing access control rules for specified series
      Returns:
      true if update happened, false if there was no previous entry
      Throws:
      org.opencastproject.util.NotFoundException - if series with specified ID does not exist
      SeriesServiceDatabaseException - if exception occurred
    • deleteSeries

      void deleteSeries(String seriesId) throws SeriesServiceDatabaseException, org.opencastproject.util.NotFoundException
      Removes series from persistent storage.
      Parameters:
      seriesId - ID of the series to be removed
      Throws:
      SeriesServiceDatabaseException - if exception occurs
      org.opencastproject.util.NotFoundException - if series with specified ID is not found
    • deleteSeriesProperty

      void deleteSeriesProperty(String seriesId, String propertyName) throws SeriesServiceDatabaseException, org.opencastproject.util.NotFoundException
      Removes the series property from persistent storage.
      Parameters:
      seriesId - ID of the series to be removed.
      propertyName - The unique name of the property to delete.
      Throws:
      SeriesServiceDatabaseException - if exception occurs
      org.opencastproject.util.NotFoundException - if series with specified ID is not found or if there is no property with the property name
    • getAllSeries

      Returns all series in persistent storage.
      Returns:
      Tuple array representing stored series
      Throws:
      SeriesServiceDatabaseException - if exception occurs
    • getAllForAdministrativeRead

      List<org.opencastproject.series.api.Series> getAllForAdministrativeRead(Date from, Optional<Date> to, int limit) throws SeriesServiceDatabaseException, org.opencastproject.security.api.UnauthorizedException
      Returns all series (including deleted ones!) that have been modified in the given date range from (inclusive) -- to (exclusive). At most limit many series are returned. ACLs/permissions are NOT checked as this is only intended to be used in an administrative context.
      Throws:
      SeriesServiceDatabaseException
      org.opencastproject.security.api.UnauthorizedException
    • getAccessControlList

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

      org.opencastproject.metadata.dublincore.DublinCoreCatalog getSeries(String seriesId) throws org.opencastproject.util.NotFoundException, SeriesServiceDatabaseException
      Gets a single series by its identifier.
      Parameters:
      seriesId - the series identifier
      Returns:
      the dublin core catalog for this series
      Throws:
      org.opencastproject.util.NotFoundException - if there is no series with this identifier
      SeriesServiceDatabaseException - if there is a problem communicating with the underlying data store
    • getSeriesProperties

      Map<String,String> getSeriesProperties(String seriesId) throws org.opencastproject.util.NotFoundException, SeriesServiceDatabaseException
      Get the properties for particular series
      Parameters:
      seriesId - The unique series id to retrieve the properties for.
      Returns:
      A Map of the properties names and values.
      Throws:
      org.opencastproject.util.NotFoundException - Thrown if the series can't be found.
      SeriesServiceDatabaseException - If exception occurred
    • getSeriesProperty

      String getSeriesProperty(String seriesId, String propertyName) throws org.opencastproject.util.NotFoundException, SeriesServiceDatabaseException
      Get a series property if it exists
      Parameters:
      seriesId - The id used to get the series.
      propertyName - The unique name for the property.
      Returns:
      The property value
      Throws:
      org.opencastproject.util.NotFoundException - Thrown if the series or the property doesn't exist.
      SeriesServiceDatabaseException - Thrown for all other Exceptions.
    • countSeries

      int countSeries() throws SeriesServiceDatabaseException
      Throws:
      SeriesServiceDatabaseException
    • updateSeriesProperty

      void updateSeriesProperty(String seriesId, String propertyName, String propertyValue) throws org.opencastproject.util.NotFoundException, SeriesServiceDatabaseException
      Updates a series' property.
      Parameters:
      seriesId - The id of the series to add or update the property for.
      propertyName - A unique name for the property.
      propertyValue - The value for the property.
      Throws:
      org.opencastproject.util.NotFoundException - Thrown if the series cannot be found.
      SeriesServiceDatabaseException - Thrown if another exception occurred
    • existsSeriesElement

      boolean existsSeriesElement(String seriesId, String type) throws SeriesServiceDatabaseException
      Returns true if the series with the given identifier contains an element with the given type.
      Parameters:
      seriesId - the series identifier
      type - the element type
      Returns:
      true, if the element exits; false otherwise
      Throws:
      SeriesServiceDatabaseException - if there was an error while checking if the element exits
    • storeSeriesElement

      boolean storeSeriesElement(String seriesId, String type, byte[] data) throws SeriesServiceDatabaseException
      Adds or updates a series element in the series service database.
      Parameters:
      seriesId - the series identifier
      type - the element type
      data - the element data
      Returns:
      true if the element could be added/updated; false if no such series exists
      Throws:
      SeriesServiceDatabaseException - if an error occurs while saving the element in the database
    • deleteSeriesElement

      boolean deleteSeriesElement(String seriesId, String type) throws SeriesServiceDatabaseException
      Deletes an element of a given type from a series
      Parameters:
      seriesId - the series identifier
      type - the element type
      Returns:
      true if the element could be deleted; false if no such series/element exists
      Throws:
      SeriesServiceDatabaseException - if an error occurs while removing the element from the database
    • getSeriesElement

      com.entwinemedia.fn.data.Opt<byte[]> getSeriesElement(String seriesId, String type) throws SeriesServiceDatabaseException
      Returns the data of a series element.
      Parameters:
      seriesId - the series identifier
      type - the element type
      Returns:
      the element data or Opt.none() if no such series/element exists
      Throws:
      SeriesServiceDatabaseException - if an error occurs while retrieving the element from the database
    • getSeriesElements

      com.entwinemedia.fn.data.Opt<Map<String,byte[]>> getSeriesElements(String seriesId) throws SeriesServiceDatabaseException
      Returns all elements of a series or an empty map if the series does not contain any elements. The key of the map marks the element type.
      Parameters:
      seriesId - the series identifier
      Returns:
      a map of series elements or Opt.none() if no such series exists
      Throws:
      SeriesServiceDatabaseException - if an error occurs while retrieving the element from the database