use of org.killbill.billing.account.api.DefaultImmutableAccountData in project killbill by killbill.
the class DefaultAccountApiBase method getAccountByKey.
protected Account getAccountByKey(final String key, final InternalTenantContext context) throws AccountApiException {
final AccountModelDao accountModelDao = accountDao.getAccountByKey(key, context);
if (accountModelDao == null) {
throw new AccountApiException(ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_KEY, key);
}
final Account account = new DefaultAccount(accountModelDao);
accountCacheController.putIfAbsent(account.getId(), new DefaultImmutableAccountData(account));
return account;
}
use of org.killbill.billing.account.api.DefaultImmutableAccountData in project killbill by killbill.
the class DefaultAccountApiBase method getAccountById.
protected Account getAccountById(final UUID accountId, final InternalTenantContext context) throws AccountApiException {
final Long recordId = nonEntityDao.retrieveRecordIdFromObject(accountId, ObjectType.ACCOUNT, cacheControllerDispatcher.getCacheController(CacheType.RECORD_ID));
final Account account = getAccountByRecordIdInternal(recordId, context);
if (account == null) {
throw new AccountApiException(ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_ID, accountId);
}
accountCacheController.putIfAbsent(accountId, new DefaultImmutableAccountData(account));
return account;
}
use of org.killbill.billing.account.api.DefaultImmutableAccountData in project killbill by killbill.
the class DefaultImmutableAccountInternalApi method createImmutableAccountCacheLoaderArgument.
private CacheLoaderArgument createImmutableAccountCacheLoaderArgument(final InternalTenantContext context) {
final LoaderCallback loaderCallback = new LoaderCallback() {
@Override
public Object loadAccount(final Long recordId, final InternalTenantContext context) {
final Account account = getAccountByRecordIdInternal(recordId, context);
return account != null ? new DefaultImmutableAccountData(account) : null;
}
};
final Object[] args = { loaderCallback };
return new CacheLoaderArgument(null, args, context);
}
Aggregations