René's URL Explorer Experiment


Title: Refactor: Modularize ApiResponseHelper#createUsageResponse by PrashantBhanage · Pull Request #13490 · apache/cloudstack · GitHub

Open Graph Title: Refactor: Modularize ApiResponseHelper#createUsageResponse by PrashantBhanage · Pull Request #13490 · apache/cloudstack

X Title: Refactor: Modularize ApiResponseHelper#createUsageResponse by PrashantBhanage · Pull Request #13490 · apache/cloudstack

Description: Fixes #11635 Description This PR addresses the technical debt in ApiResponseHelper#createUsageResponse(Usage) by modularizing the 530-line method. Extracted the 500+ line switch/if-else block into a main dispatcher method populateUsageTypeSpecificDetails. Created 18 individual private helper methods for each specific UsageType to improve maintainability and readability. Introduced a UsageResourceDetails container class to safely manage and return resourceId and resourceType state for tag lookups. Verified zero business logic changes; strictly structural refactoring. Types of changes Breaking change (fix or feature that would cause existing functionality to change) New feature (non-breaking change which adds functionality) Bug fix (non-breaking change which fixes an issue) Enhancement (improves an existing feature and functionality) Cleanup (Code refactoring and cleanup, that may add test cases) Build/CI Test (unit or integration test code) Feature/Enhancement Scale or Bug Severity Feature/Enhancement Scale Major Minor Bug Severity BLOCKER Critical Major Minor Trivial Screenshots (if appropriate): N/A (Pure backend refactoring) How Has This Been Tested? Ran a successful clean compile locally to verify no structural or syntax breaks: mvn -pl server -DskipTests clean compile Passed all local Checkstyle validations. How did you try to break this feature and the system with this change? This is a pure structural refactor. Carefully verified that no business logic, string formatting, or calculations were altered. I am relying on the existing automated CI test suites to ensure data integrity and backward compatibility remain strictly intact.

Open Graph Description: Fixes #11635 Description This PR addresses the technical debt in ApiResponseHelper#createUsageResponse(Usage) by modularizing the 530-line method. Extracted the 500+ line switch/if-else block into...

X Description: Fixes #11635 Description This PR addresses the technical debt in ApiResponseHelper#createUsageResponse(Usage) by modularizing the 530-line method. Extracted the 500+ line switch/if-else block into...

