use of org.killbill.billing.callcontext.InternalTenantContext in project killbill by killbill.
the class InternalCallContextFactory method getImmutableAccountData.
private ImmutableAccountData getImmutableAccountData(final Long accountRecordId, final Long tenantRecordId) {
Preconditions.checkNotNull(accountRecordId, "Missing accountRecordId");
final InternalTenantContext tmp = new InternalTenantContext(tenantRecordId, accountRecordId, null, null);
try {
final ImmutableAccountData immutableAccountData = accountInternalApi.getImmutableAccountDataByRecordId(accountRecordId, tmp);
Preconditions.checkNotNull(immutableAccountData, "Unable to retrieve immutableAccountData");
return immutableAccountData;
} catch (final AccountApiException e) {
throw new RuntimeException(e);
}
}
use of org.killbill.billing.callcontext.InternalTenantContext in project killbill by killbill.
the class TenantKVCacheLoader method compute.
@Override
public String compute(final String key, final CacheLoaderArgument cacheLoaderArgument) {
final String[] parts = key.split(CacheControllerDispatcher.CACHE_KEY_SEPARATOR);
final String rawKey = parts[0];
final String tenantRecordId = parts[1];
final InternalTenantContext internalTenantContext = new InternalTenantContext(Long.valueOf(tenantRecordId));
final List<String> valuesForKey = tenantApi.getTenantValuesForKey(rawKey, internalTenantContext);
if (valuesForKey == null || valuesForKey.isEmpty()) {
return EMPTY_VALUE_PLACEHOLDER;
}
if (valuesForKey.size() > 1) {
throw new IllegalStateException("TenantKVCacheLoader expecting no more than one value for key " + key);
}
return valuesForKey.get(0);
}
Aggregations