Class IndexServiceImpl
java.lang.Object
org.opencastproject.index.service.impl.IndexServiceImpl
- All Implemented Interfaces:
IndexService
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencastproject.index.service.api.IndexService
IndexService.EventRemovalResult, IndexService.Source, IndexService.SourceType -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) voidaddCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter) OSGi callback to addEventCatalogUIAdapterinstance.voidaddCatalogUIAdapter(SeriesCatalogUIAdapter catalogUIAdapter) OSGi callback to addSeriesCatalogUIAdapterinstance.createEvent(javax.servlet.http.HttpServletRequest request) Creates a new event based on a request.createEvent(org.json.simple.JSONObject metadataJson, MediaPackage mp) 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.voiddeactivate(org.osgi.service.component.ComponentContext cc) getCommonEventCatalogUIAdapter(String organization) getCommonSeriesCatalogUIAdapter(String organization) com.entwinemedia.fn.data.Opt<Event> getEvent(String id, ElasticsearchIndex index) Get a single eventgetEventCatalogUIAdapters(String organization) getEventMediapackage(Event event) getEventSource(Event event) Determines in a very basic way what kind of source the event isgetEventWorkflowProperties(List<String> eventIds) getSeriesCatalogUIAdapters(String organization) getTechnicalPresenters(DublinCoreMetadataCollection eventMetadata) Processes the combined usernames and free text entries of the presenters (creator) field into a list of presenters using the full names of the users if available and adds the usernames to a set of technical presenters.booleanisWorkflowActive(String workflowState) 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.voidremoveCatalogUIAdapter(EventCatalogUIAdapter catalogUIAdapter) OSGi callback to removeEventCatalogUIAdapterinstance.voidremoveCatalogUIAdapter(SeriesCatalogUIAdapter catalogUIAdapter) OSGi callback to removeSeriesCatalogUIAdapterinstance.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.voidsetAclServiceFactory(AclServiceFactory aclServiceFactory) OSGi DI.voidsetAssetManager(AssetManager assetManager) OSGi DI.voidsetAuthorizationService(AuthorizationService authorizationService) OSGi DI.voidsetCaptureAgentStateService(CaptureAgentStateService captureAgentStateService) OSGi DI.voidsetElasticsearchIndex(ElasticsearchIndex elasticsearchIndex) voidsetEventCommentService(EventCommentService eventCommentService) OSGi callback for the event comment service.voidsetIngestService(IngestService ingestService) OSGi DI.voidsetListProvidersService(ListProvidersService listProvidersService) OSGi DI.voidsetSchedulerService(SchedulerService schedulerService) OSGi DI.voidsetSecurityService(SecurityService securityService) OSGi DI.voidsetSeriesService(SeriesService seriesService) OSGi DI.voidsetUserDirectoryService(UserDirectoryService userDirectoryService) OSGi DI.voidsetWorkflowService(WorkflowService workflowService) OSGi DI.voidsetWorkspace(Workspace workspace) OSGi DI.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 aMetadataListprotected MediaPackageupdateMpAssetFlavor(List<String> assetList, MediaPackage mp, org.json.simple.JSONArray assetMetadata) Update the flavor of newly added asset with the passed metadata
-
Field Details
-
THEME_PROPERTY_NAME
- See Also:
-
-
Constructor Details
-
IndexServiceImpl
public IndexServiceImpl()
-
-
Method Details
-
setAclServiceFactory
OSGi DI.- Parameters:
aclServiceFactory- the factory to set
-
setElasticsearchIndex
-
setAuthorizationService
OSGi DI.- Parameters:
authorizationService- the service to set
-
setCaptureAgentStateService
OSGi DI.- Parameters:
captureAgentStateService- the service to set
-
setEventCommentService
OSGi callback for the event comment service.- Parameters:
eventCommentService- the service to set
-
addCatalogUIAdapter
OSGi callback to addEventCatalogUIAdapterinstance.- Parameters:
catalogUIAdapter- the adapter to add
-
removeCatalogUIAdapter
OSGi callback to removeEventCatalogUIAdapterinstance.- Parameters:
catalogUIAdapter- the adapter to remove
-
addCatalogUIAdapter
OSGi callback to addSeriesCatalogUIAdapterinstance.- Parameters:
catalogUIAdapter- the adapter to add
-
removeCatalogUIAdapter
OSGi callback to removeSeriesCatalogUIAdapterinstance.- Parameters:
catalogUIAdapter- the adapter to remove
-
setIngestService
OSGi DI.- Parameters:
ingestService- the service to set
-
setListProvidersService
OSGi DI.- Parameters:
listProvidersService- the service to set
-
setAssetManager
OSGi DI.- Parameters:
assetManager- the manager to set
-
setSchedulerService
OSGi DI.- Parameters:
schedulerService- the service to set
-
setSecurityService
OSGi DI.- Parameters:
securityService- the service to set
-
setSeriesService
OSGi DI.- Parameters:
seriesService- the service to set
-
setWorkflowService
OSGi DI.- Parameters:
workflowService- the service to set
-
setWorkspace
OSGi DI.- Parameters:
workspace- the workspace to set
-
setUserDirectoryService
OSGi DI.- Parameters:
userDirectoryService- the service to set
-
getAclService
- Returns:
- the acl service
-
getEventCatalogUIAdapters
-
getSeriesCatalogUIAdapters
- Parameters:
organization- The organization to filter the results with.- Returns:
- A
ListofSeriesCatalogUIAdapterthat provide the metadata to the front end.
-
getCommonEventCatalogUIAdapter
-
getCommonSeriesCatalogUIAdapter
-
getEventCatalogUIAdapters
- Specified by:
getEventCatalogUIAdaptersin interfaceIndexService- Returns:
- A
ListofEventCatalogUIAdapterthat provide the metadata to the front end.
-
getExtendedEventCatalogUIAdapters
- Specified by:
getExtendedEventCatalogUIAdaptersin interfaceIndexService- Returns:
- A
Listof extendedEventCatalogUIAdapterthat provide the metadata to the front end. Does not contain the commonEventCatalogUIAdapter.
-
getSeriesCatalogUIAdapters
- Specified by:
getSeriesCatalogUIAdaptersin interfaceIndexService- Returns:
- A
ListofSeriesCatalogUIAdapterthat provide the metadata to the front end.
-
getCommonEventCatalogUIAdapter
- Specified by:
getCommonEventCatalogUIAdapterin interfaceIndexService- Returns:
- the common
EventCatalogUIAdapter
-
getCommonSeriesCatalogUIAdapter
- Specified by:
getCommonSeriesCatalogUIAdapterin interfaceIndexService- Returns:
- the common
SeriesCatalogUIAdapter
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) -
deactivate
public void deactivate(org.osgi.service.component.ComponentContext cc) -
createEvent
public String createEvent(javax.servlet.http.HttpServletRequest request) throws IndexServiceException, UnsupportedAssetException Description copied from interface:IndexServiceCreates a new event based on a request.- Specified by:
createEventin interfaceIndexService- 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.UnsupportedAssetException- Thrown if the provided asset file type is not accepted.
-
updateEventAssets
public String updateEventAssets(MediaPackage mp, javax.servlet.http.HttpServletRequest request) throws IndexServiceException, UnsupportedAssetException Description copied from interface:IndexServiceCreate 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.- Specified by:
updateEventAssetsin interfaceIndexService- 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:
IndexServiceException- Thrown if the update assets workflow cannot be startedUnsupportedAssetException- Thrown if the provided asset file type is not accepted.
-
createEvent
public String createEvent(org.json.simple.JSONObject metadataJson, MediaPackage mp) throws ParseException, IOException, MediaPackageException, IngestException, NotFoundException, SchedulerException, UnauthorizedException -
createEvent
public String createEvent(EventHttpServletRequest eventHttpServletRequest) throws ParseException, IOException, MediaPackageException, IngestException, NotFoundException, SchedulerException, UnauthorizedException Description copied from interface:IndexServiceCreate a new event using aEventHttpServletRequest.- Specified by:
createEventin interfaceIndexService- 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.
-
updateMpAssetFlavor
protected MediaPackage updateMpAssetFlavor(List<String> assetList, MediaPackage mp, org.json.simple.JSONArray assetMetadata) Update the flavor of newly added asset with the passed metadata- Parameters:
assetList- the list of assets to updatemp- the mediapackage to updateassetMetadata- a set of mapping metadata for the asset list- Returns:
- mediapackage updated with assets
-
updateAllEventMetadata
public MetadataList updateAllEventMetadata(String id, String metadataJSON, ElasticsearchIndex index) throws IllegalArgumentException, IndexServiceException, NotFoundException, SearchIndexException, UnauthorizedException Description copied from interface:IndexServiceUpdate the event metadata in all available catalogs.- Specified by:
updateAllEventMetadatain interfaceIndexService- 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.NotFoundException- Thrown if theEventcould not be found.SearchIndexException- Thrown if there was an error searching the search index.UnauthorizedException- Thrown if the current user is unable to update the event.
-
removeCatalogByFlavor
public void removeCatalogByFlavor(Event event, MediaPackageElementFlavor flavor) throws IndexServiceException, NotFoundException, UnauthorizedException Description copied from interface:IndexServiceRemove catalogs from the event with the given flavor.- Specified by:
removeCatalogByFlavorin interfaceIndexService- 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.
-
removeCatalogByFlavor
public void removeCatalogByFlavor(Series series, MediaPackageElementFlavor flavor) throws NotFoundException, IndexServiceException Description copied from interface:IndexServiceRemove a catalog from the series that matches the given flavor.- Specified by:
removeCatalogByFlavorin interfaceIndexService- Parameters:
series- The series to remove the catalog from.flavor- The flavor that will match the catalog.- Throws:
NotFoundException- Thrown if the catalog cannot be found.IndexServiceException- Thrown if there was an error reading the given event.
-
updateEventMetadata
public MetadataList updateEventMetadata(String id, MetadataList metadataList, ElasticsearchIndex index) throws IndexServiceException, SearchIndexException, NotFoundException, UnauthorizedException Description copied from interface:IndexServiceUpdate an event's metadata using aMetadataList- Specified by:
updateEventMetadatain interfaceIndexService- 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.
-
getTechnicalPresenters
protected Tuple<List<String>,Set<String>> getTechnicalPresenters(DublinCoreMetadataCollection eventMetadata) Processes the combined usernames and free text entries of the presenters (creator) field into a list of presenters using the full names of the users if available and adds the usernames to a set of technical presenters.- Parameters:
eventMetadata- The metadata list that has the presenter (creator) field to pull the list of presenters from.- Returns:
- A
Tuplewith a list of friendly presenter names and a set of user names if available for the presenters.
-
updateEventAcl
public AccessControlList updateEventAcl(String id, AccessControlList acl, ElasticsearchIndex index) throws IllegalArgumentException, IndexServiceException, SearchIndexException, NotFoundException, UnauthorizedException Description copied from interface:IndexServiceUpdate the event'sAccessControlList.- Specified by:
updateEventAclin interfaceIndexService- 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.
-
getEventWorkflowProperties
- Specified by:
getEventWorkflowPropertiesin interfaceIndexService
-
getEvent
public com.entwinemedia.fn.data.Opt<Event> getEvent(String id, ElasticsearchIndex index) throws SearchIndexException Description copied from interface:IndexServiceGet a single event- Specified by:
getEventin interfaceIndexService- 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
-
removeEvent
public IndexService.EventRemovalResult removeEvent(Event event, String retractWorkflowId) throws UnauthorizedException, WorkflowDatabaseException, NotFoundException Description copied from interface:IndexServiceRemoves an event and retracts it if necessary.- Specified by:
removeEventin interfaceIndexService- 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
Description copied from interface:IndexServiceRemoves an event.- Specified by:
removeEventin interfaceIndexService- 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
-
getEventMediapackage
- Specified by:
getEventMediapackagein interfaceIndexService- Throws:
IndexServiceException
-
getEventSource
Determines in a very basic way what kind of source the event is- Specified by:
getEventSourcein interfaceIndexService- Parameters:
event- the event- Returns:
- the source type
-
createSeries
public String createSeries(MetadataList metadataList, Map<String, String> options, com.entwinemedia.fn.data.Opt<AccessControlList> optAcl, com.entwinemedia.fn.data.Opt<Long> optThemeId) throws IndexServiceExceptionDescription copied from interface:IndexServiceCreate a series from a set of metadata and options.- Specified by:
createSeriesin interfaceIndexService- 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.
-
createSeries
public String createSeries(org.json.simple.JSONObject metadata) throws IllegalArgumentException, IndexServiceException, UnauthorizedException Description copied from interface:IndexServiceCreate a new series.- Specified by:
createSeriesin interfaceIndexService- 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.
-
removeSeries
public void removeSeries(String id) throws NotFoundException, SeriesException, UnauthorizedException Description copied from interface:IndexServiceRemove a series.- Specified by:
removeSeriesin interfaceIndexService- 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
-
updateAllSeriesMetadata
public MetadataList updateAllSeriesMetadata(String id, String metadataJSON, ElasticsearchIndex index) throws IllegalArgumentException, IndexServiceException, NotFoundException Description copied from interface:IndexServiceUpdate the series metadata in all available catalogs.- Specified by:
updateAllSeriesMetadatain interfaceIndexService- 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.
-
updateAllSeriesMetadata
public MetadataList updateAllSeriesMetadata(String id, MetadataList metadataList, ElasticsearchIndex index) throws IndexServiceException, NotFoundException Description copied from interface:IndexServiceUpdate the series metadata in all available catalogs by providing a completeMetadataList- Specified by:
updateAllSeriesMetadatain interfaceIndexService- 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.
-
updateCommentCatalog
- Specified by:
updateCommentCatalogin interfaceIndexService- Throws:
Exception
-
getMetadataListWithAllSeriesCatalogUIAdapters
- Specified by:
getMetadataListWithAllSeriesCatalogUIAdaptersin interfaceIndexService- Returns:
- A
MetadataListwith all of the available CatalogUIAdapters emptyDublinCoreMetadataCollectionavailable
-
getMetadataListWithAllEventCatalogUIAdapters
- Specified by:
getMetadataListWithAllEventCatalogUIAdaptersin interfaceIndexService
-
isWorkflowActive
-