Package org.opencastproject.workflow.api
Interface WorkflowServiceDatabase
- All Known Implementing Classes:
WorkflowServiceDatabaseImpl
public interface WorkflowServiceDatabase
API that defines persistent storage of workflows
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of events workflows have been run on.longGets the amount of workflow instances.getRunningWorkflowInstancesByMediaPackage(String mediaPackageId) Gets all workflow instances that are currently running on the mediapackage.getWorkflow(long workflowId) Gets a single workflow by its identifier.getWorkflow(long workflowId, String orgId) Gets a single workflow by its identifiergetWorkflowIndexData(int limit, int offset) Gets workflow index data for all events.getWorkflowInstances(int limit, int offset) Gets workflow instances for current organization.getWorkflowInstancesByMediaPackage(String mediaPackageId) Gets all workflow instances for a mediapackage.getWorkflowInstancesForCleanup(WorkflowInstance.WorkflowState state, Date dateCreated) Gets all workflow instances previous to the specified datebooleanmediaPackageHasActiveWorkflows(String mediaPackageId) Returns true if the media package with the given identifier currently has a workflow running on it.voidremoveFromDatabase(WorkflowInstance instance) Removes a single workflow.voidupdateInDatabase(WorkflowInstance instance) Updates a single workflow.booleanuserHasActiveWorkflows(String userId) Returns true there are still workflows running that were created by the user with the given identifier.
-
Method Details
-
getWorkflow
Gets a single workflow by its identifier.- Parameters:
workflowId- the series identifier- Returns:
- the
WorkflowInstancefor this workflow - Throws:
NotFoundException- if there is no workflow with this identifierWorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
getWorkflow
WorkflowInstance getWorkflow(long workflowId, String orgId) throws NotFoundException, WorkflowDatabaseException Gets a single workflow by its identifier- Parameters:
workflowId- the series identifier- Returns:
- the
WorkflowInstancefor this workflow - Throws:
NotFoundException- if there is no workflow with this identifierWorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
getWorkflowInstances
Gets workflow instances for current organization.- Parameters:
limit- max number of workflows to be returnedoffset- only return workflows from this point onwards- Returns:
- list of all
WorkflowInstances - Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
getWorkflowInstancesForCleanup
List<WorkflowInstance> getWorkflowInstancesForCleanup(WorkflowInstance.WorkflowState state, Date dateCreated) throws WorkflowDatabaseException Gets all workflow instances previous to the specified date- Parameters:
state- Only returns workflows currently in the given statedateCreated- Only returns workflows created prior to the given date- Returns:
- list of the
WorkflowInstances - Throws:
WorkflowDatabaseException
-
countWorkflows
Gets the amount of workflow instances.- Parameters:
state- Only counts workflows currently in the given state- Returns:
- Amount of workflow instances
- Throws:
WorkflowDatabaseException
-
getWorkflowIndexData
List<WorkflowIndexData> getWorkflowIndexData(int limit, int offset) throws WorkflowDatabaseException Gets workflow index data for all events. Selects only workflow id, state, mediapackage id and organization id- Parameters:
limit- max number of data objects to be returnedoffset- only return data from this point onwards- Returns:
- list of
WorkflowIndexDatas - Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
countMediaPackages
Returns the number of events workflows have been run on.- Returns:
- the number of latest workflows
- Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
getWorkflowInstancesByMediaPackage
List<WorkflowInstance> getWorkflowInstancesByMediaPackage(String mediaPackageId) throws WorkflowDatabaseException Gets all workflow instances for a mediapackage.- Parameters:
mediaPackageId- the media package id- Returns:
- list of all
WorkflowInstances for the given mediapackage id - Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
getRunningWorkflowInstancesByMediaPackage
List<WorkflowInstance> getRunningWorkflowInstancesByMediaPackage(String mediaPackageId) throws WorkflowDatabaseException Gets all workflow instances that are currently running on the mediapackage.- Parameters:
mediaPackageId- the mediapackage id- Returns:
- list of all
WorkflowInstances for the given mediapackage id - Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
mediaPackageHasActiveWorkflows
Returns true if the media package with the given identifier currently has a workflow running on it.- Parameters:
mediaPackageId- the media package identifier- Returns:
- true, if a workflow is running; false otherwise
- Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
userHasActiveWorkflows
Returns true there are still workflows running that were created by the user with the given identifier.- Parameters:
userId- the user identifier- Returns:
- true, if a workflow is running; false otherwise
- Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
updateInDatabase
Updates a single workflow.- Parameters:
instance- the workflow instance- Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-
removeFromDatabase
Removes a single workflow.- Parameters:
instance- the workflow instance- Throws:
WorkflowDatabaseException- if there is a problem communicating with the underlying data store
-