Class ThemesServiceDatabaseImpl
java.lang.Object
org.opencastproject.themes.persistence.ThemesServiceDatabaseImpl
- All Implemented Interfaces:
ThemesServiceDatabase
Implements
ThemesServiceDatabase. Defines permanent storage for themes.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBSessionprotected DBSessionFactoryprotected javax.persistence.EntityManagerFactoryFactory used to createEntityManagers for transactionsstatic final Stringprotected SecurityServiceThe security serviceprotected UserDirectoryServiceThe user directory service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) CreatesEntityManagerFactoryusing persistence provider and properties passed via OSGi.intvoiddeleteTheme(long id) Delete a theme by using a unique id to find it.findThemes(Optional<Integer> limit, Optional<Integer> offset, ArrayList<SortCriterion> sortCriteria, Optional<String> creatorFilter, Optional<String> textFilter) Return themes that match the query parametersgetTheme(long id) Return the theme by the unique given id.voidsetDBSessionFactory(DBSessionFactory dbSessionFactory) voidsetEntityManagerFactory(javax.persistence.EntityManagerFactory emf) OSGi DIvoidsetSecurityService(SecurityService securityService) OSGi callback to set the security service.voidsetUserDirectoryService(UserDirectoryService userDirectoryService) OSGi callback to set the user directory serviceupdateTheme(Theme theme) Crate or update a theme.
-
Field Details
-
PERSISTENCE_UNIT
- See Also:
-
emf
protected javax.persistence.EntityManagerFactory emfFactory used to createEntityManagers for transactions -
dbSessionFactory
-
db
-
securityService
The security service -
userDirectoryService
The user directory service
-
-
Constructor Details
-
ThemesServiceDatabaseImpl
public ThemesServiceDatabaseImpl()
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) CreatesEntityManagerFactoryusing persistence provider and properties passed via OSGi.- Parameters:
cc-
-
setEntityManagerFactory
public void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf) OSGi DI -
setDBSessionFactory
-
setSecurityService
OSGi callback to set the security service.- Parameters:
securityService- the security service
-
setUserDirectoryService
OSGi callback to set the user directory service- Parameters:
userDirectoryService- the user directory service
-
getTheme
Description copied from interface:ThemesServiceDatabaseReturn the theme by the unique given id.- Specified by:
getThemein interfaceThemesServiceDatabase- Parameters:
id- The unique id of the theme.- Returns:
- A
Themethat matches the id. - Throws:
ThemesServiceDatabaseException- if there is a problem communicating with the underlying data storeNotFoundException- if the theme could not be found
-
findThemes
public List<Theme> findThemes(Optional<Integer> limit, Optional<Integer> offset, ArrayList<SortCriterion> sortCriteria, Optional<String> creatorFilter, Optional<String> textFilter) Description copied from interface:ThemesServiceDatabaseReturn themes that match the query parameters- Specified by:
findThemesin interfaceThemesServiceDatabase- Parameters:
limit- Maximum amount of themes to return (optional)offset- The offset to read data from (optional)sortCriteria- How the resulting list should be sortedcreatorFilter- filter by creator name (optional)textFilter- fulltext filter (optional)- Returns:
- A
ListofThemethat match the query parameters
-
updateTheme
Description copied from interface:ThemesServiceDatabaseCrate or update a theme.- Specified by:
updateThemein interfaceThemesServiceDatabase- 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
Description copied from interface:ThemesServiceDatabaseDelete a theme by using a unique id to find it.- Specified by:
deleteThemein interfaceThemesServiceDatabase- Parameters:
id- The unique id of the theme.- Throws:
ThemesServiceDatabaseException- if there is a problem communicating with the underlying data storeNotFoundException
-
countThemes
- Specified by:
countThemesin interfaceThemesServiceDatabase- Returns:
- Count the total number of themes.
- Throws:
ThemesServiceDatabaseException- if there is a problem communicating with the underlying data store
-