Interface LifeCycleService


public interface LifeCycleService
  • Method Details

    • getLifeCyclePolicyById

      LifeCyclePolicy getLifeCyclePolicyById(String id) throws org.opencastproject.util.NotFoundException, LifeCycleServiceException, org.opencastproject.security.api.UnauthorizedException
      Returns a life cycle policy from the database by its id
      Parameters:
      id - life cycle policy id
      Returns:
      The LifeCyclePolicy belonging to the id
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle policy with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
      org.opencastproject.security.api.UnauthorizedException - If the user does not have read access for the life cycle policy
    • getLifeCyclePolicyById

      LifeCyclePolicy getLifeCyclePolicyById(String id, String orgId) throws org.opencastproject.util.NotFoundException, LifeCycleServiceException, org.opencastproject.security.api.UnauthorizedException
      Returns a life cycle policy from the database by its id
      Parameters:
      id - life cycle policy id
      orgId - life cycle policy organization
      Returns:
      The LifeCyclePolicy belonging to the id
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle policy with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
      org.opencastproject.security.api.UnauthorizedException - If the user does not have read access for the life cycle policy
    • getLifeCyclePoliciesTotal

      long getLifeCyclePoliciesTotal() throws LifeCycleServiceException
      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, org.opencastproject.util.requests.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

      List<LifeCyclePolicy> getActiveLifeCyclePolicies() throws LifeCycleServiceException
      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, org.opencastproject.security.api.UnauthorizedException
      Creates a single life cycle policy in the database.
      Parameters:
      policy - The LifeCyclePolicy to create
      Returns:
      The created LifeCyclePolicy
      Throws:
      LifeCycleServiceException - If something went wrong in the database service
      org.opencastproject.security.api.UnauthorizedException - If the user does not have write access for an existing life cycle policy
    • updateLifeCyclePolicy

      boolean updateLifeCyclePolicy(LifeCyclePolicy policy) throws org.opencastproject.util.NotFoundException, LifeCycleServiceException, org.opencastproject.security.api.UnauthorizedException, IllegalArgumentException
      Updates a single life cycle policy in the database.
      Parameters:
      policy - The LifeCyclePolicy to create or update with
      Returns:
      The updated LifeCyclePolicy
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle policy with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
      org.opencastproject.security.api.UnauthorizedException - If the user does not have write access for an existing life cycle policy
      IllegalArgumentException
    • deleteLifeCyclePolicy

      boolean deleteLifeCyclePolicy(String id) throws org.opencastproject.util.NotFoundException, LifeCycleServiceException, org.opencastproject.security.api.UnauthorizedException
      Deletes a life cycle policy from the database
      Parameters:
      id - The life cycle policy identifier
      Returns:
      The removed LifeCyclePolicy
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle policy with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
      org.opencastproject.security.api.UnauthorizedException - If the user does not have write access for the life cycle policy
    • deleteAllLifeCyclePoliciesCreatedByConfig

      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.
      Parameters:
      orgId -
      Throws:
      LifeCycleServiceException - If something went wrong in the database service
    • getLifeCycleTaskById

      LifeCycleTask getLifeCycleTaskById(String id) throws org.opencastproject.util.NotFoundException, LifeCycleServiceException
      Returns a life cycle task from the database by its id
      Parameters:
      id - life cycle task id
      Returns:
      The LifeCyclePolicy belonging to the id
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle task with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
    • getLifeCycleTaskByTargetId

      LifeCycleTask getLifeCycleTaskByTargetId(String targetId) throws org.opencastproject.util.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 LifeCyclePolicy belonging to the id
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle task with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
    • getLifeCycleTasksWithStatus

      List<LifeCycleTask> getLifeCycleTasksWithStatus(Status status) throws LifeCycleServiceException
      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

      LifeCycleTask createLifeCycleTask(LifeCycleTask task) throws LifeCycleServiceException
      Creates a new life cycle task in the database
      Parameters:
      task - The LifeCycleTask to create
      Returns:
      The created LifeCycleTask
      Throws:
      LifeCycleServiceException - If something went wrong in the database service
    • updateLifeCycleTask

      boolean updateLifeCycleTask(LifeCycleTask task) throws org.opencastproject.util.NotFoundException, LifeCycleServiceException, org.opencastproject.security.api.UnauthorizedException, IllegalArgumentException
      Updates a life cycle task
      Parameters:
      task - The LifeCycleTask to create or update with
      Returns:
      The updated LifeCycleTask
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle task with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
      org.opencastproject.security.api.UnauthorizedException - If the user does not have write access for an existing life cycle task
      IllegalArgumentException
    • deleteLifeCycleTask

      boolean deleteLifeCycleTask(String id) throws org.opencastproject.util.NotFoundException, LifeCycleServiceException
      Deletes a life cycle task from the database
      Parameters:
      id - The life cycle task identifier
      Returns:
      The removed LifeCycleTask
      Throws:
      org.opencastproject.util.NotFoundException - If no life cycle task with the given id could be found
      LifeCycleServiceException - If something went wrong in the database service
    • checkValidity

      boolean checkValidity(LifeCyclePolicy policy)
      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<org.opencastproject.elasticsearch.index.objects.event.Event> filterForEvents(Map<String,Map<String,org.opencastproject.elasticsearch.index.objects.event.EventSearchQueryField<String>>> filters) throws org.opencastproject.elasticsearch.api.SearchIndexException, org.opencastproject.util.NotFoundException
      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:
      org.opencastproject.elasticsearch.api.SearchIndexException - If something went wrong in the index service
      org.opencastproject.util.NotFoundException - If a targetFilters object contains a metadata catalog flavor unknown to Opencast
    • filterForEvents

      List<org.opencastproject.elasticsearch.index.objects.event.Event> filterForEvents(Map<String,Map<String,org.opencastproject.elasticsearch.index.objects.event.EventSearchQueryField<String>>> filters, int limit, int offset) throws org.opencastproject.elasticsearch.api.SearchIndexException, org.opencastproject.util.NotFoundException
      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:
      org.opencastproject.elasticsearch.api.SearchIndexException - If something went wrong in the index service
      org.opencastproject.util.NotFoundException - If a targetFilters object contains a metadata catalog flavor unknown to Opencast