sureshanaparti commented on code in PR #10017:
URL: https://github.com/apache/cloudstack/pull/10017#discussion_r1871049690
##########
engine/schema/src/main/java/com/cloud/storage/dao/BucketDaoImpl.java:
##########
@@ -79,4 +98,21 @@ public List<BucketVO> searchByIds(Long[] ids) {
sc.setParameters("idIN", ids);
return search(sc, null, null, false);
}
+
+ @Override
+ public Long countBucketsForAccount(long accountId) {
+ SearchCriteria<Long> sc = CountBucketsByAccount.create();
+ sc.setParameters(ACCOUNT_ID, accountId);
+ sc.setParameters(STATE, BucketVO.State.Destroyed);
+ return customSearch(sc, null).get(0);
+ }
+
+ @Override
+ public Long calculateObjectStorageAllocationForAccount(long accountId) {
+ SearchCriteria<SumCount> sc = CalculateBucketsQuotaByAccount.create();
+ sc.setParameters(ACCOUNT_ID, accountId);
+ sc.setParameters(STATE, BucketVO.State.Destroyed);
+ Long totalQuota = customSearch(sc, null).get(0).sum;
Review Comment:
check if custom search return at least one element
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]