Opengraph URL: https://github.com/apache/cloudstack/pull/13490

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:8423bd3b-757a-fdf6-3ffc-e5d93d8e0d7f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB9A0:27F80E:E0CE2C:12F3D8C:6A4D8096
html-safe-nonce24158237f5eb74d41622b26ee841d13439120146e266cdfe4f44695876a798cc
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUEwOjI3RjgwRTpFMENFMkM6MTJGM0Q4Qzo2QTREODA5NiIsInZpc2l0b3JfaWQiOiIxNTg2MzY2OTc3MzgyNjQ1OTEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacdaafb2a9e33c8eb2076f90637043c41989daf7a4e274481e00bf36c56f320136
hovercard-subject-tagpull_request:3933746057
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/apache/cloudstack/pull/13490/files
twitter:imagehttps://avatars.githubusercontent.com/u/159568571?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/159568571?s=400&v=4
og:image:altFixes #11635 Description This PR addresses the technical debt in ApiResponseHelper#createUsageResponse(Usage) by modularizing the 530-line method. Extracted the 500+ line switch/if-else block into...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec6bf61c909482ec3072ef5d7a5a28f2a9d214788c9a44793eca1960048cb05ae
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/apache/cloudstack git https://github.com/apache/cloudstack.git
octolytics-dimension-user_id47359
octolytics-dimension-user_loginapache
octolytics-dimension-repository_id9759448
octolytics-dimension-repository_nwoapache/cloudstack
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id9759448
octolytics-dimension-repository_network_root_nwoapache/cloudstack
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release6702a58b419a792226bd21ef0fb1bcb318bbcaa3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/apache/cloudstack/pull/13490/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fcloudstack%2Fpull%2F13490%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fcloudstack%2Fpull%2F13490%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=apache%2Fcloudstack
Reloadhttps://github.com/apache/cloudstack/pull/13490/files
Reloadhttps://github.com/apache/cloudstack/pull/13490/files
Reloadhttps://github.com/apache/cloudstack/pull/13490/files
Please reload this pagehttps://github.com/apache/cloudstack/pull/13490/files
apache https://github.com/apache
cloudstackhttps://github.com/apache/cloudstack
Notifications https://github.com/login?return_to=%2Fapache%2Fcloudstack
Fork 1.3k https://github.com/login?return_to=%2Fapache%2Fcloudstack
Star 3k https://github.com/login?return_to=%2Fapache%2Fcloudstack
Code https://github.com/apache/cloudstack
Issues 536 https://github.com/apache/cloudstack/issues
Pull requests 268 https://github.com/apache/cloudstack/pulls
Discussions https://github.com/apache/cloudstack/discussions
Actions https://github.com/apache/cloudstack/actions
Projects https://github.com/apache/cloudstack/projects
Wiki https://github.com/apache/cloudstack/wiki
Security and quality 0 https://github.com/apache/cloudstack/security
Insights https://github.com/apache/cloudstack/pulse
Code https://github.com/apache/cloudstack
Issues https://github.com/apache/cloudstack/issues
Pull requests https://github.com/apache/cloudstack/pulls
Discussions https://github.com/apache/cloudstack/discussions
Actions https://github.com/apache/cloudstack/actions
Projects https://github.com/apache/cloudstack/projects
Wiki https://github.com/apache/cloudstack/wiki
Security and quality https://github.com/apache/cloudstack/security
Insights https://github.com/apache/cloudstack/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fapache%2Fcloudstack%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fapache%2Fcloudstack%2Fissues%2Fnew%2Fchoose
PrashantBhanagehttps://github.com/PrashantBhanage
apache:mainhttps://github.com/apache/cloudstack/tree/main
PrashantBhanage:fix-11635-refactor-usagehttps://github.com/PrashantBhanage/cloudstack/tree/fix-11635-refactor-usage
Conversation 34 https://github.com/apache/cloudstack/pull/13490
Commits 7 https://github.com/apache/cloudstack/pull/13490/commits
Checks 0 https://github.com/apache/cloudstack/pull/13490/checks
Files changed 3 https://github.com/apache/cloudstack/pull/13490/files
Refactor: Modularize ApiResponseHelper#createUsageResponse https://github.com/apache/cloudstack/pull/13490/files#top
Show all changes 7 commits https://github.com/apache/cloudstack/pull/13490/files
61cb4ea Refactor: Modularize ApiResponseHelper#createUsageResponse PrashantBhanage Jun 25, 2026 https://github.com/apache/cloudstack/pull/13490/commits/61cb4ea0663a737e5a5cb27177c50907f9bad02e
b99f888 test: Add unit tests for 18 extracted UsageType helper methods PrashantBhanage Jun 26, 2026 https://github.com/apache/cloudstack/pull/13490/commits/b99f88857024537e96c7cd7c68e25c24b7f5c585
9838eb7 Merge branch 'main' into fix-11635-refactor-usage PrashantBhanage Jun 27, 2026 https://github.com/apache/cloudstack/pull/13490/commits/9838eb73b99700f18d4805f644537defd3957874
c6225bd fix: Apply Copilot null-check suggestions and remove unused variable PrashantBhanage Jul 4, 2026 https://github.com/apache/cloudstack/pull/13490/commits/c6225bd0dff78f857feaff994d076fad0169f9eb
c407a0c Fix: Replace internal X509CertImpl with standard Java API and remove … PrashantBhanage Jul 4, 2026 https://github.com/apache/cloudstack/pull/13490/commits/c407a0c99512b7164e7db1903bcad5cfac34f510
6c3b597 test: Fix populateIpAddressUsageResponseTest after Copilot refactor PrashantBhanage Jul 5, 2026 https://github.com/apache/cloudstack/pull/13490/commits/6c3b5972aa789e31974ece90af668e365981400a
a54428b Fix: Add missing EOF newline to ApiResponseHelperTest PrashantBhanage Jul 6, 2026 https://github.com/apache/cloudstack/pull/13490/commits/a54428bc108eb8e7fe4dd075c3d3c13baa98402e
Clear filters https://github.com/apache/cloudstack/pull/13490/files
Please reload this pagehttps://github.com/apache/cloudstack/pull/13490/files
Please reload this pagehttps://github.com/apache/cloudstack/pull/13490/files
pom.xml https://github.com/apache/cloudstack/pull/13490/files#diff-499f9785514a81b7e7e70d390700ba3314a034a444221a5b83f9c7cd05426340
ApiResponseHelper.java https://github.com/apache/cloudstack/pull/13490/files#diff-2f016edb6fdd628254c594507189d8c184508f58d7fd329e1b2fec17023c374e
ApiResponseHelperTest.java https://github.com/apache/cloudstack/pull/13490/files#diff-e84b5b67e067948dd5f3da6a93986d5756d6dd2d318850c350d4d896b864a146
server/pom.xmlhttps://github.com/apache/cloudstack/pull/13490/files#diff-499f9785514a81b7e7e70d390700ba3314a034a444221a5b83f9c7cd05426340
View file https://github.com/apache/cloudstack/blob/a54428bc108eb8e7fe4dd075c3d3c13baa98402e/server/pom.xml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/cloudstack/pull/13490/{{ revealButtonHref }}
https://github.com/apache/cloudstack/pull/13490/files#diff-499f9785514a81b7e7e70d390700ba3314a034a444221a5b83f9c7cd05426340
https://github.com/apache/cloudstack/pull/13490/files#diff-499f9785514a81b7e7e70d390700ba3314a034a444221a5b83f9c7cd05426340
Please reload this pagehttps://github.com/apache/cloudstack/pull/13490/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.