Class PlatformServiceImpl
- java.lang.Object
-
- org.bonitasoft.engine.platform.impl.PlatformServiceImpl
-
- All Implemented Interfaces:
PlatformService
public class PlatformServiceImpl extends java.lang.Object implements PlatformService
- Author:
- Charles Souillard, Celine Souchet
-
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateTenant(long tenantId)Set status of the tenant into activatedlongcreateTenant(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)voiddeactivateTenant(long tenantId)Set status of the tenant into deactivatedvoiddeleteTenant(long tenantId)case 1 - Remove tenant specific tenant tables if no mor etenant in the db case 2 - Remove tenant specific tablesvoiddeleteTenantObjects(long tenantId)Remove all rows from all tables where the tenantId matchesSTenantgetDefaultTenant()Get default tenantintgetNumberOfTenants()Get the total number of sTenantslonggetNumberOfTenants(QueryOptions options)Return a number of tenants by the given conditions, as one part of SearchResult that is search method's return value in platformApiSPlatformgetPlatform()Retrieve the platform from the cache No need to be in a transactionSPlatformPropertiesgetSPlatformProperties()Return the platform propertiesSTenantgetTenant(long id)Get tenant by its idSTenantgetTenantByName(java.lang.String name)Get tenant by its namejava.util.List<STenant>getTenants(java.util.Collection<java.lang.Long> ids, QueryOptions queryOptions)Get tenants which ids belong to given collectionjava.util.List<STenant>getTenants(QueryOptions queryOptions)Get all tenantsbooleanisDefaultTenantCreated()Is the default tenant already created?booleanisPlatformCreated()Return true if the platform is created, else return false.voidpauseTenant(long tenantId)update status of tenant object to PAUSEDjava.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 platformApivoidupdateTenant(STenant tenant, EntityUpdateDescriptor descriptor)Update a sTenant from given sTenant and new content.
-
-
-
Constructor Detail
-
PlatformServiceImpl
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)
-
-
Method Detail
-
createTenant
public long createTenant(STenant tenant) throws STenantCreationException, STenantAlreadyExistException
Description copied from interface:PlatformServiceinsert 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)- Specified by:
createTenantin interfacePlatformService- Parameters:
tenant- sTenant- Returns:
- id of new created tenant
- Throws:
STenantCreationException- occurs when an exception is thrown during sTenant creationSTenantAlreadyExistException- occurs when the sTenant has already been taken
-
deleteTenant
public void deleteTenant(long tenantId) throws STenantDeletionException, STenantNotFoundException, SDeletingActivatedTenantExceptionDescription copied from interface:PlatformServicecase 1 - Remove tenant specific tenant tables if no mor etenant in the db case 2 - Remove tenant specific tables- Specified by:
deleteTenantin interfacePlatformService- Throws:
STenantDeletionException- 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 sTenant
-
deleteTenantObjects
public void deleteTenantObjects(long tenantId) throws STenantDeletionException, STenantNotFoundException, SDeletingActivatedTenantExceptionDescription copied from interface:PlatformServiceRemove all rows from all tables where the tenantId matches- Specified by:
deleteTenantObjectsin interfacePlatformService- Throws:
STenantDeletionExceptionSTenantNotFoundExceptionSDeletingActivatedTenantException
-
getPlatform
public SPlatform getPlatform() throws SPlatformNotFoundException
Description copied from interface:PlatformServiceRetrieve the platform from the cache No need to be in a transaction- Specified by:
getPlatformin interfacePlatformService- Returns:
- sPlatform
- Throws:
SPlatformNotFoundException- occurs when the identifier does not refer to an existing sPlatform
-
getTenant
public STenant getTenant(long id) throws STenantNotFoundException
Description copied from interface:PlatformServiceGet tenant by its id- Specified by:
getTenantin interfacePlatformService- Parameters:
id- tenant id- Returns:
- sTenant
- Throws:
STenantNotFoundException- occurs when the identifier does not refer to an existing sTenant
-
isPlatformCreated
public boolean isPlatformCreated()
Description copied from interface:PlatformServiceReturn true if the platform is created, else return false.- Specified by:
isPlatformCreatedin interfacePlatformService- Returns:
- true or false
-
getTenantByName
public STenant getTenantByName(java.lang.String name) throws STenantNotFoundException
Description copied from interface:PlatformServiceGet tenant by its name- Specified by:
getTenantByNamein interfacePlatformService- Parameters:
name- tenant's name- Returns:
- sTenant
- Throws:
STenantNotFoundException- occurs when the identifier does not refer to an existing sTenant
-
getDefaultTenant
public STenant getDefaultTenant() throws STenantNotFoundException
Description copied from interface:PlatformServiceGet default tenant- Specified by:
getDefaultTenantin interfacePlatformService- Returns:
- sTenant
- Throws:
STenantNotFoundException- occurs when the identifier does not refer to an existing sTenant
-
isDefaultTenantCreated
public boolean isDefaultTenantCreated() throws SBonitaReadExceptionDescription copied from interface:PlatformServiceIs the default tenant already created?- Specified by:
isDefaultTenantCreatedin interfacePlatformService- Returns:
- true if the default tenant exists, false otherwise.
- Throws:
SBonitaReadException- when we cannot determine if default tenant is created
-
getTenants
public java.util.List<STenant> getTenants(java.util.Collection<java.lang.Long> ids, QueryOptions queryOptions) throws STenantNotFoundException, STenantException
Description copied from interface:PlatformServiceGet tenants which ids belong to given collection- Specified by:
getTenantsin interfacePlatformService- Parameters:
ids- a collection of idsqueryOptions- The criterion used to search tenants- Returns:
- a list of sTenant
- Throws:
STenantNotFoundException- occurs when the identifier does not refer to an existing sTenantSTenantException
-
updateTenant
public void updateTenant(STenant tenant, EntityUpdateDescriptor descriptor) throws STenantUpdateException
Description copied from interface:PlatformServiceUpdate a sTenant from given sTenant and new content.- Specified by:
updateTenantin interfacePlatformService- Parameters:
tenant- sTenantdescriptor- new content- Throws:
STenantUpdateException- occurs when an exception is thrown during sTenant update
-
activateTenant
public void activateTenant(long tenantId) throws STenantNotFoundException, STenantActivationExceptionDescription copied from interface:PlatformServiceSet status of the tenant into activated- Specified by:
activateTenantin interfacePlatformService- Throws:
STenantNotFoundException- occurs when the identifier does not refer to an existing sTenantSTenantActivationException- occurs when an exception is thrown during activating sTenant
-
deactivateTenant
public void deactivateTenant(long tenantId) throws STenantNotFoundException, STenantDeactivationExceptionDescription copied from interface:PlatformServiceSet status of the tenant into deactivated- Specified by:
deactivateTenantin interfacePlatformService- Throws:
STenantNotFoundException- occurs when the identifier does not refer to an existing sTenantSTenantDeactivationException- occurs when an exception is thrown during deactivating sTenant
-
pauseTenant
public void pauseTenant(long tenantId) throws STenantUpdateException, STenantNotFoundExceptionDescription copied from interface:PlatformServiceupdate status of tenant object to PAUSED- Specified by:
pauseTenantin interfacePlatformService- Parameters:
tenantId- the id of the tenant to update- Throws:
STenantUpdateExceptionSTenantNotFoundException
-
getTenants
public java.util.List<STenant> getTenants(QueryOptions queryOptions) throws STenantException
Description copied from interface:PlatformServiceGet all tenants- Specified by:
getTenantsin interfacePlatformService- Parameters:
queryOptions- The criterion used to search tenants- Returns:
- a list of sTenant
- Throws:
STenantException
-
getNumberOfTenants
public int getNumberOfTenants() throws STenantExceptionDescription copied from interface:PlatformServiceGet the total number of sTenants- Specified by:
getNumberOfTenantsin interfacePlatformService- Returns:
- the total number of sTenants
- Throws:
STenantException
-
searchTenants
public java.util.List<STenant> searchTenants(QueryOptions options) throws SBonitaReadException
Description copied from interface:PlatformServiceReturn a list of tenants by the given conditions, as one part of SearchResult that is search method's return value in platformApi- Specified by:
searchTenantsin interfacePlatformService- Returns:
- a list of tenants by the given conditions
- Throws:
SBonitaReadException
-
getNumberOfTenants
public long getNumberOfTenants(QueryOptions options) throws SBonitaReadException
Description copied from interface:PlatformServiceReturn a number of tenants by the given conditions, as one part of SearchResult that is search method's return value in platformApi- Specified by:
getNumberOfTenantsin interfacePlatformService- Returns:
- a number of tenants by the given conditions
- Throws:
SBonitaReadException
-
getSPlatformProperties
public SPlatformProperties getSPlatformProperties()
Description copied from interface:PlatformServiceReturn the platform properties- Specified by:
getSPlatformPropertiesin interfacePlatformService- Returns:
- The platform properties
-
-