Class LifeCycleDatabaseServiceImpl
java.lang.Object
org.opencastproject.lifecyclemanagement.impl.persistence.LifeCycleDatabaseServiceImpl
- All Implemented Interfaces:
LifeCycleDatabaseService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJPA persistence unit nameprotected SecurityServiceThe security service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) createLifeCyclePolicy(LifeCyclePolicy policy, String orgId) Creates a single life cycle policy in the database.createLifeCycleTask(LifeCycleTask task, String orgId) Creates a single life cycle task.voidRemove all life cycle policies that were created through configuration files from the databasebooleandeleteLifeCyclePolicy(LifeCyclePolicy policy, String orgId) Removes a single life cycle policy in the database.booleandeleteLifeCycleTask(LifeCycleTask task, String orgId) Removes a single life cycle task.getActiveLifeCyclePolicies(String orgId) Get currently active life cycle policiesgetLifeCyclePolicies(int limit, int offset, SortCriterion sortCriterion) Get several life cycle policies based on their order in the databaselonggetLifeCyclePoliciesTotal(String orgId) Get the total number of policiesGets a single life cycle policy in the current organization context by its identifier.getLifeCyclePolicy(String id, String orgId) Gets a single life cycle policy by its identifier.protected Function<javax.persistence.EntityManager, Optional<LifeCyclePolicy>> getLifeCyclePolicyById(String id, String orgId) Gets a life cycle policy by its ID, using the current organizational context.Gets a single life cycle task in the current organization context by its identifier.protected Function<javax.persistence.EntityManager, Optional<LifeCycleTask>> getLifeCycleTaskById(String id, String orgId) Gets a life cycle task by its ID, using the current organizational context.getLifeCycleTaskByTargetId(String targetId) Gets a single life cycle task in the current organization context by its target identifier.getLifeCycleTasksWithStatus(Status status, String orgId) Get several life cycle policies based on their statusvoidsetDBSessionFactory(DBSessionFactory dbSessionFactory) voidsetEntityManagerFactory(javax.persistence.EntityManagerFactory emf) OSGi DIvoidsetSecurityService(SecurityService securityService) OSGi callback to set the security service.booleanupdateLifeCyclePolicy(LifeCyclePolicy policy, String orgId) Updates a single life cycle policy in the database.booleanupdateLifeCycleTask(LifeCycleTask task, String orgId) Updates a single life cycle task.
-
Field Details
-
PERSISTENCE_UNIT
JPA persistence unit name- See Also:
-
securityService
The security service
-
-
Constructor Details
-
LifeCycleDatabaseServiceImpl
public LifeCycleDatabaseServiceImpl()
-
-
Method Details
-
setEntityManagerFactory
public void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf) OSGi DI -
setDBSessionFactory
-
setSecurityService
OSGi callback to set the security service.- Parameters:
securityService- the securityService to set
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) -
getLifeCyclePolicy
public LifeCyclePolicy getLifeCyclePolicy(String id) throws NotFoundException, LifeCycleDatabaseException Gets a single life cycle policy in the current organization context by its identifier.- Specified by:
getLifeCyclePolicyin interfaceLifeCycleDatabaseService- Parameters:
id- the life cycle policy identifier- Returns:
- the
LifeCyclePolicywith the given identifier - Throws:
NotFoundException- if there is no life cycle policy with this identifierLifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getLifeCyclePolicy
public LifeCyclePolicy getLifeCyclePolicy(String id, String orgId) throws NotFoundException, LifeCycleDatabaseException Gets a single life cycle policy by its identifier.- Specified by:
getLifeCyclePolicyin interfaceLifeCycleDatabaseService- Parameters:
id- the life cycle policy identifierorgId- the organisation identifier- Returns:
- the
LifeCyclePolicywith the given identifier - Throws:
NotFoundException- if there is no life cycle policy with this identifierLifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getLifeCyclePoliciesTotal
Get the total number of policies- Specified by:
getLifeCyclePoliciesTotalin interfaceLifeCycleDatabaseService- Parameters:
orgId- the organisation identifier- Returns:
- the total number of policies
- Throws:
LifeCycleDatabaseException- See Also:
-
getLifeCyclePolicies
public List<LifeCyclePolicy> getLifeCyclePolicies(int limit, int offset, SortCriterion sortCriterion) throws LifeCycleDatabaseException Get several life cycle policies based on their order in the database- Specified by:
getLifeCyclePoliciesin interfaceLifeCycleDatabaseService- Parameters:
limit- Maximum amount of life cycle policys to returnoffset- The index of the first result to return- Returns:
- a list of
LifeCyclePolicys - Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getActiveLifeCyclePolicies
public List<LifeCyclePolicy> getActiveLifeCyclePolicies(String orgId) throws LifeCycleDatabaseException Get currently active life cycle policies- Specified by:
getActiveLifeCyclePoliciesin interfaceLifeCycleDatabaseService- Parameters:
orgId- the organisation identifier- Returns:
- a list of
LifeCyclePolicys - Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
createLifeCyclePolicy
public LifeCyclePolicy createLifeCyclePolicy(LifeCyclePolicy policy, String orgId) throws LifeCycleDatabaseException Creates a single life cycle policy in the database.- Specified by:
createLifeCyclePolicyin interfaceLifeCycleDatabaseService- Parameters:
policy- TheLifeCyclePolicyorgId- the organisation identifier- Returns:
- The created
LifeCyclePolicy - Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
updateLifeCyclePolicy
public boolean updateLifeCyclePolicy(LifeCyclePolicy policy, String orgId) throws LifeCycleDatabaseException Updates a single life cycle policy in the database.- Specified by:
updateLifeCyclePolicyin interfaceLifeCycleDatabaseService- Parameters:
policy- TheLifeCyclePolicyorgId- the organisation identifier- Returns:
- If the life cycle policy was successfully updated
- Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
deleteLifeCyclePolicy
public boolean deleteLifeCyclePolicy(LifeCyclePolicy policy, String orgId) throws LifeCycleDatabaseException Removes a single life cycle policy in the database.- Specified by:
deleteLifeCyclePolicyin interfaceLifeCycleDatabaseService- Parameters:
policy- TheLifeCyclePolicyorgId- the organisation identifier- Returns:
- If the life cycle policy was successfully updated
- Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
deleteAllLifeCyclePoliciesCreatedByConfig
public void deleteAllLifeCyclePoliciesCreatedByConfig(String orgId) throws LifeCycleDatabaseException Remove all life cycle policies that were created through configuration files from the database- Specified by:
deleteAllLifeCyclePoliciesCreatedByConfigin interfaceLifeCycleDatabaseService- Parameters:
orgId-- Throws:
LifeCycleDatabaseException- See Also:
-
getLifeCycleTask
public LifeCycleTask getLifeCycleTask(String id) throws NotFoundException, LifeCycleDatabaseException Gets a single life cycle task in the current organization context by its identifier.- Specified by:
getLifeCycleTaskin interfaceLifeCycleDatabaseService- Parameters:
id- the life cycle task identifier- Returns:
- the
LifeCycleTaskwith the given identifier - Throws:
NotFoundException- if there is no life cycle task with this identifierLifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getLifeCycleTaskByTargetId
public LifeCycleTask getLifeCycleTaskByTargetId(String targetId) throws NotFoundException, LifeCycleDatabaseException Gets a single life cycle task in the current organization context by its target identifier.- Specified by:
getLifeCycleTaskByTargetIdin interfaceLifeCycleDatabaseService- Parameters:
targetId- the id of the entity the task will act on- Returns:
- the
LifeCycleTaskwith the given identifier - Throws:
NotFoundException- if there is no life cycle task with this identifierLifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getLifeCycleTasksWithStatus
public List<LifeCycleTask> getLifeCycleTasksWithStatus(Status status, String orgId) throws LifeCycleDatabaseException Get several life cycle policies based on their status- Specified by:
getLifeCycleTasksWithStatusin interfaceLifeCycleDatabaseService- Parameters:
status- The state the tasks should be inorgId- the organisation identifier- Returns:
- a list of
LifeCycleTasks - Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
createLifeCycleTask
public LifeCycleTask createLifeCycleTask(LifeCycleTask task, String orgId) throws LifeCycleDatabaseException Creates a single life cycle task.- Specified by:
createLifeCycleTaskin interfaceLifeCycleDatabaseService- Parameters:
task- TheLifeCycleTaskorgId- the organisation identifier- Returns:
- The created
LifeCycleTask - Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
updateLifeCycleTask
public boolean updateLifeCycleTask(LifeCycleTask task, String orgId) throws LifeCycleDatabaseException Updates a single life cycle task.- Specified by:
updateLifeCycleTaskin interfaceLifeCycleDatabaseService- Parameters:
task- TheLifeCycleTaskorgId- the organisation identifier- Returns:
- If the life cycle task was successfully updated
- Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
deleteLifeCycleTask
public boolean deleteLifeCycleTask(LifeCycleTask task, String orgId) throws LifeCycleDatabaseException Removes a single life cycle task.- Specified by:
deleteLifeCycleTaskin interfaceLifeCycleDatabaseService- Parameters:
task- TheLifeCycleTaskorgId- the organisation identifier- Returns:
- If the life cycle task was successfully updated
- Throws:
LifeCycleDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getLifeCyclePolicyById
protected Function<javax.persistence.EntityManager,Optional<LifeCyclePolicy>> getLifeCyclePolicyById(String id, String orgId) Gets a life cycle policy by its ID, using the current organizational context.- Parameters:
id- the policy identifierorgId- the organisation identifier- Returns:
- the policy in an optional
-
getLifeCycleTaskById
protected Function<javax.persistence.EntityManager,Optional<LifeCycleTask>> getLifeCycleTaskById(String id, String orgId) Gets a life cycle task by its ID, using the current organizational context.- Parameters:
id- the task identifierorgId- the organisation identifier- Returns:
- the task in an optional
-