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
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8423bd3b-757a-fdf6-3ffc-e5d93d8e0d7f |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B9A0:27F80E:E0CE2C:12F3D8C:6A4D8096 |
| html-safe-nonce | 24158237f5eb74d41622b26ee841d13439120146e266cdfe4f44695876a798cc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUEwOjI3RjgwRTpFMENFMkM6MTJGM0Q4Qzo2QTREODA5NiIsInZpc2l0b3JfaWQiOiIxNTg2MzY2OTc3MzgyNjQ1OTEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | daafb2a9e33c8eb2076f90637043c41989daf7a4e274481e00bf36c56f320136 |
| hovercard-subject-tag | pull_request:3933746057 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/apache/cloudstack/pull/13490/files |
| twitter:image | https://avatars.githubusercontent.com/u/159568571?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/159568571?s=400&v=4 |
| og:image:alt | 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... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6bf61c909482ec3072ef5d7a5a28f2a9d214788c9a44793eca1960048cb05ae |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/apache/cloudstack git https://github.com/apache/cloudstack.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 9759448 |
| octolytics-dimension-repository_nwo | apache/cloudstack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9759448 |
| octolytics-dimension-repository_network_root_nwo | apache/cloudstack |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6702a58b419a792226bd21ef0fb1bcb318bbcaa3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width