use of org.apache.cloudstack.quota.vo.QuotaAccountVO in project cloudstack by apache.
the class QuotaServiceImpl method saveQuotaAccount.
@Override
public boolean saveQuotaAccount(final AccountVO account, final BigDecimal aggrUsage, final Date endDate) {
// update quota_accounts
QuotaAccountVO quota_account = _quotaAcc.findByIdQuotaAccount(account.getAccountId());
if (quota_account == null) {
quota_account = new QuotaAccountVO(account.getAccountId());
quota_account.setQuotaBalance(aggrUsage);
quota_account.setQuotaBalanceDate(endDate);
if (s_logger.isDebugEnabled()) {
s_logger.debug(quota_account);
}
_quotaAcc.persistQuotaAccount(quota_account);
return true;
} else {
quota_account.setQuotaBalance(aggrUsage);
quota_account.setQuotaBalanceDate(endDate);
if (s_logger.isDebugEnabled()) {
s_logger.debug(quota_account);
}
return _quotaAcc.updateQuotaAccount(account.getAccountId(), quota_account);
}
}
use of org.apache.cloudstack.quota.vo.QuotaAccountVO in project cloudstack by apache.
the class QuotaResponseBuilderImpl method createQuotaSummaryResponse.
@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;
}
Aggregations