Interface IndexService
- All Known Implementing Classes:
IndexServiceImpl
public interface IndexService
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enum -
Method Summary
Modifier and TypeMethodDescriptioncreateEvent(javax.servlet.http.HttpServletRequest request) Creates a new event based on a request.createEvent(EventHttpServletRequest eventHttpServletRequest) Create a new event using aEventHttpServletRequest.createSeries(org.json.simple.JSONObject metadata) Create a new series.createSeries(MetadataList metadataList, Map<String, String> options, com.entwinemedia.fn.data.Opt<AccessControlList> optAcl, com.entwinemedia.fn.data.Opt<Long> optThemeId) Create a series from a set of metadata and options.com.entwinemedia.fn.data.Opt<Event> getEvent(String id, ElasticsearchIndex index) Get a single eventgetEventMediapackage(Event event) getEventSource(Event event) getEventWorkflowProperties(List<String> eventIds) voidremoveCatalogByFlavor(Event event, MediaPackageElementFlavor flavor) Remove catalogs from the event with the given flavor.voidremoveCatalogByFlavor(Series series, MediaPackageElementFlavor flavor) Remove a catalog from the series that matches the given flavor.booleanremoveEvent(String id) Removes an event.removeEvent(Event event, String retractWorkflowId) Removes an event and retracts it if necessary.voidremoveSeries(String id) Remove a series.updateAllEventMetadata(String id, String metadataJSON, ElasticsearchIndex index) Update the event metadata in all available catalogs.updateAllSeriesMetadata(String id, String metadataJSON, ElasticsearchIndex index) Update the series metadata in all available catalogs.updateAllSeriesMetadata(String id, MetadataList metadataList, ElasticsearchIndex index) Update the series metadata in all available catalogs by providing a completeMetadataListvoidupdateCommentCatalog(Event event, List<EventComment> comments) updateEventAcl(String id, AccessControlList acl, ElasticsearchIndex index) Update the event'sAccessControlList.updateEventAssets(MediaPackage mp, javax.servlet.http.HttpServletRequest request) Create or Update an existing event asset.updateEventMetadata(String id, MetadataList metadataList, ElasticsearchIndex index) Update an event's metadata using aMetadataList
-
Method Details
-
getEvent
com.entwinemedia.fn.data.Opt<Event> getEvent(String id, ElasticsearchIndex index) throws SearchIndexException Get a single event- Parameters:
id- the mediapackage idindex- The index to get the event from.- Returns:
- an event or none if not found wrapped in an option
- Throws:
SearchIndexException- Thrown if the index cannot be read
-
createEvent
String createEvent(javax.servlet.http.HttpServletRequest request) throws IndexServiceException, IllegalArgumentException, UnsupportedAssetException Creates a new event based on a request.- Parameters:
request- The request containing the data to create the event.- Returns:
- The event's id (or a comma seperated list of event ids if it was a group of events)
- Throws:
IndexServiceException- Thrown if there was an internal server error while creating the event.IllegalArgumentException- Thrown if the provided request was inappropriate.UnsupportedAssetException- Thrown if the provided asset file type is not accepted.
-
createEvent
String createEvent(EventHttpServletRequest eventHttpServletRequest) throws ParseException, IOException, MediaPackageException, IngestException, NotFoundException, SchedulerException, UnauthorizedException Create a new event using aEventHttpServletRequest.- Parameters:
eventHttpServletRequest- TheEventHttpServletRequestcontaining all of the necessary information to create a new event.- Returns:
- The id or ids created by the
EventHttpServletRequest. - Throws:
ParseException- Thrown if unable to parse the start and end UTC date and time.IOException- Thrown if unable to update the event's DublinCoreCatalogMediaPackageException- Thrown if unable to update the event'sMediaPackageIngestException- Thrown if unable to update the ingest service with the new Event.NotFoundException- Thrown if the specified workflow definition cannot be found.SchedulerException- Thrown if unable to schedule the new event.UnauthorizedException- Thrown if the current user is unable to create the new event.
-
removeEvent
IndexService.EventRemovalResult removeEvent(Event event, String retractWorkflowId) throws UnauthorizedException, WorkflowDatabaseException, NotFoundException Removes an event and retracts it if necessary.- Parameters:
event- The event to remove.retractWorkflowId- The id of the workflow to use to retract the event if necessary.- Returns:
- A result which tells if the event was removed, removal failed, or the event is being retracted and will be removed later.
- Throws:
UnauthorizedException- Thrown if the action is unauthorizedWorkflowDatabaseException- Thrown if the workflow database is not reachable. This may be a temporary problem.NotFoundException- If the configured retract workflow cannot be found. This is most likely a configuration issue.
-
removeEvent
Removes an event.- Parameters:
id- The id for the event to remove.- Returns:
- true if the event was found and removed.
- Throws:
NotFoundException- Thrown if the group was not foundUnauthorizedException- Thrown if the action is unauthorized
-
updateEventAssets
String updateEventAssets(MediaPackage mp, javax.servlet.http.HttpServletRequest request) throws ParseException, IOException, MediaPackageException, NotFoundException, UnauthorizedException, IndexServiceException, UnsupportedAssetException Create or Update an existing event asset. The request contains a JSON describing asset type, flavor, subflavor, the mpId, a workflow description id to initiate on the event, and the asset file streams in a multipart form. Existing type-flavor matches are updated, otherwise the asset is added.- Parameters:
mp- The mediapackage to updaterequest- The http servlet request containing metadata, workflow id, and file streams- Returns:
- the workflow instance id that was started
- Throws:
ParseException- Thrown if unable to parse the start and end UTC date and time.IOException- Thrown if unable to update the event's DublinCoreCatalogMediaPackageException- Thrown if unable to update the event'sMediaPackageNotFoundException- Thrown if the specified workflow definition cannot be found.UnauthorizedException- Thrown if the current user is unable to create the new event.IndexServiceException- Thrown if the update assets workflow cannot be startedUnsupportedAssetException- Thrown if the provided asset file type is not accepted.
-
updateEventMetadata
MetadataList updateEventMetadata(String id, MetadataList metadataList, ElasticsearchIndex index) throws IndexServiceException, SearchIndexException, NotFoundException, UnauthorizedException Update an event's metadata using aMetadataList- Parameters:
id- The id of the event.metadataList- TheMetadataListwith the new metadata.index- The index used to process this update.- Returns:
- The
MetadataListwith the updated fields. - Throws:
IndexServiceException- Thrown if unable to update the event with the index.SearchIndexException- Thrown if there was a problem getting the event.NotFoundException- Thrown if unable to find the event.UnauthorizedException- Thrown if the current user is unable to edit the event.
-
updateAllEventMetadata
MetadataList updateAllEventMetadata(String id, String metadataJSON, ElasticsearchIndex index) throws IllegalArgumentException, IndexServiceException, SearchIndexException, NotFoundException, UnauthorizedException Update the event metadata in all available catalogs.- Parameters:
id- The id of the event to update.metadataJSON- The metadata to update in json format.index- The index to update the event in.- Returns:
- A metadata list of the updated fields.
- Throws:
IllegalArgumentException- Thrown if the metadata was not formatted correctly.IndexServiceException- Thrown if there was an error updating the event.SearchIndexException- Thrown if there was an error searching the search index.NotFoundException- Thrown if theEventcould not be found.UnauthorizedException- Thrown if the current user is unable to update the event.
-
removeCatalogByFlavor
void removeCatalogByFlavor(Event event, MediaPackageElementFlavor flavor) throws IndexServiceException, NotFoundException, UnauthorizedException Remove catalogs from the event with the given flavor.- Parameters:
event- The event who will have the catalog removed.flavor- The flavor to use to find the catalogs.- Throws:
IndexServiceException- Thrown if there was a problem getting the catalog for the event.NotFoundException- Thrown if unable to find a catalog that matches the flavor.UnauthorizedException- Thrown if the action is unauthorized.
-
updateEventAcl
AccessControlList updateEventAcl(String id, AccessControlList acl, ElasticsearchIndex index) throws IllegalArgumentException, IndexServiceException, SearchIndexException, NotFoundException, UnauthorizedException Update the event'sAccessControlList.- Parameters:
id- The id of the event to update.acl- TheAccessControlListthat this event will get updated with.index- The index to update the event in.- Returns:
- The updated
AccessControlList. - Throws:
IllegalArgumentException- Thrown if the event is currently processing as a workflow so unable to update the ACL as we may have already distributed it.IndexServiceException- Thrown if there was a problem updating the ACL for an event.SearchIndexException- Thrown if there was an error searching the search index.NotFoundException- Thrown if the event cannot be found to update.UnauthorizedException- Thrown if the action is unauthorized.
-
getEventMediapackage
- Throws:
IndexServiceException
-
getEventSource
-
updateCommentCatalog
- Throws:
Exception
-
getMetadataListWithAllSeriesCatalogUIAdapters
MetadataList getMetadataListWithAllSeriesCatalogUIAdapters() -
getMetadataListWithAllEventCatalogUIAdapters
MetadataList getMetadataListWithAllEventCatalogUIAdapters() -
getEventCatalogUIAdapters
List<EventCatalogUIAdapter> getEventCatalogUIAdapters()- Returns:
- A
ListofEventCatalogUIAdapterthat provide the metadata to the front end.
-
getExtendedEventCatalogUIAdapters
List<EventCatalogUIAdapter> getExtendedEventCatalogUIAdapters()- Returns:
- A
Listof extendedEventCatalogUIAdapterthat provide the metadata to the front end. Does not contain the commonEventCatalogUIAdapter.
-
getCommonEventCatalogUIAdapter
EventCatalogUIAdapter getCommonEventCatalogUIAdapter()- Returns:
- the common
EventCatalogUIAdapter
-
createSeries
String createSeries(org.json.simple.JSONObject metadata) throws IllegalArgumentException, IndexServiceException, UnauthorizedException Create a new series.- Parameters:
metadata- The json metadata to create the new series.- Returns:
- The series id.
- Throws:
IllegalArgumentException- Thrown if the metadata is incomplete or malformed.IndexServiceException- Thrown if there are issues with processing the request.UnauthorizedException- Thrown if the user cannot create a new series.
-
createSeries
String createSeries(MetadataList metadataList, Map<String, String> options, com.entwinemedia.fn.data.Opt<AccessControlList> optAcl, com.entwinemedia.fn.data.Opt<Long> optThemeId) throws IndexServiceExceptionCreate a series from a set of metadata and options.- Parameters:
metadataList- The metadata for the seriesoptions- Options for the seriesoptAcl- ACLs for the seriesoptThemeId- Themes for the series- Returns:
- The series id.
- Throws:
IndexServiceException- Thrown if there are issues with processing the request.
-
removeSeries
Remove a series.- Parameters:
id- The id of the series to remove.- Throws:
NotFoundException- Thrown if the series is not foundSeriesException- Thrown if an error removing the seriesUnauthorizedException- Thrown if the activity is unauthorized
-
getCommonSeriesCatalogUIAdapter
SeriesCatalogUIAdapter getCommonSeriesCatalogUIAdapter()- Returns:
- the common
SeriesCatalogUIAdapter
-
getSeriesCatalogUIAdapters
List<SeriesCatalogUIAdapter> getSeriesCatalogUIAdapters()- Returns:
- A
ListofSeriesCatalogUIAdapterthat provide the metadata to the front end.
-
updateAllSeriesMetadata
MetadataList updateAllSeriesMetadata(String id, String metadataJSON, ElasticsearchIndex index) throws IllegalArgumentException, IndexServiceException, NotFoundException, UnauthorizedException Update the series metadata in all available catalogs.- Parameters:
id- The id of the series to update.metadataJSON- The metadata to update in json format.index- The index to update the series in.- Returns:
- A metadata list of the updated fields.
- Throws:
IllegalArgumentException- Thrown if the metadata was not formatted correctly.IndexServiceException- Thrown if there was an error updating the event.NotFoundException- Thrown if theEventcould not be found.UnauthorizedException- Thrown if the current user is unable to update the event.
-
updateAllSeriesMetadata
MetadataList updateAllSeriesMetadata(String id, MetadataList metadataList, ElasticsearchIndex index) throws IndexServiceException, NotFoundException, UnauthorizedException Update the series metadata in all available catalogs by providing a completeMetadataList- Parameters:
id- The id of the seriesmetadataList- The completeMetadataListindex- The index that will be used to find the series.- Returns:
- The updated
MetadataList - Throws:
IndexServiceException- Thrown if unable to query the index for the series.NotFoundException- Thrown if unable to find the series to update the metadata for.UnauthorizedException- Thrown if the user is unable to update the series.
-
removeCatalogByFlavor
void removeCatalogByFlavor(Series series, MediaPackageElementFlavor flavor) throws IndexServiceException, NotFoundException Remove a catalog from the series that matches the given flavor.- Parameters:
series- The series to remove the catalog from.flavor- The flavor that will match the catalog.- Throws:
IndexServiceException- Thrown if there was an error reading the given event.NotFoundException- Thrown if the catalog cannot be found.
-
getEventWorkflowProperties
-