Package org.opencastproject.series.impl
Class SeriesServiceImpl
java.lang.Object
org.opencastproject.elasticsearch.index.rebuild.AbstractIndexProducer
org.opencastproject.series.impl.SeriesServiceImpl
- All Implemented Interfaces:
IndexProducer,SeriesService
Implements
SeriesService. Uses SeriesServiceDatabase for permanent storage and
ElasticsearchIndex for searching.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OrganizationDirectoryServiceThe organization directoryprotected SeriesServiceDatabasePersistent storageprotected SecurityServiceThe security serviceFields inherited from interface org.opencastproject.series.api.SeriesService
JOB_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) Activates Series Service.voidaddMessageHandler(SeriesUpdateHandler handler) OSGi callbacks for settings and removing handlers.voiddeleteSeries(String seriesID) Removes seriesbooleandeleteSeriesElement(String seriesId, String type) Deletes an element from a series.voiddeleteSeriesProperty(String seriesID, String propertyName) static booleanDefine equality on DublinCoreCatalogs.static booleanDefine equality on AccessControlLists.getAllForAdministrativeRead(Date from, Optional<Date> to, int limit) Returns all series (including deleted ones!)Returns Dublin core representing series by series ID.getSeriesAccessControl(String seriesID) Returns access control rules for series with given ID.intcom.entwinemedia.fn.data.Opt<byte[]> getSeriesElementData(String seriesId, String type) Returns the element data of the series with the given type.getSeriesElements(String seriesId) Returns all the elements of a series in a map.getSeriesProperties(String seriesID) Returns the properties for a series.getSeriesProperty(String seriesID, String propertyName) Get a series property.Get the service that implements IndexProducer.voidremoveMessageHandler(SeriesUpdateHandler handler) voidRe-add the data of this service to the index.voidsetAclServiceFactory(AclServiceFactory aclServiceFactory) voidOSGi callbacks for setting the Elasticsearch index.voidsetOrgDirectory(OrganizationDirectoryService orgDirectory) OSGi callback for setting the organization directory service.voidsetPersistence(SeriesServiceDatabase persistence) OSGi callback for setting persistance.voidsetSecurityService(SecurityService securityService) OSGi callback for setting the security service.booleanupdateAccessControl(String seriesId, AccessControlList accessControl) Updates access control rules for specified series.booleanupdateAccessControl(String seriesId, AccessControlList accessControl, boolean overrideEpisodeAcl) Updates access control rules for specified series.booleanupdateExtendedMetadata(String seriesId, String type, DublinCoreCatalog dc) Updates the extended metadata of a series from a Dublin Core catalog.Adds or updates series.booleanupdateSeriesElement(String seriesId, String type, byte[] data) Creates or updates an element of a series.voidupdateSeriesProperty(String seriesID, String propertyName, String propertyValue) Update a series property or create a new one if it doesn't exist.Methods inherited from class org.opencastproject.elasticsearch.index.rebuild.AbstractIndexProducer
logIndexRebuildBegin, logIndexRebuildBegin, logIndexRebuildError, logIndexRebuildError, logIndexRebuildError, logIndexRebuildProgress, logIndexRebuildProgress, logIndexRebuildProgress, logIndexRebuildProgress, logSkippingElement, logSkippingElementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opencastproject.elasticsearch.index.rebuild.IndexProducer
dataTypeSupported, getSupportedDataTypes
-
Field Details
-
persistence
Persistent storage -
securityService
The security service -
orgDirectory
The organization directory
-
-
Constructor Details
-
SeriesServiceImpl
public SeriesServiceImpl()
-
-
Method Details
-
setPersistence
OSGi callback for setting persistance. -
setSecurityService
OSGi callback for setting the security service. -
setOrgDirectory
OSGi callback for setting the organization directory service. -
addMessageHandler
OSGi callbacks for settings and removing handlers. -
removeMessageHandler
-
setElasticsearchIndex
OSGi callbacks for setting the Elasticsearch index. -
setAclServiceFactory
-
activate
Activates Series Service. Checks whether we are using synchronous or asynchronous indexing. If asynchronous is used, Executor service is set. If index is empty, persistent storage is queried if it contains any series. If that is the case, series are retrieved and indexed.- Throws:
Exception
-
updateSeries
public DublinCoreCatalog updateSeries(DublinCoreCatalog dc) throws SeriesException, UnauthorizedException Description copied from interface:SeriesServiceAdds or updates series. IllegalArgumentException is thrown if dc argument is null.- Specified by:
updateSeriesin interfaceSeriesService- Parameters:
dc-DublinCoreCatalogrepresenting series- Returns:
- Dublin Core catalog of newly created series or null if series Dublin Core was just updated
- Throws:
SeriesException- if adding or updating failsUnauthorizedException- if the current user is not authorized to perform this action
-
updateAccessControl
public boolean updateAccessControl(String seriesId, AccessControlList accessControl) throws NotFoundException, SeriesException Description copied from interface:SeriesServiceUpdates access control rules for specified series. Not specifying series ID or trying to update series with null value will throw IllegalArgumentException.- Specified by:
updateAccessControlin interfaceSeriesService- Parameters:
seriesId- series to be updatedaccessControl-AccessControlListdefining access control rules- Returns:
- true if ACL was updated and false it if was created
- Throws:
NotFoundException- if series with given ID cannot be foundSeriesException- if exception occurred
-
updateAccessControl
public boolean updateAccessControl(String seriesId, AccessControlList accessControl, boolean overrideEpisodeAcl) throws NotFoundException, SeriesException Description copied from interface:SeriesServiceUpdates access control rules for specified series. Allows to set the override parameter that controls whether the episode ACLs of the contained media packages will be removed on update. Not specifying series ID or trying to update series with null value will throw IllegalArgumentException.- Specified by:
updateAccessControlin interfaceSeriesService- Parameters:
seriesId- series to be updatedaccessControl-AccessControlListdefining access control rulesoverrideEpisodeAcl- Whether the new series acl should override the episode acl- Returns:
- true if ACL was updated and false it if was created
- Throws:
NotFoundException- if series with given ID cannot be foundSeriesException- if exception occurred
-
deleteSeries
Description copied from interface:SeriesServiceRemoves series- Specified by:
deleteSeriesin interfaceSeriesService- Parameters:
seriesID- ID of the series to be removed- Throws:
SeriesException- if deleting failsNotFoundException- if series with specified ID does not exist
-
getSeries
Description copied from interface:SeriesServiceReturns Dublin core representing series by series ID.- Specified by:
getSeriesin interfaceSeriesService- Parameters:
seriesID- series to be retrieved- Returns:
DublinCoreCatalogrepresenting series- Throws:
SeriesException- if retrieving failsNotFoundException
-
getAllForAdministrativeRead
public List<Series> getAllForAdministrativeRead(Date from, Optional<Date> to, int limit) throws SeriesException, UnauthorizedException Description copied from interface:SeriesServiceReturns 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.- Specified by:
getAllForAdministrativeReadin interfaceSeriesService- Throws:
SeriesExceptionUnauthorizedException
-
getSeriesAccessControl
public AccessControlList getSeriesAccessControl(String seriesID) throws NotFoundException, SeriesException Description copied from interface:SeriesServiceReturns access control rules for series with given ID.- Specified by:
getSeriesAccessControlin interfaceSeriesService- Parameters:
seriesID- ID of the series for which access control rules will be retrieved- Returns:
AccessControlListdefining access control rules- Throws:
NotFoundException- if series with given ID cannot be foundSeriesException- if exception occurred
-
getSeriesCount
- Specified by:
getSeriesCountin interfaceSeriesService- Throws:
SeriesException
-
getSeriesProperties
public Map<String,String> getSeriesProperties(String seriesID) throws SeriesException, NotFoundException, UnauthorizedException Description copied from interface:SeriesServiceReturns the properties for a series.- Specified by:
getSeriesPropertiesin interfaceSeriesService- Parameters:
seriesID- series to be retrieved- Returns:
- representing series properties
- Throws:
SeriesException- if retrieving failsNotFoundException- Thrown if the series or property cannot be found.UnauthorizedException- if the current user is not authorized to perform this action
-
getSeriesProperty
public String getSeriesProperty(String seriesID, String propertyName) throws SeriesException, NotFoundException, UnauthorizedException Description copied from interface:SeriesServiceGet a series property.- Specified by:
getSeriesPropertyin interfaceSeriesService- Parameters:
seriesID- The id of the series to get the property from.propertyName- The name of the property to retrieve- Returns:
- The string value of the property.
- Throws:
SeriesException- Thrown for all other exceptions.NotFoundException- Thrown if the series or property cannot be found.UnauthorizedException- Thrown if the user is not able to read the series' properties.
-
updateSeriesProperty
public void updateSeriesProperty(String seriesID, String propertyName, String propertyValue) throws SeriesException, NotFoundException, UnauthorizedException Description copied from interface:SeriesServiceUpdate a series property or create a new one if it doesn't exist.- Specified by:
updateSeriesPropertyin interfaceSeriesService- Parameters:
seriesID- The series to attach the property to.propertyName- The unique name of the series propertypropertyValue- The value to assign the series property- Throws:
SeriesException- Thrown for all other exceptions.NotFoundException- Thrown if the series or property cannot be found.UnauthorizedException- Thrown if the user is not able to write the series' properties.
-
deleteSeriesProperty
public void deleteSeriesProperty(String seriesID, String propertyName) throws SeriesException, NotFoundException, UnauthorizedException - Specified by:
deleteSeriesPropertyin interfaceSeriesService- Parameters:
seriesID- The series to attach the property to.propertyName- The unique name of the series property- Throws:
SeriesException- Thrown for all other exceptions.NotFoundException- Thrown if the series or property cannot be found.UnauthorizedException- Thrown if the user is not able to write the series' properties.
-
equals
Define equality on DublinCoreCatalogs. Two DublinCores are considered equal if they have the same properties and if each property has the same values in the same order.Note: As long as http://opencast.jira.com/browse/MH-8759 is not fixed, the encoding scheme of values is not considered.
Implementation Note: DublinCores should not be compared by their string serialization since the ordering of properties is not defined and cannot be guaranteed between serializations.
-
equals
Define equality on AccessControlLists. Two AccessControlLists are considered equal if they contain the exact same entries no matter in which order. -
getSeriesElements
public com.entwinemedia.fn.data.Opt<Map<String,byte[]>> getSeriesElements(String seriesId) throws SeriesException Description copied from interface:SeriesServiceReturns all the elements of a series in a map. The key of the map marks the element type. If the series does not contain any elements, an empty map is returned. If the series does not exist,Opt.none()is returned.- Specified by:
getSeriesElementsin interfaceSeriesService- Parameters:
seriesId- the series identifier- Returns:
- the map of elements
- Throws:
SeriesException- if an error occurred during loading the series elements
-
getSeriesElementData
public com.entwinemedia.fn.data.Opt<byte[]> getSeriesElementData(String seriesId, String type) throws SeriesException Description copied from interface:SeriesServiceReturns the element data of the series with the given type. If the series or the element with the given type do not exist,Opt.none()is returned.- Specified by:
getSeriesElementDatain interfaceSeriesService- Parameters:
seriesId- the series identifiertype- the element type- Returns:
- the series element data
- Throws:
SeriesException- if an error occurred during loading the series element
-
updateExtendedMetadata
public boolean updateExtendedMetadata(String seriesId, String type, DublinCoreCatalog dc) throws SeriesException Description copied from interface:SeriesServiceUpdates the extended metadata of a series from a Dublin Core catalog.- Specified by:
updateExtendedMetadatain interfaceSeriesService- Parameters:
seriesId- the series identifiertype- the type of dublin core catalogdc- the dublin core catalog with extended metadata- Returns:
- true if the extended metadata could be updated
- Throws:
SeriesException- if an error occurred during updating of the extended metadata
-
updateSeriesElement
public boolean updateSeriesElement(String seriesId, String type, byte[] data) throws SeriesException Description copied from interface:SeriesServiceCreates or updates an element of a series.- Specified by:
updateSeriesElementin interfaceSeriesService- Parameters:
seriesId- the series identifiertype- the type of the elementdata- the data of the element- Returns:
- true if the element could be created or updated
- Throws:
SeriesException- if an error occurs while updating the element
-
deleteSeriesElement
Description copied from interface:SeriesServiceDeletes an element from a series.- Specified by:
deleteSeriesElementin interfaceSeriesService- Parameters:
seriesId- the series identifiertype- the element type- Returns:
- true if the element could be deleted; false if no such element/series exists
- Throws:
SeriesException- if an error occurs while deleting the element
-
repopulate
Description copied from interface:IndexProducerRe-add the data of this service to the index.- Specified by:
repopulatein interfaceIndexProducer- Parameters:
type- Limit the data added to the index. Use ALL to re-index all data.- Throws:
IndexRebuildException
-
getService
Description copied from interface:IndexProducerGet the service that implements IndexProducer.- Specified by:
getServicein interfaceIndexProducer- Returns:
- service The service that implements IndexProducer.
-