Interface SearchServiceDatabase
- All Known Implementing Classes:
SearchServiceDatabaseImpl
public interface SearchServiceDatabase
API that defines persistent storage of series.
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of mediapackages in persistent storage, including deleted entries.voiddeleteMediaPackage(String mediaPackageId, Date deletionDate) Removes media package from persistent storage.getAccessControlList(String mediaPackageId) Retrieves ACL for episode with given ID.Collection<org.apache.commons.lang3.tuple.Pair<String, AccessControlList>> getAccessControlLists(String seriesId, String... excludeIds) Retrieves ACLs for series with given ID.getAllMediaPackages(int pagesize, int offset) Returns all search entries in persistent storage.getDeletionDate(String mediaPackageId) Returns the deletion date from the selected media package.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 packageCollection<org.apache.commons.lang3.tuple.Pair<Organization, MediaPackage>> Gets media packages from a specific seriesbooleanisAvailable(String mediaPackageId) Checks if a mediapackage is available.voidstoreMediaPackage(MediaPackage mediaPackage, AccessControlList acl, Date now) Store (or update) media package.
-
Method Details
-
getAllMediaPackages
Stream<Tuple<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 onceoffset- the offset into the full result list to fetch- Returns:
Tuplearray of mediapackage-orgid pairs representing stored media packages- Throws:
SearchServiceDatabaseException- if exception occurs
-
getOrganizationId
String getOrganizationId(String mediaPackageId) throws NotFoundException, SearchServiceDatabaseException Returns the organization id of the selected media package- Parameters:
mediaPackageId- the media package id to select- Returns:
- the organization id
- Throws:
NotFoundException- if media package with specified id and version does not existSearchServiceDatabaseException- if an error occurs
-
countMediaPackages
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
MediaPackage getMediaPackage(String mediaPackageId) throws NotFoundException, SearchServiceDatabaseException, UnauthorizedException Gets a single media package by its identifier.- Parameters:
mediaPackageId- the media package identifier- Returns:
- the media package
- Throws:
NotFoundException- if there is no media package with this identifierSearchServiceDatabaseException- if there is a problem communicating with the underlying data storeUnauthorizedException
-
getSeries
Collection<org.apache.commons.lang3.tuple.Pair<Organization,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
AccessControlList getAccessControlList(String mediaPackageId) throws NotFoundException, SearchServiceDatabaseException Retrieves ACL for episode with given ID.- Parameters:
mediaPackageId- media package for which ACL will be retrieved- Returns:
AccessControlListof media package or null if media package does not have ACL associated with it- Throws:
NotFoundException- if media package with given ID does not existSearchServiceDatabaseException- if exception occurred
-
getAccessControlLists
Collection<org.apache.commons.lang3.tuple.Pair<String,AccessControlList>> getAccessControlLists(String seriesId, String... excludeIds) throws SearchServiceDatabaseException Retrieves ACLs for series with given ID.- Parameters:
seriesId- series identifier for which ACL will be retrievedexcludeIds- list of media package identifier to exclude from the list- Returns:
- Collection of pairs of media package id and its
AccessControlListof media packages from the series - Throws:
SearchServiceDatabaseException- if exception occurred
-
getModificationDate
Date getModificationDate(String mediaPackageId) throws NotFoundException, SearchServiceDatabaseException Returns the modification date from the selected media package.- Parameters:
mediaPackageId- the media package id to select- Returns:
- the modification date
- Throws:
NotFoundException- if media package with specified id and version does not existSearchServiceDatabaseException- if an error occurs
-
getDeletionDate
Date getDeletionDate(String mediaPackageId) throws NotFoundException, SearchServiceDatabaseException Returns the deletion date from the selected media package.- Parameters:
mediaPackageId- the media package id to select- Returns:
- the deletion date
- Throws:
NotFoundException- if media package with specified id does not existSearchServiceDatabaseException- if an error occurs
-
deleteMediaPackage
void deleteMediaPackage(String mediaPackageId, Date deletionDate) throws SearchServiceDatabaseException, NotFoundException, UnauthorizedException Removes media package from persistent storage.- Parameters:
mediaPackageId- id of the media package to be removeddeletionDate- the deletion date to set- Throws:
SearchServiceDatabaseException- if exception occursNotFoundException- if media package with specified id is not foundUnauthorizedException- if the current user is not authorized to perform this action
-
storeMediaPackage
void storeMediaPackage(MediaPackage mediaPackage, AccessControlList acl, Date now) throws SearchServiceDatabaseException, UnauthorizedException Store (or update) media package.- Parameters:
mediaPackage-MediaPackageto storeacl- the acl of the media packagenow- the store date- Throws:
SearchServiceDatabaseException- if exception occursUnauthorizedException- if the current user is not authorized to perform this action
-
isAvailable
Checks if a mediapackage is available.- Parameters:
mediaPackageId- The ID of theMediaPackagefor 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
-