@Override public List<QuotaSummaryResponse> createQuotaSummaryResponse(Boolean listAll) { List<QuotaSummaryResponse> result = new ArrayList<QuotaSummaryResponse>(); if (listAll) { for (final AccountVO account : _accountDao.listAll()) { QuotaSummaryResponse qr = getQuotaSummaryResponse(account); result.add(qr); } } else { for (final QuotaAccountVO quotaAccount : _quotaAccountDao.listAllQuotaAccount()) { AccountVO account = _accountDao.findById(quotaAccount.getId()); if (account == null) { continue; } QuotaSummaryResponse qr = getQuotaSummaryResponse(account); result.add(qr); } } return result; }
@Override public boolean calculateQuotaUsage() { List<AccountVO> accounts = _accountDao.listAll(); for (AccountVO account : accounts) { Pair<List<? extends UsageVO>, Integer> usageRecords = _usageDao.getUsageRecordsPendingQuotaAggregation(account.getAccountId(), account.getDomainId()); if (s_logger.isDebugEnabled()) { s_logger.debug("Usage entries size = " + usageRecords.second().intValue() + ", accId" + account.getAccountId() + ", domId" + account.getDomainId()); } List<QuotaUsageVO> quotaListForAccount = aggregatePendingQuotaRecordsForAccount(account, usageRecords); if (s_logger.isDebugEnabled()) { s_logger.debug("Quota entries size = " + quotaListForAccount.size() + ", accId" + account.getAccountId() + ", domId" + account.getDomainId()); } processQuotaBalanceForAccount(account, quotaListForAccount); } return true; }
@DB public void updateResourceCount() { ResourceType[] resourceTypes = Resource.ResourceType.values(); List<AccountVO> accounts = _accountDao.listAll(); List<DomainVO> domains = _domainDao.listAll(); List<ResourceCountVO> domainResourceCount = _resourceCountDao.listResourceCountByOwnerType(ResourceOwnerType.Domain);
accounts = _accountDao.listAll(filter); if ((accounts != null) && !accounts.isEmpty()) { for (AccountVO account : accounts) {