Class LifeCycleServiceImpl
java.lang.Object
org.opencastproject.lifecyclemanagement.impl.LifeCycleServiceImpl
- All Implemented Interfaces:
LifeCycleService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorizationServiceThe authorization serviceprotected ElasticsearchIndexprotected IndexServiceprotected LifeCycleDatabaseServicePersistent storageprotected SecurityServiceThe security service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) booleancheckValidity(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 statusvoidsetAuthorizationService(AuthorizationService authorizationService) voidvoidsetIndexService(IndexService indexService) voidsetPersistence(LifeCycleDatabaseService persistence) voidsetSecurityService(SecurityService securityService) booleanupdateLifeCyclePolicy(LifeCyclePolicy policy) Updates a single life cycle policy in the database.booleanUpdates a life cycle task
-
Field Details
-
persistence
Persistent storage -
securityService
The security service -
authorizationService
The authorization service -
index
-
indexService
-
-
Constructor Details
-
LifeCycleServiceImpl
public LifeCycleServiceImpl()
-
-
Method Details
-
setPersistence
-
setSecurityService
-
setAuthorizationService
-
setElasticSearchIndex
-
setIndexService
-
activate
- Throws:
Exception
-
getLifeCyclePolicyById
public LifeCyclePolicy getLifeCyclePolicyById(String id) throws NotFoundException, LifeCycleServiceException, UnauthorizedException Returns a life cycle policy from the database by its id- Specified by:
getLifeCyclePolicyByIdin interfaceLifeCycleService- 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- See Also:
-
getLifeCyclePolicyById
public LifeCyclePolicy getLifeCyclePolicyById(String id, String orgId) throws NotFoundException, LifeCycleServiceException, UnauthorizedException Returns a life cycle policy from the database by its id- Specified by:
getLifeCyclePolicyByIdin interfaceLifeCycleService- 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- See Also:
-
getLifeCyclePoliciesTotal
Get the total number of policies- Specified by:
getLifeCyclePoliciesTotalin interfaceLifeCycleService- Returns:
- the total number of policies
- Throws:
LifeCycleServiceException- If something went wrong in the database service- See Also:
-
getLifeCyclePolicies
public List<LifeCyclePolicy> getLifeCyclePolicies(int limit, int offset, SortCriterion sortCriterion) throws LifeCycleServiceException Get multiple life cycle policies from the database- Specified by:
getLifeCyclePoliciesin interfaceLifeCycleService- 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- See Also:
-
getActiveLifeCyclePolicies
Get currently active life cycle policies- Specified by:
getActiveLifeCyclePoliciesin interfaceLifeCycleService- Returns:
- A list of
LifeCyclePolicys - Throws:
LifeCycleServiceException- If something went wrong in the database service- See Also:
-
createLifeCyclePolicy
public LifeCyclePolicy createLifeCyclePolicy(LifeCyclePolicy policy) throws LifeCycleServiceException, UnauthorizedException Creates a single life cycle policy in the database.- Specified by:
createLifeCyclePolicyin interfaceLifeCycleService- 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- See Also:
-
updateLifeCyclePolicy
public boolean updateLifeCyclePolicy(LifeCyclePolicy policy) throws NotFoundException, LifeCycleServiceException, UnauthorizedException, IllegalArgumentException Updates a single life cycle policy in the database.- Specified by:
updateLifeCyclePolicyin interfaceLifeCycleService- 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- See Also:
-
deleteLifeCyclePolicy
public boolean deleteLifeCyclePolicy(String id) throws NotFoundException, LifeCycleServiceException, UnauthorizedException Deletes a life cycle policy from the database- Specified by:
deleteLifeCyclePolicyin interfaceLifeCycleService- 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- See Also:
-
deleteAllLifeCyclePoliciesCreatedByConfig
public void deleteAllLifeCyclePoliciesCreatedByConfig(String orgId) throws LifeCycleServiceException Delete all policies created from configuration files from the database. Only to be called as admin from the policy scanner.- Specified by:
deleteAllLifeCyclePoliciesCreatedByConfigin interfaceLifeCycleService- Parameters:
orgId-- Throws:
LifeCycleServiceException- If something went wrong in the database service- See Also:
-
getLifeCycleTaskById
public LifeCycleTask getLifeCycleTaskById(String id) throws NotFoundException, LifeCycleServiceException Returns a life cycle task from the database by its id- Specified by:
getLifeCycleTaskByIdin interfaceLifeCycleService- 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- See Also:
-
getLifeCycleTaskByTargetId
public LifeCycleTask getLifeCycleTaskByTargetId(String targetId) throws NotFoundException, LifeCycleServiceException Returns a life cycle task from the database by its target identifier- Specified by:
getLifeCycleTaskByTargetIdin interfaceLifeCycleService- 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- See Also:
-
getLifeCycleTasksWithStatus
public List<LifeCycleTask> getLifeCycleTasksWithStatus(Status status) throws LifeCycleServiceException Get multiple life cycle tasks based on their status- Specified by:
getLifeCycleTasksWithStatusin interfaceLifeCycleService- Parameters:
status- The state the tasks should be in- Returns:
- A list of
LifeCycleTasks - Throws:
LifeCycleServiceException- If something went wrong in the database service- See Also:
-
createLifeCycleTask
Creates a new life cycle task in the database- Specified by:
createLifeCycleTaskin interfaceLifeCycleService- Parameters:
task- TheLifeCycleTaskto create- Returns:
- The created
LifeCycleTask - Throws:
LifeCycleServiceException- If something went wrong in the database service- See Also:
-
updateLifeCycleTask
public boolean updateLifeCycleTask(LifeCycleTask task) throws NotFoundException, LifeCycleServiceException, IllegalArgumentException Updates a life cycle task- Specified by:
updateLifeCycleTaskin interfaceLifeCycleService- 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 serviceIllegalArgumentException- See Also:
-
deleteLifeCycleTask
Deletes a life cycle task from the database- Specified by:
deleteLifeCycleTaskin interfaceLifeCycleService- 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- See Also:
-
checkValidity
Checks if the given policy has all required fields filled in- Specified by:
checkValidityin interfaceLifeCycleService- Parameters:
policy- The lifecycle policy to be checked- Returns:
- True if the policy fulfills the criteria set by the function, else false
- See Also:
-
filterForEvents
public 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.- Specified by:
filterForEventsin interfaceLifeCycleService- 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- See Also:
-
filterForEvents
public 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.- Specified by:
filterForEventsin interfaceLifeCycleService- 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- See Also:
-