use of org.killbill.billing.util.entity.dao.EntitySqlDao in project killbill by killbill.
the class DefaultAuditDao method getAuditLogsForAccountRecordId.
@Override
public DefaultAccountAuditLogsForObjectType getAuditLogsForAccountRecordId(final TableName tableName, final AuditLevel auditLevel, final InternalTenantContext context) {
final String actualTableName;
if (tableName.hasHistoryTable()) {
// upper cased
actualTableName = tableName.getHistoryTableName().name();
} else {
actualTableName = tableName.getTableName();
}
// Lazy evaluate records to minimize the memory footprint (these can yield a lot of results)
// We usually always want to wrap our queries in an EntitySqlDaoTransactionWrapper... except here.
// Since we want to stream the results out, we don't want to auto-commit when this method returns.
final EntitySqlDao auditSqlDao = transactionalSqlDao.onDemandForStreamingResults(EntitySqlDao.class);
final Iterator<AuditLogModelDao> auditLogsForTableNameAndAccountRecordId = auditSqlDao.getAuditLogsForTableNameAndAccountRecordId(actualTableName, context);
final Iterator<AuditLog> allAuditLogs = buildAuditLogsFromModelDao(auditLogsForTableNameAndAccountRecordId, context);
return new DefaultAccountAuditLogsForObjectType(auditLevel, allAuditLogs);
}
use of org.killbill.billing.util.entity.dao.EntitySqlDao in project killbill by killbill.
the class DefaultAuditDao method getAuditLogsForAccountRecordId.
@Override
public DefaultAccountAuditLogs getAuditLogsForAccountRecordId(final AuditLevel auditLevel, final InternalTenantContext context) {
final UUID accountId = nonEntitySqlDao.getIdFromObject(context.getAccountRecordId(), TableName.ACCOUNT.getTableName());
// Lazy evaluate records to minimize the memory footprint (these can yield a lot of results)
// We usually always want to wrap our queries in an EntitySqlDaoTransactionWrapper... except here.
// Since we want to stream the results out, we don't want to auto-commit when this method returns.
final EntitySqlDao auditSqlDao = transactionalSqlDao.onDemandForStreamingResults(EntitySqlDao.class);
final Iterator<AuditLogModelDao> auditLogsForAccountRecordId = auditSqlDao.getAuditLogsForAccountRecordId(context);
final Iterator<AuditLog> allAuditLogs = buildAuditLogsFromModelDao(auditLogsForAccountRecordId, context);
return new DefaultAccountAuditLogs(accountId, auditLevel, allAuditLogs);
}
Aggregations