Class SchedulerServiceDatabaseImpl
java.lang.Object
org.opencastproject.scheduler.impl.persistence.SchedulerServiceDatabaseImpl
- All Implemented Interfaces:
SchedulerServiceDatabase
Implements
SchedulerServiceDatabase.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) CreatesEntityManagerFactoryusing persistence provider and properties passed via OSGi.intRetrieve the number of events.voiddeleteEvent(String mediapackageId) Removes the extended event from persistent storage.Get the event with the given mediapackage id for the current organization.Get the event with the given mediapackage id and organization.Get all events from the scheduler for the current organizations.Get the mediapackage IDs of all events scheduled on the given capture agent between the given start/end time.Retrieve all events which have a recording state and a recording last heard.getLastModified(String agentId) Get the last modification date by an agent identifierGet aMapof last modification dates of all existing capture agents.voidresetRecordingState(String mediapackageId) Nulls recording state and recording last heard of of the given media package.search(Optional<String> captureAgentId, Optional<Date> optStartsFrom, Optional<Date> optStartsTo, Optional<Date> optEndFrom, Optional<Date> optEndTo, Optional<Integer> limit) Retrieve all events matching given filter ordered by start time ascending.voidsetDBSessionFactory(DBSessionFactory dbSessionFactory) voidsetEntityManagerFactory(javax.persistence.EntityManagerFactory emf) OSGi DIvoidsetSecurityService(SecurityService securityService) OSGi DIvoidstoreEvent(String mediapackageId, String organizationId, Optional<String> captureAgentId, Optional<Date> start, Optional<Date> end, Optional<String> source, Optional<String> recordingState, Optional<Long> recordingLastHeard, Optional<String> presenters, Optional<Date> lastModifiedDate, Optional<String> checksum, Optional<Map<String, String>> workflowProperties, Optional<Map<String, String>> caProperties) Create or update an event identified by mediapackageId and organizationIdvoidtouchLastEntry(String agentId) Touches the most recent entry by updating its last modification date.
-
Field Details
-
PERSISTENCE_UNIT
JPA persistence unit name- See Also:
-
-
Constructor Details
-
SchedulerServiceDatabaseImpl
public SchedulerServiceDatabaseImpl()
-
-
Method Details
-
setEntityManagerFactory
public void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf) OSGi DI -
setSecurityService
OSGi DI -
setDBSessionFactory
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) CreatesEntityManagerFactoryusing persistence provider and properties passed via OSGi.- Parameters:
cc-
-
touchLastEntry
Description copied from interface:SchedulerServiceDatabaseTouches the most recent entry by updating its last modification date.- Specified by:
touchLastEntryin interfaceSchedulerServiceDatabase- Parameters:
agentId- the capture agent identifier- Throws:
SchedulerServiceDatabaseException- if updating of the last modified value fails
-
getLastModified
public Date getLastModified(String agentId) throws NotFoundException, SchedulerServiceDatabaseException Description copied from interface:SchedulerServiceDatabaseGet the last modification date by an agent identifier- Specified by:
getLastModifiedin interfaceSchedulerServiceDatabase- Parameters:
agentId- the capture agent identifier- Returns:
- the last modification date
- Throws:
NotFoundException- if the agent could not be foundSchedulerServiceDatabaseException- if exception occurred
-
getLastModifiedDates
Description copied from interface:SchedulerServiceDatabaseGet aMapof last modification dates of all existing capture agents.- Specified by:
getLastModifiedDatesin interfaceSchedulerServiceDatabase- Returns:
- the last modified map
- Throws:
SchedulerServiceDatabaseException- if exception occurred
-
storeEvent
public void storeEvent(String mediapackageId, String organizationId, Optional<String> captureAgentId, Optional<Date> start, Optional<Date> end, Optional<String> source, Optional<String> recordingState, Optional<Long> recordingLastHeard, Optional<String> presenters, Optional<Date> lastModifiedDate, Optional<String> checksum, Optional<Map<String, String>> workflowProperties, Optional<Map<String, throws SchedulerServiceDatabaseExceptionString>> caProperties) Description copied from interface:SchedulerServiceDatabaseCreate or update an event identified by mediapackageId and organizationId- Specified by:
storeEventin interfaceSchedulerServiceDatabase- Parameters:
mediapackageId- the mediapackage IDorganizationId- the organization ID of the organization owning the eventcaptureAgentId- the capture agent ID of the capture agent this event is scheduled onstart- the recording start timeend- the recording end timesource- the sourcerecordingState- the recording staterecordingLastHeard- the recording last heardpresenters- the presenterslastModifiedDate- the last modified datechecksum- the checksumworkflowProperties- the workflow propertiescaProperties- the capture agent properties- Throws:
SchedulerServiceDatabaseException- in case the event cannot be stored.
-
getEvents
public List<String> getEvents(String captureAgentId, Date start, Date end, int separationMillis) throws SchedulerServiceDatabaseException Description copied from interface:SchedulerServiceDatabaseGet the mediapackage IDs of all events scheduled on the given capture agent between the given start/end time. Events which are only partially contained within the given interval are also included in the result set. The results are ordered by start date ascending.- Specified by:
getEventsin interfaceSchedulerServiceDatabase- Parameters:
captureAgentId- the capture agent ID of the capture agent to checkstart- the start date of the interval to checkend- the end date of the interval to checkseparationMillis- number of milliseconds to prepend and append to given interval- Returns:
- The mediapackage IDs of the events between start (inclusive) and end (inclusive) scheduled on the given capture agent.
- Throws:
SchedulerServiceDatabaseException- If the database cannot be queried.
-
search
public List<ExtendedEventDto> search(Optional<String> captureAgentId, Optional<Date> optStartsFrom, Optional<Date> optStartsTo, Optional<Date> optEndFrom, Optional<Date> optEndTo, Optional<Integer> limit) throws SchedulerServiceDatabaseException Description copied from interface:SchedulerServiceDatabaseRetrieve all events matching given filter ordered by start time ascending.- Specified by:
searchin interfaceSchedulerServiceDatabase- Parameters:
captureAgentId- the capture agent id filteroptStartsFrom- the start from date filteroptStartsTo- the start to date filteroptEndFrom- the end from date filteroptEndTo- the end to date filterlimit- the maximum number of results to retrieve- Returns:
- The events matching the given filter
- Throws:
SchedulerServiceDatabaseException- If the database cannot be queried.
-
getKnownRecordings
Description copied from interface:SchedulerServiceDatabaseRetrieve all events which have a recording state and a recording last heard.- Specified by:
getKnownRecordingsin interfaceSchedulerServiceDatabase- Returns:
- all events which have a recording state and a recording last heard
- Throws:
SchedulerServiceDatabaseException- If the database cannot be queried.
-
deleteEvent
public void deleteEvent(String mediapackageId) throws NotFoundException, SchedulerServiceDatabaseException Description copied from interface:SchedulerServiceDatabaseRemoves the extended event from persistent storage.- Specified by:
deleteEventin interfaceSchedulerServiceDatabase- Parameters:
mediapackageId- ID of event to be removed- Throws:
NotFoundException- if there is no element with specified IDSchedulerServiceDatabaseException- if exception occurred
-
getEvents
Description copied from interface:SchedulerServiceDatabaseGet all events from the scheduler for the current organizations.- Specified by:
getEventsin interfaceSchedulerServiceDatabase- Returns:
- The list of events.
- Throws:
SchedulerServiceDatabaseException- If the database cannot be queried.
-
getEvent
public Optional<ExtendedEventDto> getEvent(String mediapackageId, String orgId) throws SchedulerServiceDatabaseException Description copied from interface:SchedulerServiceDatabaseGet the event with the given mediapackage id and organization.- Specified by:
getEventin interfaceSchedulerServiceDatabase- Parameters:
mediapackageId- The mediapackage id to look fororgId- The organization id to look for- Returns:
- The event or nothing, if the event couldn't be found.
- Throws:
SchedulerServiceDatabaseException- If the database cannot be queried.
-
getEvent
public Optional<ExtendedEventDto> getEvent(String mediapackageId) throws SchedulerServiceDatabaseException Description copied from interface:SchedulerServiceDatabaseGet the event with the given mediapackage id for the current organization.- Specified by:
getEventin interfaceSchedulerServiceDatabase- Parameters:
mediapackageId- The mediapackage id to look for- Returns:
- The event or nothing, if the event couldn't be found.
- Throws:
SchedulerServiceDatabaseException- If the database cannot be queried.
-
resetRecordingState
public void resetRecordingState(String mediapackageId) throws NotFoundException, SchedulerServiceDatabaseException Description copied from interface:SchedulerServiceDatabaseNulls recording state and recording last heard of of the given media package.- Specified by:
resetRecordingStatein interfaceSchedulerServiceDatabase- Parameters:
mediapackageId- The mediapackage id to look for- Throws:
NotFoundException- if there is no element with specified IDSchedulerServiceDatabaseException- If the database cannot be queried.
-
countEvents
Description copied from interface:SchedulerServiceDatabaseRetrieve the number of events.- Specified by:
countEventsin interfaceSchedulerServiceDatabase- Returns:
- The number of events.
- Throws:
SchedulerServiceDatabaseException- If the database cannot be queried.
-