public class PlatformServiceImpl extends Object implements PlatformService
| Constructor and Description |
|---|
PlatformServiceImpl(PersistenceService platformPersistenceService,
PlatformRetriever platformRetriever,
Recorder recorder,
TechnicalLoggerService logger,
PlatformCacheService platformCacheService,
SPlatformProperties sPlatformProperties,
DataSource datasource,
List<String> sqlFolders) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
activateTenant(long tenantId)
Set status of the tenant into activated
|
long |
createTenant(STenant tenant)
insert a new row in the Tenant table
case 1 - create tenants tables if not already exists + insert rows where necessary (sequences for example) + insert default users (defined in
configuration)
case 2 - create tenants tables + insert rows where necessary (sequences for example) + insert default users (defined in configuration)
|
void |
deactiveTenant(long tenantId)
Set status of the tenant into deactivated
|
void |
deleteTenant(long tenantId)
case 1 - Remove tenant specific tenant tables if no mor etenant in the db
case 2 - Remove tenant specific tables
|
void |
deleteTenantObjects(long tenantId)
Remove all rows from all tables where the tenantId matches
|
protected void |
executeSQLResource(String sqlFile,
Map<String,String> replacements) |
protected void |
executeSQLResources(List<String> sqlFiles) |
protected void |
executeSQLResources(List<String> sqlFiles,
Map<String,String> replacements) |
STenant |
getDefaultTenant()
Get default tenant
|
int |
getNumberOfTenants()
Get the total number of sTenants
|
long |
getNumberOfTenants(QueryOptions options)
Return a number of tenants by the given conditions, as one part of SearchResult that is search method's return value in platformApi
|
SPlatform |
getPlatform()
Retrieve the platform from the cache
No need to be in a transaction
|
SPlatformProperties |
getSPlatformProperties()
Return the platform properties
|
STenant |
getTenant(long id)
Get tenant by its id
|
STenant |
getTenantByName(String name)
Get tenant by its name
|
List<STenant> |
getTenants(Collection<Long> ids,
QueryOptions queryOptions)
Get tenants which ids belong to given collection
|
List<STenant> |
getTenants(QueryOptions queryOptions)
Get all tenants
|
boolean |
isDefaultTenantCreated()
Is the default tenant already created?
|
boolean |
isPlatformCreated()
Return true if the platform is created, else return false.
|
List<STenant> |
searchTenants(QueryOptions options)
Return a list of tenants by the given conditions, as one part of SearchResult that is search method's return value in platformApi
|
void |
updateTenant(STenant tenant,
EntityUpdateDescriptor descriptor)
Update a sTenant from given sTenant and new content.
|
public PlatformServiceImpl(PersistenceService platformPersistenceService, PlatformRetriever platformRetriever, Recorder recorder, TechnicalLoggerService logger, PlatformCacheService platformCacheService, SPlatformProperties sPlatformProperties, DataSource datasource, List<String> sqlFolders)
protected void executeSQLResources(List<String> sqlFiles) throws IOException, SQLException
sqlFiles - the sql files to executeSQLExceptionIOExceptionprotected void executeSQLResources(List<String> sqlFiles, Map<String,String> replacements) throws IOException, SQLException
sqlFiles - the sql files to executeSQLExceptionIOExceptionprotected void executeSQLResource(String sqlFile, Map<String,String> replacements) throws IOException, SQLException
sqlFile - the sql file to executeIOExceptionSQLExceptionpublic long createTenant(STenant tenant) throws STenantCreationException, STenantAlreadyExistException
PlatformServicecreateTenant in interface PlatformServicetenant - sTenantSTenantCreationException - occurs when an exception is thrown during sTenant creationSTenantAlreadyExistException - occurs when the sTenant has already been takenpublic void deleteTenant(long tenantId)
throws STenantDeletionException,
STenantNotFoundException,
SDeletingActivatedTenantException
PlatformServicedeleteTenant in interface PlatformServiceSTenantDeletionException - occurs when an exception is thrown during sTenant deletionSTenantNotFoundException - occurs when the identifier does not refer to an existing sTenantSDeletingActivatedTenantException - occurs when an exception is thrown during deleting an activated sTenantpublic void deleteTenantObjects(long tenantId)
throws STenantDeletionException,
STenantNotFoundException,
SDeletingActivatedTenantException
PlatformServicedeleteTenantObjects in interface PlatformServiceSTenantDeletionExceptionSTenantNotFoundExceptionSDeletingActivatedTenantExceptionpublic SPlatform getPlatform() throws SPlatformNotFoundException
PlatformServicegetPlatform in interface PlatformServiceSPlatformNotFoundException - occurs when the identifier does not refer to an existing sPlatformpublic STenant getTenant(long id) throws STenantNotFoundException
PlatformServicegetTenant in interface PlatformServiceid - tenant idSTenantNotFoundException - occurs when the identifier does not refer to an existing sTenantpublic boolean isPlatformCreated()
PlatformServiceisPlatformCreated in interface PlatformServicepublic STenant getTenantByName(String name) throws STenantNotFoundException
PlatformServicegetTenantByName in interface PlatformServicename - tenant's nameSTenantNotFoundException - occurs when the identifier does not refer to an existing sTenantpublic STenant getDefaultTenant() throws STenantNotFoundException
PlatformServicegetDefaultTenant in interface PlatformServiceSTenantNotFoundException - occurs when the identifier does not refer to an existing sTenantpublic boolean isDefaultTenantCreated()
throws SBonitaReadException
PlatformServiceisDefaultTenantCreated in interface PlatformServiceSBonitaReadException - when we cannot determine if default tenant is createdpublic List<STenant> getTenants(Collection<Long> ids, QueryOptions queryOptions) throws STenantNotFoundException, STenantException
PlatformServicegetTenants in interface PlatformServiceids - a collection of idsqueryOptions - The criterion used to search tenantsSTenantNotFoundException - occurs when the identifier does not refer to an existing sTenantSTenantExceptionpublic void updateTenant(STenant tenant, EntityUpdateDescriptor descriptor) throws STenantUpdateException
PlatformServiceupdateTenant in interface PlatformServicetenant - sTenantdescriptor - new contentSTenantUpdateException - occurs when an exception is thrown during sTenant updatepublic boolean activateTenant(long tenantId)
throws STenantNotFoundException,
STenantActivationException
PlatformServiceactivateTenant in interface PlatformServiceSTenantNotFoundException - occurs when the identifier does not refer to an existing sTenantSTenantActivationException - occurs when an exception is thrown during activating sTenantpublic void deactiveTenant(long tenantId)
throws STenantNotFoundException,
STenantDeactivationException
PlatformServicedeactiveTenant in interface PlatformServiceSTenantNotFoundException - occurs when the identifier does not refer to an existing sTenantSTenantDeactivationException - occurs when an exception is thrown during deactivating sTenantpublic List<STenant> getTenants(QueryOptions queryOptions) throws STenantException
PlatformServicegetTenants in interface PlatformServicequeryOptions - The criterion used to search tenantsSTenantExceptionpublic int getNumberOfTenants()
throws STenantException
PlatformServicegetNumberOfTenants in interface PlatformServiceSTenantExceptionpublic List<STenant> searchTenants(QueryOptions options) throws SBonitaReadException
PlatformServicesearchTenants in interface PlatformServiceSBonitaReadExceptionpublic long getNumberOfTenants(QueryOptions options) throws SBonitaReadException
PlatformServicegetNumberOfTenants in interface PlatformServiceSBonitaReadExceptionpublic SPlatformProperties getSPlatformProperties()
PlatformServicegetSPlatformProperties in interface PlatformServiceCopyright © 2019 Bonitasoft S.A.. All rights reserved.