public Overview(AccountManager accountManager, List<DeviceInfo> devices, User user) { this.accountDetails = new ArrayList<AccountDetail>(); AccountDetail accountDetail; Account account; try { // devices = accountManager.getDeviceList(user); this.paymentHistory = new PaymentHistory(accountManager.getPaymentRecords(user), user); for (DeviceInfo deviceInfo : devices) { account = accountManager.getAccount(deviceInfo.getAccountNo()); accountDetail = new AccountDetail(); accountDetail.setAccount(account); accountDetail.setDeviceInfo(deviceInfo); accountDetail.setTopUp(accountManager.getTopUp(user, account).getTopupAmount()); accountDetail.setUsageHistory( new UsageHistory( accountManager.getChargeHistory(user, account.getAccountno()), user, account.getAccountno())); this.accountDetails.add(accountDetail); } } catch (AccountManagementException e) { e.printStackTrace(); } }