Copilot commented on code in PR #11964:
URL: https://github.com/apache/cloudstack/pull/11964#discussion_r2488600739
##########
server/src/main/java/com/cloud/api/query/dao/DomainJoinDaoImpl.java:
##########
@@ -110,6 +115,16 @@ public DomainResponse newDomainResponse(ResponseView view,
EnumSet<DomainDetails
}
domainResponse.setDetails(ApiDBUtils.getDomainDetails(domain.getId()));
+ List<ResourceTagJoinVO> tags =
ApiDBUtils.listResourceTagViewByResourceUUID(domain.getUuid(),
+ ResourceTag.ResourceObjectType.Domain);
+ if (CollectionUtils.isNotEmpty(tags)) {
+ Set<ResourceTagResponse> tagResponses = new HashSet<>();
+ for (ResourceTagJoinVO tag : tags) {
+ ResourceTagResponse tagResponse =
ApiDBUtils.newResourceTagResponse(tag, true);
+ tagResponses.add(tagResponse);
+ }
+ domainResponse.setTags(tagResponses);
+ }
Review Comment:
This tag retrieval and population logic is duplicated in
ApiResponseHelper.createDomainResponse(). Consider extracting this into a
shared helper method to avoid code duplication and maintain consistency.
```suggestion
ApiResponseHelper.populateDomainTags(domain.getUuid(),
domainResponse);
```
--
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]