Interface LifeCycleService
- All Known Implementing Classes:
LifeCycleServiceImpl
public interface LifeCycleService
-
Method Summary
Modifier and TypeMethodDescriptionbooleancheckValidity(LifeCyclePolicy policy) Checks if the given policy has all required fields filled increateLifeCyclePolicy(LifeCyclePolicy policy) Creates a single life cycle policy in the database.Creates a new life cycle task in the databasevoidDelete all policies created from configuration files from the database.booleanDeletes a life cycle policy from the databasebooleanDeletes a life cycle task from the databasefilterForEvents(Map<String, Map<String, EventSearchQueryField<String>>> filters) Get a list of *all* events based on a set of filters.filterForEvents(Map<String, Map<String, EventSearchQueryField<String>>> filters, int limit, int offset) Get a list of events based on a set of filters.Get currently active life cycle policiesgetLifeCyclePolicies(int limit, int offset, SortCriterion sortCriterion) Get multiple life cycle policies from the databaselongGet the total number of policiesReturns a life cycle policy from the database by its idgetLifeCyclePolicyById(String id, String orgId) Returns a life cycle policy from the database by its idReturns a life cycle task from the database by its idgetLifeCycleTaskByTargetId(String targetId) Returns a life cycle task from the database by its target identifiergetLifeCycleTasksWithStatus(Status status) Get multiple life cycle tasks based on their statusbooleanupdateLifeCyclePolicy(LifeCyclePolicy policy) Updates a single life cycle policy in the database.booleanUpdates a life cycle task
-
Method Details
-
getLifeCyclePolicyById
LifeCyclePolicy getLifeCyclePolicyById(String id) throws NotFoundException, LifeCycleServiceException, UnauthorizedException Returns a life cycle policy from the database by its id- Parameters:
id- life cycle policy id- Returns:
- The
LifeCyclePolicybelonging to the id - Throws:
NotFoundException- If no life cycle policy with the given id could be foundLifeCycleServiceException- If something went wrong in the database serviceUnauthorizedException- If the user does not have read access for the life cycle policy
-
getLifeCyclePolicyById
LifeCyclePolicy getLifeCyclePolicyById(String id, String orgId) throws NotFoundException, LifeCycleServiceException, UnauthorizedException Returns a life cycle policy from the database by its id- Parameters:
id- life cycle policy idorgId- life cycle policy organization- Returns:
- The
LifeCyclePolicybelonging to the id - Throws:
NotFoundException- If no life cycle policy with the given id could be foundLifeCycleServiceException- If something went wrong in the database serviceUnauthorizedException- If the user does not have read access for the life cycle policy
-
getLifeCyclePoliciesTotal
Get the total number of policies- Returns:
- the total number of policies
- Throws:
LifeCycleServiceException- If something went wrong in the database service
-
getLifeCyclePolicies
List<LifeCyclePolicy> getLifeCyclePolicies(int limit, int offset, SortCriterion sortCriterion) throws LifeCycleServiceException Get multiple life cycle policies from the database- Parameters:
limit- The maximum amount of life cycle policies to get with one request.offset- The index of the first result to return.sortCriterion- In what manner results should be sorted- Returns:
- A list of
LifeCyclePolicys - Throws:
LifeCycleServiceException- If something went wrong in the database service
-
getActiveLifeCyclePolicies
Get currently active life cycle policies- Returns:
- A list of
LifeCyclePolicys - Throws:
LifeCycleServiceException- If something went wrong in the database service
-
createLifeCyclePolicy
LifeCyclePolicy createLifeCyclePolicy(LifeCyclePolicy policy) throws LifeCycleServiceException, UnauthorizedException Creates a single life cycle policy in the database.- Parameters:
policy- TheLifeCyclePolicyto create- Returns:
- The created
LifeCyclePolicy - Throws:
LifeCycleServiceException- If something went wrong in the database serviceUnauthorizedException- If the user does not have write access for an existing life cycle policy
-
updateLifeCyclePolicy
boolean updateLifeCyclePolicy(LifeCyclePolicy policy) throws NotFoundException, LifeCycleServiceException, UnauthorizedException, IllegalArgumentException Updates a single life cycle policy in the database.- Parameters:
policy- TheLifeCyclePolicyto create or update with- Returns:
- The updated
LifeCyclePolicy - Throws:
NotFoundException- If no life cycle policy with the given id could be foundLifeCycleServiceException- If something went wrong in the database serviceUnauthorizedException- If the user does not have write access for an existing life cycle policyIllegalArgumentException
-
deleteLifeCyclePolicy
boolean deleteLifeCyclePolicy(String id) throws NotFoundException, LifeCycleServiceException, UnauthorizedException Deletes a life cycle policy from the database- Parameters:
id- The life cycle policy identifier- Returns:
- The removed
LifeCyclePolicy - Throws:
NotFoundException- If no life cycle policy with the given id could be foundLifeCycleServiceException- If something went wrong in the database serviceUnauthorizedException- If the user does not have write access for the life cycle policy
-
deleteAllLifeCyclePoliciesCreatedByConfig
Delete all policies created from configuration files from the database. Only to be called as admin from the policy scanner.- Parameters:
orgId-- Throws:
LifeCycleServiceException- If something went wrong in the database service
-
getLifeCycleTaskById
Returns a life cycle task from the database by its id- Parameters:
id- life cycle task id- Returns:
- The
LifeCyclePolicybelonging to the id - Throws:
NotFoundException- If no life cycle task with the given id could be foundLifeCycleServiceException- If something went wrong in the database service
-
getLifeCycleTaskByTargetId
LifeCycleTask getLifeCycleTaskByTargetId(String targetId) throws NotFoundException, LifeCycleServiceException Returns a life cycle task from the database by its target identifier- Parameters:
targetId- the id of the entity the task will act on- Returns:
- The
LifeCyclePolicybelonging to the id - Throws:
NotFoundException- If no life cycle task with the given id could be foundLifeCycleServiceException- If something went wrong in the database service
-
getLifeCycleTasksWithStatus
Get multiple life cycle tasks based on their status- Parameters:
status- The state the tasks should be in- Returns:
- A list of
LifeCycleTasks - Throws:
LifeCycleServiceException- If something went wrong in the database service
-
createLifeCycleTask
Creates a new life cycle task in the database- Parameters:
task- TheLifeCycleTaskto create- Returns:
- The created
LifeCycleTask - Throws:
LifeCycleServiceException- If something went wrong in the database service
-
updateLifeCycleTask
boolean updateLifeCycleTask(LifeCycleTask task) throws NotFoundException, LifeCycleServiceException, UnauthorizedException, IllegalArgumentException Updates a life cycle task- Parameters:
task- TheLifeCycleTaskto create or update with- Returns:
- The updated
LifeCycleTask - Throws:
NotFoundException- If no life cycle task with the given id could be foundLifeCycleServiceException- If something went wrong in the database serviceUnauthorizedException- If the user does not have write access for an existing life cycle taskIllegalArgumentException
-
deleteLifeCycleTask
Deletes a life cycle task from the database- Parameters:
id- The life cycle task identifier- Returns:
- The removed
LifeCycleTask - Throws:
NotFoundException- If no life cycle task with the given id could be foundLifeCycleServiceException- If something went wrong in the database service
-
checkValidity
Checks if the given policy has all required fields filled in- Parameters:
policy- The lifecycle policy to be checked- Returns:
- True if the policy fulfills the criteria set by the function, else false
-
filterForEvents
List<Event> filterForEvents(Map<String, Map<String, throws SearchIndexException, NotFoundExceptionEventSearchQueryField<String>>> filters) Get a list of *all* events based on a set of filters. Currently only runs on metadata. Events are returned from the index.- Parameters:
filters- Key value pairs that the events must match.- Returns:
- The list of all matching events
- Throws:
SearchIndexException- If something went wrong in the index serviceNotFoundException- If a targetFilters object contains a metadata catalog flavor unknown to Opencast
-
filterForEvents
List<Event> filterForEvents(Map<String, Map<String, throws SearchIndexException, NotFoundExceptionEventSearchQueryField<String>>> filters, int limit, int offset) Get a list of events based on a set of filters. Currently only runs on metadata. Events are returned from the index.- Parameters:
filters- Key value pairs that the events must match.- Returns:
- The list of events
- Throws:
SearchIndexException- If something went wrong in the index serviceNotFoundException- If a targetFilters object contains a metadata catalog flavor unknown to Opencast
-