Class ThemesServiceDatabaseImpl

java.lang.Object
org.opencastproject.themes.persistence.ThemesServiceDatabaseImpl
All Implemented Interfaces:
ThemesServiceDatabase

public class ThemesServiceDatabaseImpl extends Object implements ThemesServiceDatabase
Implements ThemesServiceDatabase. Defines permanent storage for themes.
  • Field Details

    • PERSISTENCE_UNIT

      public static final String PERSISTENCE_UNIT
      See Also:
    • emf

      protected javax.persistence.EntityManagerFactory emf
      Factory used to create EntityManagers for transactions
    • dbSessionFactory

      protected org.opencastproject.db.DBSessionFactory dbSessionFactory
    • db

      protected org.opencastproject.db.DBSession db
    • securityService

      protected org.opencastproject.security.api.SecurityService securityService
      The security service
    • userDirectoryService

      protected org.opencastproject.security.api.UserDirectoryService userDirectoryService
      The user directory service
  • Constructor Details

    • ThemesServiceDatabaseImpl

      public ThemesServiceDatabaseImpl()
  • Method Details

    • activate

      public void activate(org.osgi.service.component.ComponentContext cc)
      Creates EntityManagerFactory using persistence provider and properties passed via OSGi.
      Parameters:
      cc -
    • setEntityManagerFactory

      public void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
      OSGi DI
    • setDBSessionFactory

      public void setDBSessionFactory(org.opencastproject.db.DBSessionFactory dbSessionFactory)
    • setSecurityService

      public void setSecurityService(org.opencastproject.security.api.SecurityService securityService)
      OSGi callback to set the security service.
      Parameters:
      securityService - the security service
    • setUserDirectoryService

      public void setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
      OSGi callback to set the user directory service
      Parameters:
      userDirectoryService - the user directory service
    • getTheme

      public Theme getTheme(long id) throws ThemesServiceDatabaseException, org.opencastproject.util.NotFoundException
      Description copied from interface: ThemesServiceDatabase
      Return the theme by the unique given id.
      Specified by:
      getTheme in interface ThemesServiceDatabase
      Parameters:
      id - The unique id of the theme.
      Returns:
      A Theme that matches the id.
      Throws:
      ThemesServiceDatabaseException - if there is a problem communicating with the underlying data store
      org.opencastproject.util.NotFoundException - if the theme could not be found
    • findThemes

      public List<Theme> findThemes(Optional<Integer> limit, Optional<Integer> offset, ArrayList<org.opencastproject.util.requests.SortCriterion> sortCriteria, Optional<String> creatorFilter, Optional<String> textFilter)
      Description copied from interface: ThemesServiceDatabase
      Return themes that match the query parameters
      Specified by:
      findThemes in interface ThemesServiceDatabase
      Parameters:
      limit - Maximum amount of themes to return (optional)
      offset - The offset to read data from (optional)
      sortCriteria - How the resulting list should be sorted
      creatorFilter - filter by creator name (optional)
      textFilter - fulltext filter (optional)
      Returns:
      A List of Theme that match the query parameters
    • updateTheme

      public Theme updateTheme(Theme theme) throws ThemesServiceDatabaseException
      Description copied from interface: ThemesServiceDatabase
      Crate or update a theme.
      Specified by:
      updateTheme in interface ThemesServiceDatabase
      Parameters:
      theme - The theme to create or update.
      Returns:
      The updated Theme.
      Throws:
      ThemesServiceDatabaseException - if there is a problem communicating with the underlying data store
    • deleteTheme

      public void deleteTheme(long id) throws ThemesServiceDatabaseException, org.opencastproject.util.NotFoundException
      Description copied from interface: ThemesServiceDatabase
      Delete a theme by using a unique id to find it.
      Specified by:
      deleteTheme in interface ThemesServiceDatabase
      Parameters:
      id - The unique id of the theme.
      Throws:
      ThemesServiceDatabaseException - if there is a problem communicating with the underlying data store
      org.opencastproject.util.NotFoundException
    • countThemes

      public int countThemes() throws ThemesServiceDatabaseException
      Specified by:
      countThemes in interface ThemesServiceDatabase
      Returns:
      Count the total number of themes.
      Throws:
      ThemesServiceDatabaseException - if there is a problem communicating with the underlying data store