Package com.codebarrel.tenant.api.store
Interface TenantStore
public interface TenantStore
-
Method Summary
Modifier and TypeMethodDescriptiongetActiveTenantIdForClientKey
(Environment environment, String clientKey) Provides fast lookup to find the active tenant uuid given a client key.getActiveTenantIdForCloudId
(Environment environment, String cloudId) Provides fast lookup to find the active tenant uuid given a cloud id.getActiveTenantInfo
(CloudIdContext cloudIdContext) Given the provided context, this method will try to look up full tenant details from the store by Cloud Id.getActiveTenantInfo
(TenantContext clientContext) Given the provided context, this method will try to look up full tenant details from the store.getClientKeyForTenantId
(Environment environment, TenantId tenantId) Provides fast lookup to find the client key for the given tenant uuid.getClientKeys
(Environment env) Retrieves all known tenant keys.getRawTenantInfo
(Environment environment, String clientKey) long
getTenantCount
(Environment environment) Returns the unique tenants in our db.getTenantProperties
(TenantContext context) Retrieves tenant properties for the provided tenant.void
removeProperty
(TenantContext context, String key) Revert a specific tenant property back to defaultsave
(Environment environment, TenantInfo tenantInfo) Stores new TenantInfo (overwriting existing data).void
setTenantProperty
(TenantContext context, String key, String value) Set a given property for the provided tenant.
-
Method Details
-
getClientKeys
Retrieves all known tenant keys.- Parameters:
env
- The env to query.- Returns:
- Set of all keys.
-
getActiveTenantInfo
Given the provided context, this method will try to look up full tenant details from the store. This may return empty if no stored tenant info can be found.- Parameters:
clientContext
- The tenant to lookup- Returns:
- Optional tenant info
-
getActiveTenantInfo
Given the provided context, this method will try to look up full tenant details from the store by Cloud Id. This may return empty if no stored tenant info can be found.- Parameters:
cloudIdContext
- The tenant to lookup by cloud Id- Returns:
- Optional tenant info
-
getRawTenantInfo
-
save
Stores new TenantInfo (overwriting existing data). Implementations should take care not to overwrite null attributes however, since this will be called for both installed and enabled events. The latter will not include the shared secret again.- Parameters:
environment
- The environment to updatetenantInfo
- The updated tenant info- Returns:
- The currently active tenantinfo written to the store
-
getTenantProperties
Retrieves tenant properties for the provided tenant.- Parameters:
context
- The context to access this tenant- Returns:
- tenant properties for the provided tenant.
-
setTenantProperty
Set a given property for the provided tenant.- Parameters:
context
- The context to lookup the tenantkey
- the property keyvalue
- the property value
-
removeProperty
Revert a specific tenant property back to default- Parameters:
context
- The context to lookup the tenantkey
- the property key
-
getTenantCount
Returns the unique tenants in our db.- Parameters:
environment
- the environment to query- Returns:
- the number of tenants
-
getActiveTenantIdForClientKey
Provides fast lookup to find the active tenant uuid given a client key.- Parameters:
environment
- the environment to queryclientKey
- the client key to lookup- Returns:
- The active tenant id or empty if none can be found.
-
getActiveTenantIdForCloudId
Provides fast lookup to find the active tenant uuid given a cloud id.- Parameters:
environment
- the environment to querycloudId
- the client key to lookup- Returns:
- The active tenant id or empty if none can be found.
-
getClientKeyForTenantId
Provides fast lookup to find the client key for the given tenant uuid.- Parameters:
environment
- the environment to querytenantId
- the tenant to lookup- Returns:
- The client key or empty if none can be found
-