winterhazel commented on code in PR #10505: URL: https://github.com/apache/cloudstack/pull/10505#discussion_r2178090460
########## plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaSummaryCmd.java: ########## @@ -42,29 +47,25 @@ public class QuotaSummaryCmd extends BaseListCmd { @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, required = false, entityType = DomainResponse.class, description = "Optional, If domain Id is given and the caller is domain admin then the statement is generated for domain.") private Long domainId; - @Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, required = false, description = "Optional, to list all accounts irrespective of the quota activity") + @Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "False (default) lists balance summary for account. True lists balance summary for " + + "accounts which the caller has access.") private Boolean listAll; + @Parameter(name = ApiConstants.ACCOUNT_STATE_TO_SHOW, type = CommandType.STRING, description = "Possible values are [ALL, ACTIVE, REMOVED]. ALL will list summaries for " + + "active and removed accounts; ACTIVE will list summaries only for active accounts; REMOVED will list summaries only for removed accounts. The default value is ACTIVE.") + private String accountStateToShow; + @Inject - QuotaResponseBuilder _responseBuilder; + QuotaResponseBuilder quotaResponseBuilder; - public QuotaSummaryCmd() { - super(); - } + @Inject + QuotaService quotaService; @Override public void execute() { - Account caller = CallContext.current().getCallingAccount(); - Pair<List<QuotaSummaryResponse>, Integer> responses; - if (caller.getType() == Account.Type.ADMIN) { - if (getAccountName() != null && getDomainId() != null) - responses = _responseBuilder.createQuotaSummaryResponse(getAccountName(), getDomainId()); - else - responses = _responseBuilder.createQuotaSummaryResponse(isListAll(), getKeyword(), getStartIndex(), getPageSizeVal()); - } else { - responses = _responseBuilder.createQuotaSummaryResponse(caller.getAccountName(), caller.getDomainId()); - } - final ListResponse<QuotaSummaryResponse> response = new ListResponse<QuotaSummaryResponse>(); + Pair<List<QuotaSummaryResponse>, Integer> responses = quotaResponseBuilder.createQuotaSummaryResponse(this); Review Comment: There are some unused `createQuotaSummaryResponse`s in `QuotaResponseBuilderImpl` now. I would remove these. Code looks good otherwise. I'll test. -- 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: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org