public class PlatformServiceImpl extends java.lang.Object implements PlatformService
| Constructor and Description |
|---|
PlatformServiceImpl(PersistenceService platformPersistenceService,
PlatformRetriever platformRetriever,
Recorder recorder,
TechnicalLoggerService logger,
PlatformCacheService platformCacheService,
SPlatformProperties sPlatformProperties,
javax.sql.DataSource datasource,
java.util.List<java.lang.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(java.lang.String sqlFile,
java.util.Map<java.lang.String,java.lang.String> replacements) |
protected void |
executeSQLResources(java.util.List<java.lang.String> sqlFiles) |
protected void |
executeSQLResources(java.util.List<java.lang.String> sqlFiles,
java.util.Map<java.lang.String,java.lang.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(java.lang.String name)
Get tenant by its name
|
java.util.List<STenant> |
getTenants(java.util.Collection<java.lang.Long> ids,
QueryOptions queryOptions)
Get tenants which ids belong to given collection
|
java.util.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.
|
java.util.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, javax.sql.DataSource datasource, java.util.List<java.lang.String> sqlFolders)
protected void executeSQLResources(java.util.List<java.lang.String> sqlFiles)
throws java.io.IOException,
java.sql.SQLException
sqlFiles - the sql files to executejava.sql.SQLExceptionjava.io.IOExceptionprotected void executeSQLResources(java.util.List<java.lang.String> sqlFiles,
java.util.Map<java.lang.String,java.lang.String> replacements)
throws java.io.IOException,
java.sql.SQLException
sqlFiles - the sql files to executejava.sql.SQLExceptionjava.io.IOExceptionprotected void executeSQLResource(java.lang.String sqlFile,
java.util.Map<java.lang.String,java.lang.String> replacements)
throws java.io.IOException,
java.sql.SQLException
sqlFile - the sql file to executejava.io.IOExceptionjava.sql.SQLExceptionpublic 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(java.lang.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 java.util.List<STenant> getTenants(java.util.Collection<java.lang.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 java.util.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 java.util.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 PlatformService