-
Notifications
You must be signed in to change notification settings - Fork 45
Fix the issue in fetching the value for fields #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
β¦n getting the value for income, education and occupation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes update JSON serialization in the Changes
Sequence Diagram(s)sequenceDiagram
participant Controller
participant RegisterBenificiaryServiceImpl
participant BeneficiaryModel
participant DTO
Controller->>RegisterBenificiaryServiceImpl: updateBenificiary(model)
RegisterBenificiaryServiceImpl->>BeneficiaryModel: Access occupation, education fields
alt occupation is present
RegisterBenificiaryServiceImpl->>DTO: Set occupation from model
else if demographic.occupation present
RegisterBenificiaryServiceImpl->>DTO: Set occupation from demographic
else
RegisterBenificiaryServiceImpl->>DTO: Set occupation from occupationName
end
alt education is present
RegisterBenificiaryServiceImpl->>DTO: Set education from model
else if demographic.educationName present
RegisterBenificiaryServiceImpl->>DTO: Set education from demographic
end
RegisterBenificiaryServiceImpl->>Controller: Return result
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (2)
src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java
(2 hunks)src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java
(3 hunks)
π§° Additional context used
π§ Learnings (2)
π Common learnings
Learnt from: srishtigrp78
PR: PSMRI/Common-API#166
File: src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java:422-431
Timestamp: 2025-03-03T05:44:08.973Z
Learning: In the Common-API project, JsonNode from Jackson library has been found to not work properly for certain JSON parsing tasks, so JSONObject is preferred in those cases, particularly in the GrievanceHandlingServiceImpl class.
src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java (1)
Learnt from: srishtigrp78
PR: PSMRI/Common-API#166
File: src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java:422-431
Timestamp: 2025-03-03T05:44:08.973Z
Learning: In the Common-API project, JsonNode from Jackson library has been found to not work properly for certain JSON parsing tasks, so JSONObject is preferred in those cases, particularly in the GrievanceHandlingServiceImpl class.
β° Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: style-check / checkstyle
- GitHub Check: Build
- GitHub Check: Package-test
- GitHub Check: Analyze (java)
π Additional comments (4)
src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java (2)
38-38
: Good addition for JSON property mapping.The import of
@JsonProperty
is correctly added to support the field annotations below.
215-215
: Proper JSON property mapping implemented.The
@JsonProperty
annotations correctly map the fields to their expected JSON property names:
occupationName
β"occupationOther"
incomeStatus
β"incomeName"
education
β"educationQualificationName"
This addresses the field value fetching issue mentioned in the PR objectives.
Also applies to: 220-220, 227-227
src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java (2)
123-123
: Minor typo fix in comment.Good catch fixing the typo from "OtherFedields" to "OtherFields" in the comment.
143-157
: Robust fallback mechanism implemented.The prioritized fallback approach for occupation and education fields is well-designed and addresses the field value fetching issue mentioned in the PR. The logic correctly handles cases where primary values might be null by falling back to demographic fields and then to alternative field names.
Also applies to: 220-234
src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java
Show resolved
Hide resolved
src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java
Show resolved
Hide resolved
@Expose | ||
private String occupation; | ||
@Expose | ||
@JsonProperty("incomeName") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't follow this. The string below looks different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't follow this. The string below looks different?
Yes. For these fields income, occupation and education, there is mismatch in the json property and entity names. So to tag those used 'JsonProperty'
src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java
Show resolved
Hide resolved
|
* Fix the issue in fetching the value for fields (#257) * fix: Add jsonProperty to map with the request body to fix the issue in getting the value for income, education and occupation * fix: remove commented code * Update version in pom.xml to 3.4.0 * Update pom.xml * Add ServerAuthorization key in allow headers (#275) * fix: add serverAuthorization * fix: add console * fix: correct the spelling * Nd/vs/token bengen issue (#280) * fix: add useragent as java to skip the token * fix: add logger * fix: add logger --------- Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com> Co-authored-by: Amoghavarsh <93114621+5Amogh@users.noreply.github.com> Co-authored-by: Mithun James <drtechie@users.noreply.github.com>
π Description
JIRA ID:
AMM-1411
Add JsonProperty to map the fields with request body to fetch the values for income status, education and occupation
β Type of Change
Summary by CodeRabbit
Bug Fixes
Style
New Features