private int offset = 0;
private int limit = 0;
private CurrencyExchangeRateMap exchangeRateMap;
public InvestmentTxactionList build(Collection<InvestmentTxaction> investmentTxactions) {
InvestmentTxactionList investmentTxactionList = new InvestmentTxactionList();
// remove disabled, deleted, etc, sort them in reverse chronological order
final List<InvestmentTxaction> resultTxactions = sort(filter(investmentTxactions));
// set the total count to all the ones that could ever be shown
investmentTxactionList.setTotalCount(resultTxactions.size());
if (resultTxactions.isEmpty()) {
return investmentTxactionList;
}
// hack of the end of the list since they are not useful in balance calculation
applyLimit(resultTxactions);
for (InvestmentTxaction investmentTxaction : resultTxactions) {
investmentTxactionList.add(new InvestmentTxactionListItem(investmentTxaction));
}
// hack off the front of the list we were asked to hide
applyOffset(investmentTxactionList);