public class CacheKey extends Object
Modifier and Type | Method and Description |
---|---|
CacheKey |
append(CacheKey other,
Object... objects)
Appends the given CacheKey to this instance.
|
CacheKey |
append(Object object,
Object... objects)
Appends the given Objects to this instance.
|
boolean |
equals(Object o) |
ArrayList<Object> |
getComponents() |
com.google.common.base.Optional<String> |
getTenantId()
Getter for the Id of the tenant for which the key is used.
|
com.google.common.base.Optional<String> |
getUserName()
Getter for the name of the user for which the key is used.
|
int |
hashCode() |
static CacheKey |
newBestEffortIsolatedKey()
Returns a cache key with the highest possible (best effort) level of user and tenant isolation.
|
static CacheKey |
newBestEffortIsolatedKey(CacheKey cacheKey)
Returns a cache key with the highest possible (best effort) level of user and tenant isolation.
|
static CacheKey |
newEquallyIsolatedKey(CacheKey cacheKey)
Returns a cache key with the same tenant and user isolation level as the given key.
|
static CacheKey |
newGlobalKey() |
static CacheKey |
newGlobalKey(CacheKey cacheKey)
Converts the given CacheKey to a globally visible CacheKey.
|
static CacheKey |
newTenantIsolatedKey() |
static CacheKey |
newTenantIsolatedKey(CacheKey cacheKey) |
static CacheKey |
newTenantIsolatedKey(CacheKey cacheKey,
String tenantId)
Converts the given CacheKey to a tenant-isolated CacheKey.
|
static CacheKey |
newTenantIsolatedKey(String tenantId) |
static CacheKey |
newTenantIsolatedOrGlobalKey()
Returns a tenant-isolated cache key.
|
static CacheKey |
newTenantIsolatedOrGlobalKey(CacheKey cacheKey)
Returns a tenant-isolated cache key.
|
static CacheKey |
newUserIsolatedKey() |
static CacheKey |
newUserIsolatedKey(CacheKey cacheKey) |
static CacheKey |
newUserIsolatedKey(CacheKey cacheKey,
String userName) |
static CacheKey |
newUserIsolatedKey(CacheKey cacheKey,
String tenantId,
String userName)
Converts the given CacheKey to a tenant-isolated CacheKey.
|
static CacheKey |
newUserIsolatedKey(String userName) |
static CacheKey |
newUserIsolatedKey(String tenantId,
String userName) |
static CacheKey |
newUserOrTenantIsolatedKey()
Returns a tenant- and user-isolated cache key.
|
static CacheKey |
newUserOrTenantIsolatedKey(CacheKey cacheKey)
Returns a tenant- and user-isolated cache key.
|
String |
toString() |
public com.google.common.base.Optional<String> getTenantId()
public com.google.common.base.Optional<String> getUserName()
public CacheKey append(CacheKey other, Object... objects) throws UnmergeableCacheKeyException
other
- The CacheKey to append to this.objects
- Additional objects that should be used to identify a cache key.IllegalArgumentException
- If the given CacheKey is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.public CacheKey append(@Nullable Object object, Object... objects)
Object.equals(Object)
and
Object.hashCode()
are used.object
- Additional object that should be used to identify a cache key.objects
- Additional objects that should be used to identify a cache key.public static CacheKey newEquallyIsolatedKey(CacheKey cacheKey) throws IllegalArgumentException, UnmergeableCacheKeyException
cacheKey
- The cache key to adopt the isolation level from.IllegalArgumentException
UnmergeableCacheKeyException
public static CacheKey newGlobalKey(CacheKey cacheKey) throws IllegalArgumentException, UnmergeableCacheKeyException
cacheKey
- Cache key that is appended to the newly constructed key.IllegalArgumentException
- If the given CacheKey is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.public static CacheKey newGlobalKey()
public static CacheKey newTenantIsolatedKey(String tenantId) throws IllegalArgumentException
tenantId
- The tenant for which the CacheKey should be isolated.IllegalArgumentException
- If the given tenant is null.public static CacheKey newTenantIsolatedKey() throws TenantNotAvailableException, TenantAccessException
TenantNotAvailableException
- If the tenant is not known. This typically occurs when trying to access the tenant within code that
is running outside any tenant context, e.g., within a background task.TenantAccessException
- If there is an issue while accessing the tenant.newTenantIsolatedKey(String)
public static CacheKey newTenantIsolatedKey(CacheKey cacheKey, String tenantId) throws IllegalArgumentException, UnmergeableCacheKeyException
cacheKey
- Cache key that is appended to the newly constructed key.tenantId
- The tenant for which the CacheKey should be isolated.IllegalArgumentException
- If the given CacheKey or tenant is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.public static CacheKey newTenantIsolatedKey(CacheKey cacheKey) throws IllegalArgumentException, UnmergeableCacheKeyException
cacheKey
- Cache key that is appended to the newly constructed key.IllegalArgumentException
- If the given CacheKey is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.newTenantIsolatedKey(CacheKey, String)
public static CacheKey newUserIsolatedKey(String tenantId, String userName) throws IllegalArgumentException
tenantId
- The tenant for which the CacheKey should be isolated.userName
- The name of the user for which the CacheKey should be isolated.IllegalArgumentException
- If the given tenant or user is null.public static CacheKey newUserIsolatedKey(String userName) throws IllegalArgumentException, TenantNotAvailableException, TenantAccessException
userName
- The name of the user for which the CacheKey should be isolated.IllegalArgumentException
- If the given user is null.TenantNotAvailableException
- If the tenant is not known. This typically occurs when trying to access the tenant within code that
is running outside any tenant context, e.g., within a background task.TenantAccessException
- If there is an issue while accessing the tenant.newUserIsolatedKey(String, String)
public static CacheKey newUserIsolatedKey() throws TenantNotAvailableException, TenantAccessException, UserNotAuthenticatedException, UserAccessException
TenantNotAvailableException
- If the tenant is not known. This typically occurs when trying to access the tenant within code that
is running outside any tenant context, e.g., within a background task.TenantAccessException
- If there is an issue while accessing the tenant.UserNotAuthenticatedException
- If the user is not authenticated.UserAccessException
- If there is an issue while accessing the user.newUserIsolatedKey(String, String)
public static CacheKey newUserIsolatedKey(CacheKey cacheKey, String tenantId, String userName) throws IllegalArgumentException, UnmergeableCacheKeyException
cacheKey
- Cache key that is appended to the newly constructed key.tenantId
- The tenant for which the CacheKey should be isolated.userName
- The name of the user for which the CacheKey should be isolated.IllegalArgumentException
- If the given CacheKey, tenant, or user is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.public static CacheKey newUserIsolatedKey(CacheKey cacheKey, String userName) throws IllegalArgumentException, UnmergeableCacheKeyException, TenantNotAvailableException, TenantAccessException
cacheKey
- Cache key that is appended to the newly constructed key.userName
- The name of the user for which the CacheKey should be isolated.IllegalArgumentException
- If the given CacheKey or user is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.TenantNotAvailableException
- If the tenant is not known. This typically occurs when trying to access the tenant within code that
is running outside any tenant context, e.g., within a background task.TenantAccessException
- If there is an issue while accessing the tenant.newUserIsolatedKey(CacheKey, String, String)
public static CacheKey newUserIsolatedKey(CacheKey cacheKey) throws IllegalArgumentException, UnmergeableCacheKeyException, TenantNotAvailableException, TenantAccessException, UserNotAuthenticatedException, UserAccessException
cacheKey
- Cache key that is appended to the newly constructed key.IllegalArgumentException
- If the given CacheKey is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.TenantNotAvailableException
- If the tenant is not known. This typically occurs when trying to access the tenant within code that
is running outside any tenant context, e.g., within a background task.TenantAccessException
- If there is an issue while accessing the tenant.UserNotAuthenticatedException
- If the user is not authenticated.UserAccessException
- If there is an issue while accessing the user.newUserIsolatedKey(CacheKey, String, String)
public static CacheKey newUserOrTenantIsolatedKey() throws TenantNotAvailableException, TenantAccessException
TenantNotAvailableException
- If the tenant is not known. This typically occurs when trying to access the tenant within code that
is running outside any tenant context, e.g., within a background task.TenantAccessException
- If there is an issue while accessing the tenant.public static CacheKey newUserOrTenantIsolatedKey(CacheKey cacheKey) throws IllegalArgumentException, UnmergeableCacheKeyException, TenantNotAvailableException, TenantAccessException
cacheKey
- Cache key that is appended to the newly constructed key.IllegalArgumentException
- If the given CacheKey is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.TenantNotAvailableException
- If the tenant is not known. This typically occurs when trying to access the tenant within code that
is running outside any tenant context, e.g., within a background task.TenantAccessException
- If there is an issue while accessing the tenant.newUserOrTenantIsolatedKey()
public static CacheKey newTenantIsolatedOrGlobalKey()
public static CacheKey newTenantIsolatedOrGlobalKey(CacheKey cacheKey) throws IllegalArgumentException, UnmergeableCacheKeyException
cacheKey
- Cache key that is appended to the newly constructed key.IllegalArgumentException
- If the given CacheKey is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.public static CacheKey newBestEffortIsolatedKey()
public static CacheKey newBestEffortIsolatedKey(CacheKey cacheKey) throws IllegalArgumentException, UnmergeableCacheKeyException
cacheKey
- Cache key that is appended to the newly constructed key.IllegalArgumentException
- If the given CacheKey is null.UnmergeableCacheKeyException
- If the tenant or user in the isolation level of the given CacheKey is different from the respective
tenant or user in this CacheKey.@Generated(value="lombok") public boolean equals(Object o)
@Generated(value="lombok") public int hashCode()
@Generated(value="lombok") public String toString()
@Generated(value="lombok") public ArrayList<Object> getComponents()
Copyright © 2018 SAP SE. All rights reserved.