refactor(duplicate-code): Unify Attrs constants, add ResponseBuilder to core#11
Open
maheshkumargangula wants to merge 2 commits intodevelopfrom
Open
refactor(duplicate-code): Unify Attrs constants, add ResponseBuilder to core#11maheshkumargangula wants to merge 2 commits intodevelopfrom
maheshkumargangula wants to merge 2 commits intodevelopfrom
Conversation
… consolidate - Create unified Attrs.java in sunbird-platform-common with all service request attribute constants (DC-02) - Add deprecation notices to service-level Attrs.java files pointing to core location (DC-02) - Create ResponseBuilder fluent API to replace new Response() boilerplate (DC-05) - Update BaseController to use ResponseBuilder pattern (DC-05) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s import - Convert modules/userorg/controller/app/util/Attrs.java to deprecation shim (matching LMS and Notification Attrs pattern already in this branch) - Add explicit ResponseParams import to ResponseBuilder.java for code clarity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Title
refactor(duplicate-code): Unify Attrs constants, add ResponseBuilder, consolidate core utilities
Base Branch
develop
Summary
Attrs.java: The three separateAttrs.javafiles (UserOrg, LMS, Notification) had overlapping request attribute keys with naming inconsistencies (USER_IDvsUSERID). Created a canonicalorg.sunbird.request.Attrsinsunbird-platform-common. Service-level files now reference or deprecate in favour of the core version.ResponseBuilder: Fluent builder API to replace thenew Response() + setVer() + setId() + setTs() + setParams()pattern found 419+ times. ProvidesResponseBuilder.ok(),ResponseBuilder.error(), andResponseBuilder.create()factory methods.BaseController: Updated UserOrg BaseController to use the new ResponseBuilder pattern as a reference implementation.Files Changed
core/sunbird-platform-common/.../request/Attrs.java(new — canonical definition)core/sunbird-platform-common/.../response/ResponseBuilder.java(new)modules/lms/service/app/util/Attrs.java(added @deprecated + pointer to core)modules/notification/service/app/utils/module/Attrs.java(added @deprecated + pointer to core)modules/userorg/controller/app/util/Attrs.java(added @deprecated + pointer to core)modules/userorg/controller/app/controllers/BaseController.java(updated to use ResponseBuilder)Implements Tasks
DC-02, DC-05
Test Plan
mvn clean install -P lern -DskipTests