use of org.killbill.billing.util.entity.dao.DefaultPaginationSqlDaoHelper.Ordering in project killbill by killbill.
the class DefaultPaymentDao method getByTransactionStatusAcrossTenants.
@Override
public Pagination<PaymentTransactionModelDao> getByTransactionStatusAcrossTenants(final Iterable<TransactionStatus> transactionStatuses, final DateTime createdBeforeDate, final DateTime createdAfterDate, final Long offset, final Long limit) {
final Collection<String> allTransactionStatus = ImmutableList.copyOf(Iterables.transform(transactionStatuses, Functions.toStringFunction()));
final Date createdBefore = createdBeforeDate.toDate();
final Date createdAfter = createdAfterDate.toDate();
return paginationHelper.getPagination(TransactionSqlDao.class, new PaginationIteratorBuilder<PaymentTransactionModelDao, PaymentTransaction, TransactionSqlDao>() {
@Override
public Long getCount(final TransactionSqlDao sqlDao, final InternalTenantContext context) {
return sqlDao.getCountByTransactionStatusPriorDateAcrossTenants(allTransactionStatus, createdBefore, createdAfter);
}
@Override
public Iterator<PaymentTransactionModelDao> build(final TransactionSqlDao sqlDao, final Long offset, final Long limit, final Ordering ordering, final InternalTenantContext context) {
return sqlDao.getByTransactionStatusPriorDateAcrossTenants(allTransactionStatus, createdBefore, createdAfter, offset, limit, ordering.toString());
}
}, offset, limit, null);
}
Aggregations