Package org.opencastproject.series.impl
Interface SeriesServiceDatabase
- All Known Implementing Classes:
SeriesServiceDatabaseImpl
public interface SeriesServiceDatabase
API that defines persistent storage of series.
-
Method Summary
Modifier and TypeMethodDescriptionintvoiddeleteSeries(String seriesId) Removes series from persistent storage.booleandeleteSeriesElement(String seriesId, String type) Deletes an element of a given type from a seriesvoiddeleteSeriesProperty(String seriesId, String propertyName) Removes the series property from persistent storage.booleanexistsSeriesElement(String seriesId, String type) Returns true if the series with the given identifier contains an element with the given type.getAccessControlList(String seriesID) Retrieves ACL for series with given ID.getAllForAdministrativeRead(Date from, Optional<Date> to, int limit) Returns all series (including deleted ones!)Returns all series in persistent storage.Gets a single series by its identifier.com.entwinemedia.fn.data.Opt<byte[]> getSeriesElement(String seriesId, String type) Returns the data of a series element.getSeriesElements(String seriesId) Returns all elements of a series or an empty map if the series does not contain any elements.getSeriesProperties(String seriesId) Get the properties for particular seriesgetSeriesProperty(String seriesId, String propertyName) Get a series property if it existsStore (or update) series.booleanstoreSeriesAccessControl(String seriesID, AccessControlList accessControl) Store access control associated with specified series.booleanstoreSeriesElement(String seriesId, String type, byte[] data) Adds or updates a series element in the series service database.voidupdateSeriesProperty(String seriesId, String propertyName, String propertyValue) Updates a series' property.
-
Method Details
-
storeSeries
DublinCoreCatalog storeSeries(DublinCoreCatalog dc) throws SeriesServiceDatabaseException, UnauthorizedException Store (or update) series.- Parameters:
dc-DublinCoreCatalogrepresenting series- Returns:
- Dublin Core catalog representing newly created series or null if series Dublin Core was updated
- Throws:
SeriesServiceDatabaseException- if exception occursUnauthorizedException- if the current user is not authorized to perform this action
-
storeSeriesAccessControl
boolean storeSeriesAccessControl(String seriesID, AccessControlList accessControl) throws 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 withaccessControl-AccessControlListrepresenting access control rules for specified series- Returns:
- true if update happened, false if there was no previous entry
- Throws:
NotFoundException- if series with specified ID does not existSeriesServiceDatabaseException- if exception occurred
-
deleteSeries
Removes series from persistent storage.- Parameters:
seriesId- ID of the series to be removed- Throws:
SeriesServiceDatabaseException- if exception occursNotFoundException- if series with specified ID is not found
-
deleteSeriesProperty
void deleteSeriesProperty(String seriesId, String propertyName) throws SeriesServiceDatabaseException, 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 occursNotFoundException- 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:
Tuplearray representing stored series- Throws:
SeriesServiceDatabaseException- if exception occurs
-
getAllForAdministrativeRead
List<Series> getAllForAdministrativeRead(Date from, Optional<Date> to, int limit) throws SeriesServiceDatabaseException, UnauthorizedException Returns all series (including deleted ones!) that have been modified in the given date rangefrom(inclusive) --to(exclusive). At mostlimitmany series are returned. ACLs/permissions are NOT checked as this is only intended to be used in an administrative context. -
getAccessControlList
AccessControlList getAccessControlList(String seriesID) throws NotFoundException, SeriesServiceDatabaseException Retrieves ACL for series with given ID.- Parameters:
seriesID- series for which ACL will be retrieved- Returns:
AccessControlListof series or null if series does not have ACL associated with it- Throws:
NotFoundException- if series with given ID does not existSeriesServiceDatabaseException- if exception occurred
-
getSeries
DublinCoreCatalog getSeries(String seriesId) throws NotFoundException, SeriesServiceDatabaseException Gets a single series by its identifier.- Parameters:
seriesId- the series identifier- Returns:
- the dublin core catalog for this series
- Throws:
NotFoundException- if there is no series with this identifierSeriesServiceDatabaseException- if there is a problem communicating with the underlying data store
-
getSeriesProperties
Map<String,String> getSeriesProperties(String seriesId) throws NotFoundException, SeriesServiceDatabaseException Get the properties for particular series- Parameters:
seriesId- The unique series id to retrieve the properties for.- Returns:
- A
Mapof the properties names and values. - Throws:
NotFoundException- Thrown if the series can't be found.SeriesServiceDatabaseException- If exception occurred
-
getSeriesProperty
String getSeriesProperty(String seriesId, String propertyName) throws 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:
NotFoundException- Thrown if the series or the property doesn't exist.SeriesServiceDatabaseException- Thrown for all other Exceptions.
-
countSeries
- Throws:
SeriesServiceDatabaseException
-
updateSeriesProperty
void updateSeriesProperty(String seriesId, String propertyName, String propertyValue) throws 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:
NotFoundException- Thrown if the series cannot be found.SeriesServiceDatabaseException- Thrown if another exception occurred
-
existsSeriesElement
Returns true if the series with the given identifier contains an element with the given type.- Parameters:
seriesId- the series identifiertype- 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 identifiertype- the element typedata- 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
Deletes an element of a given type from a series- Parameters:
seriesId- the series identifiertype- 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 identifiertype- 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
-