Class OrganizationDatabaseImpl
java.lang.Object
org.opencastproject.kernel.security.persistence.OrganizationDatabaseImpl
- All Implemented Interfaces:
OrganizationDatabase
Implements
OrganizationDatabase. Defines permanent storage for series.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBSessionprotected DBSessionFactoryprotected javax.persistence.EntityManagerFactoryFactory used to createEntityManagers for transactionsprotected SecurityServiceThe security service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) CreatesEntityManagerFactoryusing persistence provider and properties passed via OSGi.booleancontainsOrganization(String orgId) Returnstrueif the given organization by its identifier is found orfalseif notintCounts all organizations in persistent storagevoiddeleteOrganization(String orgId) Removes an organization from persistent storage.Gets a single organization by its identifier.getOrganizationByHost(String host, int port) Gets a single organization by host and port.Returns all organizations in persistent storage.voidsetDBSessionFactory(DBSessionFactory dbSessionFactory) voidsetSecurityService(SecurityService securityService) OSGi callback to set the security service.voidStores (or updates) an organization.
-
Field Details
-
emf
protected javax.persistence.EntityManagerFactory emfFactory used to createEntityManagers for transactions -
dbSessionFactory
-
db
-
securityService
The security service
-
-
Constructor Details
-
OrganizationDatabaseImpl
public OrganizationDatabaseImpl()
-
-
Method Details
-
setDBSessionFactory
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) CreatesEntityManagerFactoryusing persistence provider and properties passed via OSGi.- Parameters:
cc-
-
setSecurityService
OSGi callback to set the security service.- Parameters:
securityService- the securityService to set
-
deleteOrganization
public void deleteOrganization(String orgId) throws OrganizationDatabaseException, NotFoundException Description copied from interface:OrganizationDatabaseRemoves an organization from persistent storage.- Specified by:
deleteOrganizationin interfaceOrganizationDatabase- Parameters:
orgId- ID of the organization to be removed- Throws:
OrganizationDatabaseException- if there is a problem communicating with the underlying data storeNotFoundException- if the organization with specified ID is not found- See Also:
-
storeOrganization
Description copied from interface:OrganizationDatabaseStores (or updates) an organization.- Specified by:
storeOrganizationin interfaceOrganizationDatabase- Parameters:
org- the organization to store- Throws:
OrganizationDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getOrganization
public Organization getOrganization(String id) throws NotFoundException, OrganizationDatabaseException Description copied from interface:OrganizationDatabaseGets a single organization by its identifier.- Specified by:
getOrganizationin interfaceOrganizationDatabase- Parameters:
id- the organization's identifier- Returns:
- the organization
- Throws:
NotFoundException- if the organization with specified ID is not foundOrganizationDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
countOrganizations
Description copied from interface:OrganizationDatabaseCounts all organizations in persistent storage- Specified by:
countOrganizationsin interfaceOrganizationDatabase- Returns:
- the number of organizations
- Throws:
OrganizationDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
getOrganizationByHost
public Organization getOrganizationByHost(String host, int port) throws OrganizationDatabaseException, NotFoundException Description copied from interface:OrganizationDatabaseGets a single organization by host and port.- Specified by:
getOrganizationByHostin interfaceOrganizationDatabase- Parameters:
host- the organization's hostport- the organization's port- Returns:
- the organization
- Throws:
OrganizationDatabaseException- if there is a problem communicating with the underlying data storeNotFoundException- if the organization with specified URL is not found
-
getOrganizations
Description copied from interface:OrganizationDatabaseReturns all organizations in persistent storage.- Specified by:
getOrganizationsin interfaceOrganizationDatabase- Returns:
- the list of stored organizations
- Throws:
OrganizationDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-
containsOrganization
Description copied from interface:OrganizationDatabaseReturnstrueif the given organization by its identifier is found orfalseif not- Specified by:
containsOrganizationin interfaceOrganizationDatabase- Parameters:
orgId- the organization's identifier- Returns:
trueif found orfalseif not- Throws:
OrganizationDatabaseException- if there is a problem communicating with the underlying data store- See Also:
-