DaanHoogland commented on code in PR #10506:
URL: https://github.com/apache/cloudstack/pull/10506#discussion_r2046145570
##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java:
##########
@@ -342,76 +371,177 @@ public int compare(QuotaBalanceVO o1, QuotaBalanceVO o2)
{
}
@Override
- public QuotaStatementResponse createQuotaStatementResponse(final
List<QuotaUsageVO> quotaUsage) {
- if (quotaUsage == null || quotaUsage.isEmpty()) {
- throw new InvalidParameterValueException("There is no usage data
found for period mentioned.");
+ public QuotaStatementResponse createQuotaStatementResponse(final
List<QuotaUsageJoinVO> quotaUsages, QuotaStatementCmd cmd) {
+ if (CollectionUtils.isEmpty(quotaUsages)) {
+ throw new InvalidParameterValueException(String.format("There is
no usage data for parameters [%s].",
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(cmd,
+ "accountName", "accountId", "domainId", "startDate",
"endDate", "type", "showDetails")));
}
+ logger.debug("Creating quota statement from [{}] usage records for
parameters [{}].", quotaUsages.size(),
+ ReflectionToStringBuilderUtils.reflectOnlySelectedFields(cmd,
"accountName", "accountId", "domainId", "startDate", "endDate", "type",
"showDetails"));
Review Comment:
this seems the reuse of the same array of strings. Not for this PR but maybe
we should allow String[] as parameter for
`ReflectionToStringBuilderUtils.reflectOnlySelectedFields`. Or allow some kind
of predefined default per class to be registered.
##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java:
##########
@@ -469,11 +599,11 @@ protected void
warnQuotaTariffUpdateDeprecatedFields(QuotaTariffUpdateCmd cmd) {
String warnMessage = "The parameter 's%s' for API 'quotaTariffUpdate'
is no longer needed and it will be removed in future releases.";
Review Comment:
this can be modern format now (not calling the `String.format` on the
`warn`s), can it?
--
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]