-
Notifications
You must be signed in to change notification settings - Fork 24
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
Dev #1362
Conversation
* HLM-6385: added changes for IRS activity track and closed household concepts * HLM-6385: added changes for IRS activity track and closed household concepts, added db migration script, validations for closed household * HLM-6385: added changes for location tracking * HLM-6385: added changes for location points * HLM-6385: added clientReferenceId and tenantId in LocationPoint, updated Location_capture model * HLM-6385, HCMPRE-46: Updated changes as per design review * HLM-6385, HCMPRE-46: Added Location capture changes * HLM-6385, HCMPRE-46: Added UserAction changes * HLM-6385, HCMPRE-46: updated common models, replaced digit models with service-common * Revert "HLM-6385, HCMPRE-46: updated common models, replaced digit models with service-common" This reverts commit 6abdea4. * HLM-6385, HCMPRE-46: updated table informations and columns for migration scripts * reverting BoundaryUtil change * reverting BoundaryUtil changes * HLM-6385, HCMPRE-46: updated validators and IRSConsumer * HLM-6385, HCMPRE-46: updated validators * HLM-6385, HCMPRE-46: updated project configuration * HLM-6385, HCMPRE-49: updated models to have isDeleted as it is required in common utils enrichment code * HLM-6385, HCMPRE-46: updated the projectid field, added notnull annotation * HLM-6385, HCMPRE-46: updated all the changes related to enrichment * HLM-6385, HCMPRE-46: made action field notnull * HLM-6385, HCMPRE-46: updated locationCapture and userAction with mandatory latitude, longitude, locationAccuracy fields * HLM-6385, HCMPRE-46: updated locationCapture and userAction with mandatory latitude, longitude, locationAccuracy fields, HCMPRE-116, HCMPRE-117 * HLM-6385, HCMPRE-46: updated locationCapture and userAction with mandatory latitude, longitude, locationAccuracy fields, HCMPRE-116, HCMPRE-117, added in services * HLM-6385, HCMPRE-46: removed outdated changes from Task.java * removed all user location models * Refactored from LocationCapture model to UserAction and packges from irs to useraction * HLM-6385 - lat/long irs name changes * HLM Downsync Incremental product changes pull from impel (#831) * HLM Downsync Incremental product changes pull from impel * HLM removed impel specific changes * renamed Project type filter code constant * HLM updated beneficiary based search * HLM updated downsync search, cycles is required only when it is smc based campaign * HCM - removed project task resource quantity validator * HLM updated downsync logic as per review comments * HCMPRE-216 : Added Administration failed status for validation when task resource is empty or when status is ADMINISTRATION_FAILED * HCMPRE-216: updated task status * HCMPRE-216: changed to ADMINISTRATION_FAILED * HLM-6385: updated with code review comments * HLM-6385: added changes as per review comments, and added correct logs wherever required. * HLM-6385: code review comments addressed. * HLM-6385: review comment added for error handling on LocationCaptureRepository * HLM-6385: another batch of coderabbitai code review comments addressed. * HLM-6385: added more logs in repository for useraction and location capture * HLM-6385: updated the code as per code review comments from @kavi-egov --------- Co-authored-by: kavi_elrey <25226238+kavi-egov@users.noreply.github.com> Co-authored-by: Holash Chand <holash.c@beehyv.com>
* HLM closed household status * HCMPRE-240: validate no resource task status scenario with configurable statuses * HCMPRE-240: fixed issues related to string trimming * HLM fixed rowversion referral bug, mis placement of rowversion validator * HCMPRE-240: code review changes * HCMPRE-242: updated for null resources and address check * HCMPRE-242: added for proper null check * HCMPRE-242: added checks for task resource where ever applicable * HCMPRE-242: updated taskstatus to enum from string * HCMPRE-242, HCMPRE-240: renamed task's status field to taskStatus field, as there is contradiction with EgovModel status field * HCMPRE-242: fixed dupcalite entity cache issue for existing entity validation during bulk create * HCMPRE-242: updated project test case for taskStatus field contraints changes : not null * HCMPRE-242: fix generic repository code * HCMPRE-242: added taskstatus migration script * HCMPRE-240: updated PtIsResourceEmptyValidator, for task status * HLM-242: added changes as per code review * Revert "HCMPRE-242: added taskstatus migration script", and removed status field from EgovModel, and rename TaskStatus to status This reverts commit 7caf0c4. * HCMPRE-240: FIXED all task status reference --------- Co-authored-by: sivajiganesh-dev <sivajiganesh.dev@gmail.com>
* HLM rowmapper issue in household, referral fixed * HCMPRE-255: updated the changes for household * reverted local changes commit by mistake
* added logic for cascading project date updates * updated application.properties * refactored logic for using ProjectRequest pojo to send message to kafka instead of Ancestor and Descendant Projects pojo * added comments and enhanced search project logic * made public back to private * made more concise the method in project service separated create project map logic * separated concerns of update based on action whether null or updateProjectDates * updated action logic for just test purpose * updated version of health-service-models library * update logic * updated final logic for cascading update project dates based on flag in project request * reverted config * reverted config 2 * added multiple line comments * udpated error messages
* HLM fixed issues in useraction existent entity validator * updated after code review comments
* updated version for hcm v1.5 release * HLM updated the code as per code review from code rabbit * HCMPRE-209: updated code review comments and code documentation
* removed digit-models from health-services-models library * removed digit-models from health-services-models library * added SMSRequest model * Updated individual models * Updating health services models version in health services common library * version bump * hcmpre-309: merged removed-digit-models and rebase to dev * HLM-309: updated common models version --------- Co-authored-by: shubhang-egov <shubhang.dhanesha@egovernments.org>
* HCMPRE-169 code review comments * HCMPRE-169 adding code comments * HCMPRE-169 adding code comments * HCMPRE-169 changing mdms v2 field name for uom * HCMPRE-169 code review comments * HCMPRE-169 code review comments
* HCMPRE-218 adding validation for name validation * HCMPRE-218 adding validation for name validation * HCMPRE-218 moving "$." into constants * HCMPRE-218 code review comments --------- Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com>
* Removed the project facility mapping validation check as it is not required * Removed the project facilty valaidation check in ValidatorUtil.java * Removed the local receiverId in ValidatorUtil.java --------- Co-authored-by: Shashwat12-egov <shashwat.k@egovernments.org>
* Removed the project facility mapping validation check as it is not required * Removed the project facilty valaidation check in ValidatorUtil.java * Removed the local receiverId in ValidatorUtil.java * Validating the sender and receiver based on transactiontype * Validating the sender and receiver based on transactiontype * Corrected the validation for the failed case * Added the comments --------- Co-authored-by: kanishq-egov <138671649+kanishq-egov@users.noreply.github.com> Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com>
* update service definition api added * fix values persister config * fix "values" persister config * active added in service definition persister config * resolved code review comments * added includeDeleted parameter in search * fix some issues * fix create api
* changed additionalDetails to additionalFields * boolean data type added in attribute definition * Added the filter for isActive * changed the serviceDefinition.code size from character varying(64) to character varying(256) * Revert "changed the serviceDefinition.code size from character varying(64) to character varying(256)" This reverts commit 24c971f. * Revert "Added the filter for isActive" This reverts commit 09d65c4. * changed the code character size from 64 to 256 (#1147) Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com> * added validation for boolean data type in service-request --------- Co-authored-by: yashita-egov <yashita.bansal@egovernments.org> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com>
* HCMPRE-469: added changes for facility count * HCMPRE-469: added changes for models, added totalCount fields in required model classes * HCMPRE-469: added changes for project facility, project staff, project resource, hf-referral, stock and stock reconciliation, also added helper function in common utils for findWithCount * HCMPRE-469: added changes for removing digit-models deprecated dependency, replaced with tracer library references and mdms client references * HCMPRE-469: added changes for project service, removed reference for digits model * Removed the dev from version * Removed the dev from version of common libraries * Removed the dev from version of common libraries * Removed the order by id statement while searching the facility * Removed setting of total count line from the FacilityService file * Removed setting of total count line from the FacilityService file --------- Co-authored-by: Shashwat12-egov <shashwat.k@egovernments.org> Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com>
… resource-generator service) (#1176) * HCMPRE-599 updating Plan service models * HCMPRE-599 updating Plan service models * HCMPRE-599 changes * HCMPRE-599 adding census POJOs * HCMPRE-599changes for triggering pland census records on workflow status * HCMPRE-599 app.prop changes for resource generator service * Renaming resource-estimation-service to resource-generator * HCMPRE-1078 enrichment of resource mapping * HCMPRE-1122 changing processing logic * HCMPRE-1122 changing processing logic * HCMPRE-1122 updating operation related validations * HCMPRE-1122 adding method comments * enhancement in facilityCatchmentConsumer * enhancement in facilityCatchmentConsumer * removing catchement topic that was added before * added wf validation for approving estimations * adding additionalDetails as string while preparing rows for batchUpdate * adding additionalDetails as string while preparing rows for batchUpdate * HCMPRE-1094 changes for facility mapping create trigger on workflow * reverting the change in census-bulk-api * parsing additional details in bulk update api * Added plan config name in plan employee's and plan facility's search criteria * Bypassing validations for operations when source is CUSTOM * added workflow validations * removing unused service constants * Changes for triggering plan-facility mapping * adding project factory data create host * handling case for empty areaCodes in search criteria * handling case for empty areaCodes in search criteria * adding project factory data create host * Adding facility create trigger status * Adding additionalField table in census * adding plan config name in plan employee and plan facility pojo * Adding additionalField table in census * implemented partial search in plan config name * Changing datatype of value * HCMPRE-1162 enrich additionalfieldForCensus * HCMPRE-1162 enrich additionalfieldForCensus * updated query builder for census * handling null pointer exception on updating additional details * Changes to allow assumption values in input * Removing older method for getting input value * Making editable false for uploaded additional field during census create * HCMPRE-853 removing lat long fields from additional field overridekeys * Changes for adding execution order for operations * Changes for adding execution order for operations * Adding facilityName column and enriching servingPop * HCMPRE-853 added chnages for census search and fetching boundarycodes from one sheet * HCMPRE-853 changes for updating file with approved census data * HCMPRE-853 adding logs * pull from microplanning-dev * HCMPRE-853 integrating with project factory with updated resources * modification in wf-service * workflow auto-assignee issue * HCMPRE-853 commenting project factory integration * adding pagination for plan-employee api * changed the data type of BigDecimal * HCMPRE-1282 changes for updating estimates into plan * HCMPRE-1282 app.prop changes * Adding case for when celltype is formula. * enriching additional details with additional field key-value * modified orderBy clause * made changes in order by clause * added facilityType * pull from microplanning-dev * making fuzzy search cAse-insenSItive * making fuzzy search cAse-insenSItive * making fuzzy search cAse-insenSItive * pull from microplanning-dev * pull from microplanning-dev * modified pagination * HCMPRE-1282 changes for updating approved plans into file for campaign integration * added planConfigStatus in search criteria * HCMPRE-1282 changes for updating approved plans into file for campaign integration * HCMPRE-771 merging multiple alter table migration scripts into create table scripts. * Adding workflow restricted roles in census * Adding workflow restricted roles in census * Fixing limit and adding check for empty row * Fixing limit and adding check for empty row * added ranked query for plan employee assignment * added ranked query for plan employee assignment * HCMPRE-1300 DB migration script cleanup * adding plan bulk update topic * Adding facility name in census additional details * Wf auto assignment to multiple people * Wf auto assignment to multiple people * Adding boundaryTypeHierarchy Pojos and search endpoint * enriching jurisdiction mapping in census * changing jurisdictionMapping from jsonIgnore to jsonProperty * optimizing the enrichment functions and adding comments * handling null pointer exception * Wf auto assignment to multiple people * Set last modified time on update call * enriching serving population with sum of confirmed target population of serving boundaries * Reverting campaign update at the end. * modifying Wf for send back actions * enriching jurisdiction mapping in plan * setting assignees separetly for send back actions * Changing assignee column to Text in db * Changing assignee column to Text in db * enriching jurisdiction mapping * Changing validation logic for operations * enriching jurisdiction mapping * Changes for only validating when operation is active * Sort operations in planconfig search by execution order * Sort operations in planconfig search by execution order * Sort operations in planconfig search by execution order * Sort operations in planconfig search by execution order * type casting jurisdiction into list * Adding census changelog * Adding census changelog * Adding census changelog * Adding census changelog * Adding census changelog * Show on UI false for lat long fields * Updated plan service CHANGELOG * update plan config validation * Adding jurisdiction mapping in plan facility * Changing all collection dataType from list to set in API search criteria * Changing all collection dataType from list to set in API search criteria * removing validation for operation source * adding overloaded method for query builder in plan * adding overloaded method for query builder in plan * Adding validation to check for duplicates * pull from census-bulk-api * pull from census-bulk-api * Removing comments from WF in resource generator * Decreasing min size of assumptionvalue in Operation POJO to 1. * Changing mdms master in plan service for hierarchyConfig * changing min size of resource type in resource pojo * increasing request size for producer * changed version from 1.1.0 to 1.0.0 * changed version from 1.1.0 to 1.0.0 * changing the order * changing the order * changing the order * Increasing request size in application.properties * Updating resource generator changelog * Updating resource generator changelog * Adding boundaryAncestralPath for Plan Facility API * Adding boundaryAncestralPath for Plan Facility API * Adding ProjectFactory consumer in Plan Facility Service * Adding ProjectFactory consumer in Plan Facility Service * Adding plan changelog * Adding empty list as service boundary when null in consumer for project-factory * Increasing the max-request-size in census producer configuration * Increasing the max-request-size in plan producer configuration * Adding orderBy clause for plan search query * Removing unused census consumer * Replacing map from set for duplicate check in census row mapper * Replacing map from set for duplicate check in plan config row mapper * Replacing map from set for duplicate check in census row mapper * Replacing map from set for duplicate check in census row mapper * Replacing map from set for duplicate check in plan config row mapper * Replacing map from set for duplicate check in plan row mapper * Clearing set on new census entry * Clearing set on new plan entry * Clearing set on new plan config entry --------- Co-authored-by: Shashwat Mishra <71879793+shashwat-egov@users.noreply.github.com> Co-authored-by: Tanishi Goyal <tanishi.goyal@egovernments.org>
* Beneficiary Type enum added * clf model changes * Changed version to 25 --------- Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com>
* added enum beneficiary type * changed validation from mdms to additonal details * resolved library conflicts * added beneficiary type * changed health- model version * health-service-model verson changed in project service * changed health-service model version in project service * resolved review comments * separte out model changes
* updated changelog for health-services-model * updated changelog * Update CHANGELOG.md --------- Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com>
…ervice for email notification feature, UUID and role search changes, Pagination and case insensitive fuzzy search in user name (#1337) * Total count enhancement in HRMS * Corrected count query logic * Fixed HRMS total count * Fixed hrms uuids search * Fixed HRMS search response * added email notification service * added email notification service * changing implementation partner * Adding last modified date sorting clause in HRMS search query * Adding case insensitive search * Revert "Adding last modified date sorting clause in HRMS search query" This reverts commit c287376. * changing implementation partner * HCMPRE-1333- Removed dense rank query; using sequential calls to get child table data. (#1210) * Revert "HCMPRE-1333- Removed dense rank query; using sequential calls to get child table data. (#1210)" This reverts commit 2d2d4cc. * Added comments and resolved some coderabbit review comments * Removing IndividualBulkResponse class and importing from library * updating version for org.egov.services.services-common * using IndividualBulkResponse class in egov-hrms --------- Co-authored-by: Shashwat Mishra <shashwat.mishra@egovernments.org> Co-authored-by: Shashwat Mishra <71879793+shashwat-egov@users.noreply.github.com> Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com>
* Added support to search projects based on ancestor ids * changed ancestor ids to a boolean isAncestorProjectId * minor fix * Fixed java heap problem due to no filter in include descendants, include ancestors etc queries * Added support to find root level project * Added missing parameter * Added code comments * incremented version of project service * added change log
Caution Review failedThe pull request is closed. WalkthroughThis pull request encompasses a comprehensive set of changes across multiple services, primarily focusing on the HRMS (Human Resource Management System) and Household modules. The modifications include adding email notification capabilities, introducing household type validation, enhancing project search functionality, and updating various models and configurations. The changes span dependency management, database schema updates, service logic modifications, and the introduction of new validation mechanisms. Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
* HCMPRE-1254-Adding household type for communal living facility * HCMPRE-1254-Fixed community validator * HCMPRE-1254-household type rowmapper * model dev change * changing search param to string * changing pom snapshot * Family type search query * equal ignore case * fetching null records also * household type change validator * adding brackets in household type * review comment fixes * models version to 24 * adding comment * Removing models changes as it has been added in other PR * adding default and not null in householdType --------- Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com>
* Dev (#1235) * Hlm 6385 irs changes (#841) * HLM-6385: added changes for IRS activity track and closed household concepts * HLM-6385: added changes for IRS activity track and closed household concepts, added db migration script, validations for closed household * HLM-6385: added changes for location tracking * HLM-6385: added changes for location points * HLM-6385: added clientReferenceId and tenantId in LocationPoint, updated Location_capture model * HLM-6385, HCMPRE-46: Updated changes as per design review * HLM-6385, HCMPRE-46: Added Location capture changes * HLM-6385, HCMPRE-46: Added UserAction changes * HLM-6385, HCMPRE-46: updated common models, replaced digit models with service-common * Revert "HLM-6385, HCMPRE-46: updated common models, replaced digit models with service-common" This reverts commit 6abdea4. * HLM-6385, HCMPRE-46: updated table informations and columns for migration scripts * reverting BoundaryUtil change * reverting BoundaryUtil changes * HLM-6385, HCMPRE-46: updated validators and IRSConsumer * HLM-6385, HCMPRE-46: updated validators * HLM-6385, HCMPRE-46: updated project configuration * HLM-6385, HCMPRE-49: updated models to have isDeleted as it is required in common utils enrichment code * HLM-6385, HCMPRE-46: updated the projectid field, added notnull annotation * HLM-6385, HCMPRE-46: updated all the changes related to enrichment * HLM-6385, HCMPRE-46: made action field notnull * HLM-6385, HCMPRE-46: updated locationCapture and userAction with mandatory latitude, longitude, locationAccuracy fields * HLM-6385, HCMPRE-46: updated locationCapture and userAction with mandatory latitude, longitude, locationAccuracy fields, HCMPRE-116, HCMPRE-117 * HLM-6385, HCMPRE-46: updated locationCapture and userAction with mandatory latitude, longitude, locationAccuracy fields, HCMPRE-116, HCMPRE-117, added in services * HLM-6385, HCMPRE-46: removed outdated changes from Task.java * removed all user location models * Refactored from LocationCapture model to UserAction and packges from irs to useraction * HLM-6385 - lat/long irs name changes * HLM Downsync Incremental product changes pull from impel (#831) * HLM Downsync Incremental product changes pull from impel * HLM removed impel specific changes * renamed Project type filter code constant * HLM updated beneficiary based search * HLM updated downsync search, cycles is required only when it is smc based campaign * HCM - removed project task resource quantity validator * HLM updated downsync logic as per review comments * HCMPRE-216 : Added Administration failed status for validation when task resource is empty or when status is ADMINISTRATION_FAILED * HCMPRE-216: updated task status * HCMPRE-216: changed to ADMINISTRATION_FAILED * HLM-6385: updated with code review comments * HLM-6385: added changes as per review comments, and added correct logs wherever required. * HLM-6385: code review comments addressed. * HLM-6385: review comment added for error handling on LocationCaptureRepository * HLM-6385: another batch of coderabbitai code review comments addressed. * HLM-6385: added more logs in repository for useraction and location capture * HLM-6385: updated the code as per code review comments from @kavi-egov --------- Co-authored-by: kavi_elrey <25226238+kavi-egov@users.noreply.github.com> Co-authored-by: Holash Chand <holash.c@beehyv.com> * Hcmpre 240 (#846) * HLM closed household status * HCMPRE-240: validate no resource task status scenario with configurable statuses * HCMPRE-240: fixed issues related to string trimming * HLM fixed rowversion referral bug, mis placement of rowversion validator * HCMPRE-240: code review changes * HCMPRE-242: updated for null resources and address check * HCMPRE-242: added for proper null check * HCMPRE-242: added checks for task resource where ever applicable * HCMPRE-242: updated taskstatus to enum from string * HCMPRE-242, HCMPRE-240: renamed task's status field to taskStatus field, as there is contradiction with EgovModel status field * HCMPRE-242: fixed dupcalite entity cache issue for existing entity validation during bulk create * HCMPRE-242: updated project test case for taskStatus field contraints changes : not null * HCMPRE-242: fix generic repository code * HCMPRE-242: added taskstatus migration script * HCMPRE-240: updated PtIsResourceEmptyValidator, for task status * HLM-242: added changes as per code review * Revert "HCMPRE-242: added taskstatus migration script", and removed status field from EgovModel, and rename TaskStatus to status This reverts commit 7caf0c4. * HCMPRE-240: FIXED all task status reference --------- Co-authored-by: sivajiganesh-dev <sivajiganesh.dev@gmail.com> * HLM rowmapper issue in household, referral fixed (#848) * HLM rowmapper issue in household, referral fixed * HCMPRE-255: updated the changes for household * reverted local changes commit by mistake * added logic for cascading project date updates (#834) * added logic for cascading project date updates * updated application.properties * refactored logic for using ProjectRequest pojo to send message to kafka instead of Ancestor and Descendant Projects pojo * added comments and enhanced search project logic * made public back to private * made more concise the method in project service separated create project map logic * separated concerns of update based on action whether null or updateProjectDates * updated action logic for just test purpose * updated version of health-service-models library * update logic * updated final logic for cascading update project dates based on flag in project request * reverted config * reverted config 2 * added multiple line comments * udpated error messages * HLM fixed issues in useraction existent entity validator (#850) * HLM fixed issues in useraction existent entity validator * updated after code review comments * updated version for hcm v1.5 release (#852) * updated version for hcm v1.5 release * HLM updated the code as per code review from code rabbit * HCMPRE-209: updated code review comments and code documentation * Hcmpre 309 rebase (#857) * removed digit-models from health-services-models library * removed digit-models from health-services-models library * added SMSRequest model * Updated individual models * Updating health services models version in health services common library * version bump * hcmpre-309: merged removed-digit-models and rebase to dev * HLM-309: updated common models version --------- Co-authored-by: shubhang-egov <shubhang.dhanesha@egovernments.org> * HCMPRE-169 code review comments (#835) * HCMPRE-169 code review comments * HCMPRE-169 adding code comments * HCMPRE-169 adding code comments * HCMPRE-169 changing mdms v2 field name for uom * HCMPRE-169 code review comments * HCMPRE-169 code review comments * HCMPRE-218 adding validation for plan config name (#844) * HCMPRE-218 adding validation for name validation * HCMPRE-218 adding validation for name validation * HCMPRE-218 moving "$." into constants * HCMPRE-218 code review comments --------- Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com> * HCMPRE-646: added changes (#897) * Update CODEOWNERS (#924) * Hcmpre 639 shashwat changes (#919) * Removed the project facility mapping validation check as it is not required * Removed the project facilty valaidation check in ValidatorUtil.java * Removed the local receiverId in ValidatorUtil.java --------- Co-authored-by: Shashwat12-egov <shashwat.k@egovernments.org> * Fixed multiple role search in individual service (#992) * Hcmpre 639 shashwat changes (#973) * Removed the project facility mapping validation check as it is not required * Removed the project facilty valaidation check in ValidatorUtil.java * Removed the local receiverId in ValidatorUtil.java * Validating the sender and receiver based on transactiontype * Validating the sender and receiver based on transactiontype * Corrected the validation for the failed case * Added the comments --------- Co-authored-by: kanishq-egov <138671649+kanishq-egov@users.noreply.github.com> Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com> * HCMPRE-371: Added service definition update api (#996) * update service definition api added * fix values persister config * fix "values" persister config * active added in service definition persister config * resolved code review comments * added includeDeleted parameter in search * fix some issues * fix create api * Update ValidatorUtil.java (#1112) * added-search-criterias-project-service (#1169) * Service additional field (#1146) * changed additionalDetails to additionalFields * boolean data type added in attribute definition * Added the filter for isActive * changed the serviceDefinition.code size from character varying(64) to character varying(256) * Revert "changed the serviceDefinition.code size from character varying(64) to character varying(256)" This reverts commit 24c971f. * Revert "Added the filter for isActive" This reverts commit 09d65c4. * changed the code character size from 64 to 256 (#1147) Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com> * added validation for boolean data type in service-request --------- Co-authored-by: yashita-egov <yashita.bansal@egovernments.org> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com> * Hcmpre 469 pagination all (#891) * HCMPRE-469: added changes for facility count * HCMPRE-469: added changes for models, added totalCount fields in required model classes * HCMPRE-469: added changes for project facility, project staff, project resource, hf-referral, stock and stock reconciliation, also added helper function in common utils for findWithCount * HCMPRE-469: added changes for removing digit-models deprecated dependency, replaced with tracer library references and mdms client references * HCMPRE-469: added changes for project service, removed reference for digits model * Removed the dev from version * Removed the dev from version of common libraries * Removed the dev from version of common libraries * Removed the order by id statement while searching the facility * Removed setting of total count line from the FacilityService file * Removed setting of total count line from the FacilityService file --------- Co-authored-by: Shashwat12-egov <shashwat.k@egovernments.org> Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com> * PR to develop branch for Microplanning v0.1 (changes in plan-service, resource-generator service) (#1176) * HCMPRE-599 updating Plan service models * HCMPRE-599 updating Plan service models * HCMPRE-599 changes * HCMPRE-599 adding census POJOs * HCMPRE-599changes for triggering pland census records on workflow status * HCMPRE-599 app.prop changes for resource generator service * Renaming resource-estimation-service to resource-generator * HCMPRE-1078 enrichment of resource mapping * HCMPRE-1122 changing processing logic * HCMPRE-1122 changing processing logic * HCMPRE-1122 updating operation related validations * HCMPRE-1122 adding method comments * enhancement in facilityCatchmentConsumer * enhancement in facilityCatchmentConsumer * removing catchement topic that was added before * added wf validation for approving estimations * adding additionalDetails as string while preparing rows for batchUpdate * adding additionalDetails as string while preparing rows for batchUpdate * HCMPRE-1094 changes for facility mapping create trigger on workflow * reverting the change in census-bulk-api * parsing additional details in bulk update api * Added plan config name in plan employee's and plan facility's search criteria * Bypassing validations for operations when source is CUSTOM * added workflow validations * removing unused service constants * Changes for triggering plan-facility mapping * adding project factory data create host * handling case for empty areaCodes in search criteria * handling case for empty areaCodes in search criteria * adding project factory data create host * Adding facility create trigger status * Adding additionalField table in census * adding plan config name in plan employee and plan facility pojo * Adding additionalField table in census * implemented partial search in plan config name * Changing datatype of value * HCMPRE-1162 enrich additionalfieldForCensus * HCMPRE-1162 enrich additionalfieldForCensus * updated query builder for census * handling null pointer exception on updating additional details * Changes to allow assumption values in input * Removing older method for getting input value * Making editable false for uploaded additional field during census create * HCMPRE-853 removing lat long fields from additional field overridekeys * Changes for adding execution order for operations * Changes for adding execution order for operations * Adding facilityName column and enriching servingPop * HCMPRE-853 added chnages for census search and fetching boundarycodes from one sheet * HCMPRE-853 changes for updating file with approved census data * HCMPRE-853 adding logs * pull from microplanning-dev * HCMPRE-853 integrating with project factory with updated resources * modification in wf-service * workflow auto-assignee issue * HCMPRE-853 commenting project factory integration * adding pagination for plan-employee api * changed the data type of BigDecimal * HCMPRE-1282 changes for updating estimates into plan * HCMPRE-1282 app.prop changes * Adding case for when celltype is formula. * enriching additional details with additional field key-value * modified orderBy clause * made changes in order by clause * added facilityType * pull from microplanning-dev * making fuzzy search cAse-insenSItive * making fuzzy search cAse-insenSItive * making fuzzy search cAse-insenSItive * pull from microplanning-dev * pull from microplanning-dev * modified pagination * HCMPRE-1282 changes for updating approved plans into file for campaign integration * added planConfigStatus in search criteria * HCMPRE-1282 changes for updating approved plans into file for campaign integration * HCMPRE-771 merging multiple alter table migration scripts into create table scripts. * Adding workflow restricted roles in census * Adding workflow restricted roles in census * Fixing limit and adding check for empty row * Fixing limit and adding check for empty row * added ranked query for plan employee assignment * added ranked query for plan employee assignment * HCMPRE-1300 DB migration script cleanup * adding plan bulk update topic * Adding facility name in census additional details * Wf auto assignment to multiple people * Wf auto assignment to multiple people * Adding boundaryTypeHierarchy Pojos and search endpoint * enriching jurisdiction mapping in census * changing jurisdictionMapping from jsonIgnore to jsonProperty * optimizing the enrichment functions and adding comments * handling null pointer exception * Wf auto assignment to multiple people * Set last modified time on update call * enriching serving population with sum of confirmed target population of serving boundaries * Reverting campaign update at the end. * modifying Wf for send back actions * enriching jurisdiction mapping in plan * setting assignees separetly for send back actions * Changing assignee column to Text in db * Changing assignee column to Text in db * enriching jurisdiction mapping * Changing validation logic for operations * enriching jurisdiction mapping * Changes for only validating when operation is active * Sort operations in planconfig search by execution order * Sort operations in planconfig search by execution order * Sort operations in planconfig search by execution order * Sort operations in planconfig search by execution order * type casting jurisdiction into list * Adding census changelog * Adding census changelog * Adding census changelog * Adding census changelog * Adding census changelog * Show on UI false for lat long fields * Updated plan service CHANGELOG * update plan config validation * Adding jurisdiction mapping in plan facility * Changing all collection dataType from list to set in API search criteria * Changing all collection dataType from list to set in API search criteria * removing validation for operation source * adding overloaded method for query builder in plan * adding overloaded method for query builder in plan * Adding validation to check for duplicates * pull from census-bulk-api * pull from census-bulk-api * Removing comments from WF in resource generator * Decreasing min size of assumptionvalue in Operation POJO to 1. * Changing mdms master in plan service for hierarchyConfig * changing min size of resource type in resource pojo * increasing request size for producer * changed version from 1.1.0 to 1.0.0 * changed version from 1.1.0 to 1.0.0 * changing the order * changing the order * changing the order * Increasing request size in application.properties * Updating resource generator changelog * Updating resource generator changelog * Adding boundaryAncestralPath for Plan Facility API * Adding boundaryAncestralPath for Plan Facility API * Adding ProjectFactory consumer in Plan Facility Service * Adding ProjectFactory consumer in Plan Facility Service * Adding plan changelog * Adding empty list as service boundary when null in consumer for project-factory * Increasing the max-request-size in census producer configuration * Increasing the max-request-size in plan producer configuration * Adding orderBy clause for plan search query * Removing unused census consumer * Replacing map from set for duplicate check in census row mapper * Replacing map from set for duplicate check in plan config row mapper * Replacing map from set for duplicate check in census row mapper * Replacing map from set for duplicate check in census row mapper * Replacing map from set for duplicate check in plan config row mapper * Replacing map from set for duplicate check in plan row mapper * Clearing set on new census entry * Clearing set on new plan entry * Clearing set on new plan config entry --------- Co-authored-by: Shashwat Mishra <71879793+shashwat-egov@users.noreply.github.com> Co-authored-by: Tanishi Goyal <tanishi.goyal@egovernments.org> --------- Co-authored-by: kanishq-egov <138671649+kanishq-egov@users.noreply.github.com> Co-authored-by: kavi_elrey <25226238+kavi-egov@users.noreply.github.com> Co-authored-by: Holash Chand <holash.c@beehyv.com> Co-authored-by: sivajiganesh-dev <sivajiganesh.dev@gmail.com> Co-authored-by: nitish-egov <137176807+nitish-egov@users.noreply.github.com> Co-authored-by: shubhang-egov <shubhang.dhanesha@egovernments.org> Co-authored-by: Priyanka-eGov <74049060+Priyanka-eGov@users.noreply.github.com> Co-authored-by: Shashwat12-egov <shashwat.k@egovernments.org> Co-authored-by: Shashwat Mishra <71879793+shashwat-egov@users.noreply.github.com> Co-authored-by: yashita-egov <yashita.bansal@egovernments.org> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com> Co-authored-by: Tanishi Goyal <tanishi.goyal@egovernments.org> * Moving PlanValidator and PlanEnricher to respective folders. (#1280) * fixed import issues (#1281) Co-authored-by: kavi_elrey <25226238+kavi-egov@users.noreply.github.com> --------- Co-authored-by: Naveen J <83631045+naveen-egov@users.noreply.github.com> Co-authored-by: kanishq-egov <138671649+kanishq-egov@users.noreply.github.com> Co-authored-by: kavi_elrey <25226238+kavi-egov@users.noreply.github.com> Co-authored-by: sivajiganesh-dev <sivajiganesh.dev@gmail.com> Co-authored-by: nitish-egov <137176807+nitish-egov@users.noreply.github.com> Co-authored-by: shubhang-egov <shubhang.dhanesha@egovernments.org> Co-authored-by: Priyanka-eGov <74049060+Priyanka-eGov@users.noreply.github.com> Co-authored-by: Shashwat12-egov <shashwat.k@egovernments.org> Co-authored-by: Shashwat Mishra <71879793+shashwat-egov@users.noreply.github.com> Co-authored-by: yashita-egov <yashita.bansal@egovernments.org> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: shubhang-eGov <70943369+shubhang-eGov@users.noreply.github.com> Co-authored-by: Tanishi Goyal <tanishi.goyal@egovernments.org>
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.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.
🛑 Comments failed to post (61)
health-services/household/src/main/java/org/egov/household/validators/household/HCommunityValidator.java (3)
22-24: 🧹 Nitpick (assertive)
Unused logger annotation.
The class is annotated with
@Slf4j
, but there are no log statements. If logging isn’t required, consider removing the@Slf4j
annotation to keep the code clean. Otherwise, add log statements where appropriate for traceability.
47-57: 🧹 Nitpick (assertive)
Provide detailed context in the error message.
Currently, the error message is generic. Consider enhancing it to include the problematic household’s identifier (e.g.,
household.getId()
) or user details for clarity when troubleshooting access issues.Error error = Error.builder() .errorMessage(String.format("User doesn't have permission to create/update community household. Household id: %s", household.getId())) .errorCode("COMMUNITY_USER_ACCESS_DENIED") .type(Error.ErrorType.NON_RECOVERABLE) .exception(new CustomException("COMMUNITY_USER_ACCESS_DENIED", String.format("User doesn't have permission to create/update community household. Household id: %s", household.getId()))) .build();📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.communityHouseholds.forEach(household -> { Error error = Error.builder() .errorMessage(String.format("User doesn't have permission to create/update community household. Household id: %s", household.getId())) .errorCode("COMMUNITY_USER_ACCESS_DENIED") .type(Error.ErrorType.NON_RECOVERABLE) .exception(new CustomException("COMMUNITY_USER_ACCESS_DENIED", String.format("User doesn't have permission to create/update community household. Household id: %s", household.getId()))) .build(); // Populate error details for the household populateErrorDetails(household, error, errorDetailsMap); }); }
43-46:
⚠️ Potential issuePotential null-pointer risk on user roles.
request.getRequestInfo().getUserInfo().getRoles()
is accessed without null checks. IfrequestInfo
oruserInfo
is null, this could throw aNullPointerException
. Consider adding defensive checks or ensuring thatrequestInfo
anduserInfo
are never null prior to validator invocation.+ if (request.getRequestInfo() == null || request.getRequestInfo().getUserInfo() == null) { + log.error("Missing user info in request."); + // Optionally populate an error object or handle gracefully + }Committable suggestion skipped: line range outside the PR's diff.
core-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeResponse.java (1)
73-75: 🧹 Nitpick (assertive)
LGTM! Consider adding documentation.
The field addition follows the existing naming conventions and properly uses
@Builder.Default
for initialization. Consider adding Javadoc to document the purpose and usage of this field.Add documentation above the field:
+ /** + * Total count of employees returned from the user service. + * Defaults to 0 if not explicitly set. + */ @JsonProperty("TotalCount") @Builder.Default private Long totalCount = 0L;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements./** * Total count of employees returned from the user service. * Defaults to 0 if not explicitly set. */ @JsonProperty("TotalCount") @Builder.Default private Long totalCount = 0L;
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/referralmanagement/beneficiarydownsync/DownsyncCLFHouseholdResponse.java (3)
19-20: 🧹 Nitpick (assertive)
Consider following standard JSON naming conventions.
The
@JsonProperty
annotations use PascalCase ("ResponseInfo", "Households") which is uncommon in JSON. Consider using camelCase for consistency with typical JSON conventions.-@JsonProperty("ResponseInfo") +@JsonProperty("responseInfo") private ResponseInfo responseInfo; -@JsonProperty("Households") +@JsonProperty("households") -private DownsyncCLFHousehold Households; +private List<DownsyncCLFHousehold> households;Also applies to: 22-23
12-16: 🧹 Nitpick (assertive)
Consider using more specific Lombok annotations.
Instead of using
@Data
, consider using a more specific combination of annotations like@Getter
and@ToString
. The@Data
annotation includes@EqualsAndHashCode
which might not be necessary for a response model and could potentially cause issues if not properly implemented.-@Data +@Getter +@ToString @NoArgsConstructor @AllArgsConstructor @Builder📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@Getter @ToString @NoArgsConstructor @AllArgsConstructor @Builder
22-23: 🛠️ Refactor suggestion
Fix field naming convention and type mismatch.
The
Households
field has several issues:
- The field name starts with an uppercase letter, violating Java naming conventions
- The name suggests a collection, but the type is a single
DownsyncCLFHousehold
@JsonProperty("Households") -private DownsyncCLFHousehold Households; +private List<DownsyncCLFHousehold> households;Committable suggestion skipped: line range outside the PR's diff.
core-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java (2)
26-55: 🧹 Nitpick (assertive)
Add size constraints to String fields.
Consider adding
@Size
constraints to other String fields (codes, names, phone, etc.) to prevent potential issues with extremely large strings. This helps in:
- Validating input data
- Preventing potential performance issues
- Ensuring database column size compatibility
Example implementation:
@Size(max = 100) private List<String> codes; @Size(max = 100) private List<String> names; @Size(max = 50) private List<String> departments; @Size(max = 50) private List<String> designations; @Size(max = 10) private String phone;
46-46: 🛠️ Refactor suggestion
Update
isCriteriaEmpty
method to include the new field.The newly added
userServiceUuids
field should be included in theisCriteriaEmpty
check to maintain consistency with other fields.Apply this diff to update the method:
public boolean isCriteriaEmpty(EmployeeSearchCriteria criteria) { if(CollectionUtils.isEmpty(criteria.getCodes()) && CollectionUtils.isEmpty(criteria.getNames()) && CollectionUtils.isEmpty(criteria.getDepartments()) && CollectionUtils.isEmpty(criteria.getDesignations()) && CollectionUtils.isEmpty(criteria.getIds()) && CollectionUtils.isEmpty(criteria.getEmployeestatuses()) && CollectionUtils.isEmpty(criteria.getEmployeetypes()) && CollectionUtils.isEmpty(criteria.getUuids()) - && CollectionUtils.isEmpty(criteria.getPositions()) && StringUtils.isEmpty(criteria.getTenantId()) + && CollectionUtils.isEmpty(criteria.getPositions()) && CollectionUtils.isEmpty(criteria.getUserServiceUuids()) + && StringUtils.isEmpty(criteria.getTenantId()) && CollectionUtils.isEmpty(criteria.getRoles()) && null == criteria.getAsOnDate()) { return true; }else { return false; } }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public boolean isCriteriaEmpty(EmployeeSearchCriteria criteria) { if(CollectionUtils.isEmpty(criteria.getCodes()) && CollectionUtils.isEmpty(criteria.getNames()) && CollectionUtils.isEmpty(criteria.getDepartments()) && CollectionUtils.isEmpty(criteria.getDesignations()) && CollectionUtils.isEmpty(criteria.getIds()) && CollectionUtils.isEmpty(criteria.getEmployeestatuses()) && CollectionUtils.isEmpty(criteria.getEmployeetypes()) && CollectionUtils.isEmpty(criteria.getUuids()) && CollectionUtils.isEmpty(criteria.getPositions()) && CollectionUtils.isEmpty(criteria.getUserServiceUuids()) && StringUtils.isEmpty(criteria.getTenantId()) && CollectionUtils.isEmpty(criteria.getRoles()) && null == criteria.getAsOnDate()) { return true; }else { return false; } }
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/referralmanagement/beneficiarydownsync/HouseholdMemberMap.java (1)
13-20: 🛠️ Refactor suggestion
Add field validation and documentation.
The class lacks proper validation and documentation. Consider the following improvements:
- Add JSR-303 validation annotations
- Add Javadoc explaining the class purpose and field usage
+import javax.validation.constraints.NotNull; +import javax.validation.constraints.Min; + +/** + * Maps a household to its member count for beneficiary downsync operations. + */ @Builder public class HouseholdMemberMap { + @NotNull(message = "Household cannot be null") private Household household; + @NotNull(message = "Number of members cannot be null") + @Min(value = 0, message = "Number of members cannot be negative") private Integer numberOfMembers; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.import javax.validation.constraints.NotNull; import javax.validation.constraints.Min; /** * Maps a household to its member count for beneficiary downsync operations. */ @Builder public class HouseholdMemberMap { @NotNull(message = "Household cannot be null") private Household household; @NotNull(message = "Number of members cannot be null") @Min(value = 0, message = "Number of members cannot be negative") private Integer numberOfMembers; }
health-services/household/src/main/java/org/egov/household/validators/household/HCommunityTypeValidator.java (1)
27-52: 🛠️ Refactor suggestion
Optimize validation logic and error handling.
Several improvements can be made to enhance the code:
- Avoid duplicating the error message
- Create a single error for the validation failure
- Make the error message more descriptive
- Simplify the stream operation
Here's the suggested implementation:
@Override public Map<Household, List<Error>> validate(HouseholdBulkRequest request) { HashMap<Household, List<Error>> errorDetailsMap = new HashMap<>(); if (configuration.isHouseholdTypeSameValidation()) { - // validate if request contains households of different householdTypes + // Count community households to validate mixed types List<Household> communityHouseholds = request.getHouseholds() .stream() - .filter(household -> household.getHouseholdType() != null && - household.getHouseholdType().equals(HouseHoldType.COMMUNITY)) + .filter(household -> HouseHoldType.COMMUNITY.equals(household.getHouseholdType())) .toList(); if (!CollectionUtils.isEmpty(communityHouseholds) && request.getHouseholds().size() != communityHouseholds.size()) { + String errorMessage = "Mixed household types detected. Community households must be processed separately from Family households."; + Error error = Error.builder() + .errorMessage(errorMessage) + .errorCode("MIXED_HOUSEHOLD_TYPES_NOT_ALLOWED") + .type(Error.ErrorType.NON_RECOVERABLE) + .exception(new CustomException("MIXED_HOUSEHOLD_TYPES_NOT_ALLOWED", errorMessage)) + .build(); + communityHouseholds.forEach(household -> { - Error error = Error.builder() - .errorMessage("Community and Family household cannot be in same request") - .errorCode("COMMUNITY_AND_FAMILY_HOUSEHOLD_IN_SAME_REQUEST") - .type(Error.ErrorType.NON_RECOVERABLE) - .exception(new CustomException("COMMUNITY_AND_FAMILY_HOUSEHOLD_IN_SAME_REQUEST", "Community and Family household cannot be in same request")) - .build(); - // Populate error details for the household populateErrorDetails(household, error, errorDetailsMap); }); } } return errorDetailsMap; }The changes:
- Simplified the null check by moving
HouseHoldType.COMMUNITY
to the left side of equals- Created a single Error object outside the loop
- Made the error message more descriptive
- Improved the error code to better reflect the validation rule
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public Map<Household, List<Error>> validate(HouseholdBulkRequest request) { HashMap<Household, List<Error>> errorDetailsMap = new HashMap<>(); if (configuration.isHouseholdTypeSameValidation()) { // Count community households to validate mixed types List<Household> communityHouseholds = request.getHouseholds() .stream() .filter(household -> HouseHoldType.COMMUNITY.equals(household.getHouseholdType())) .toList(); if (!CollectionUtils.isEmpty(communityHouseholds) && request.getHouseholds().size() != communityHouseholds.size()) { String errorMessage = "Mixed household types detected. Community households must be processed separately from Family households."; Error error = Error.builder() .errorMessage(errorMessage) .errorCode("MIXED_HOUSEHOLD_TYPES_NOT_ALLOWED") .type(Error.ErrorType.NON_RECOVERABLE) .exception(new CustomException("MIXED_HOUSEHOLD_TYPES_NOT_ALLOWED", errorMessage)) .build(); communityHouseholds.forEach(household -> { populateErrorDetails(household, error, errorDetailsMap); }); } } return errorDetailsMap; }
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/referralmanagement/beneficiarydownsync/DownsyncCLFHousehold.java (3)
8-8: 🧹 Nitpick (assertive)
Remove unused imports.
The following imports are not used in the code:
org.egov.common.models.household.Household
java.util.Map
-import org.egov.common.models.household.Household; import java.util.List; -import java.util.Map;Also applies to: 11-12
22-23: 🧹 Nitpick (assertive)
Standardize JSON property naming convention.
Consider using camelCase for JSON property names to follow standard JSON naming conventions.
- @JsonProperty("DownsyncCriteria") + @JsonProperty("downsyncCriteria") + @NotNull DownsyncCriteria downsyncCriteria;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@JsonProperty("downsyncCriteria") @NotNull DownsyncCriteria downsyncCriteria;
19-20: 🧹 Nitpick (assertive)
Fix property name mismatch and add validation.
The JSON property name "HouseholdCountMap" doesn't match the variable name "householdMemberCountMap". Consider:
- Aligning the names for better clarity
- Adding validation annotations for robust data handling
- @JsonProperty("HouseholdCountMap") + @JsonProperty("householdMemberCountMap") + @NotNull List<HouseholdMemberMap> householdMemberCountMap;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@JsonProperty("householdMemberCountMap") @NotNull List<HouseholdMemberMap> householdMemberCountMap;
core-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java (2)
44-44: 🧹 Nitpick (assertive)
Fix typo in constant name: "CRITERA" should be "CRITERIA".
The constant name contains a typo:
HRMS_USER_SEARCH_CRITERA_USER_SERVICE_UUIDS
should beHRMS_USER_SEARCH_CRITERIA_USER_SERVICE_UUIDS
.-public static final String HRMS_USER_SEARCH_CRITERA_USER_SERVICE_UUIDS = "userServiceUuids"; +public static final String HRMS_USER_SEARCH_CRITERIA_USER_SERVICE_UUIDS = "userServiceUuids";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public static final String HRMS_USER_SEARCH_CRITERIA_USER_SERVICE_UUIDS = "userServiceUuids";
34-34: 💡 Codebase verification
Confirmed: Localization code uses inconsistent casing convention
The constant
HEALTH_HRMS_EMAIL_LOCALIZATION_CODE
with value"HEALTH_HRMS_EMAIL_CODE"
is inconsistent with other localization codes in the file which use kebab-case with lowercase letters and dots, such as:
"hrms.employee.create.notification"
"hrms.employee.reactivation.notification"
Consider changing it to follow the same convention, e.g.,
"health.hrms.email.code"
.🔗 Analysis chain
Consider using consistent casing convention for localization code.
The constant
HEALTH_HRMS_EMAIL_LOCALIZATION_CODE
uses snake_case for its value while other localization codes in the file use kebab-case. This inconsistency could lead to issues if the actual localization key doesn't match.Run this script to check the casing convention used in the localization service:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check the casing convention used in the localization service for the rainmaker-hr module curl -s "https://dev.digit.org/localization/messages/v1/_search?module=rainmaker-hr&locale=en_IN" | jq -r '.messages[] | select(.code | contains("EMAIL")) | .code'Length of output: 165
Script:
#!/bin/bash # Check other constants in the same file and similar patterns across codebase echo "=== Constants in HRMSConstants.java ===" ast-grep --pattern 'public static final String $_ = "$_";' core-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java echo -e "\n=== Searching for localization codes across codebase ===" rg -l "localization|localisation" --type yaml echo -e "\n=== Checking for other email related codes ===" rg "EMAIL.*CODE" --type javaLength of output: 1296
Script:
#!/bin/bash # Check for localization related constants and their values echo "=== Content of HRMSConstants.java ===" cat core-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java echo -e "\n=== Searching for localization message patterns ===" rg "messages.*localization|localizationMessages" --type java -A 2 -B 2Length of output: 5730
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/referralmanagement/beneficiarydownsync/DownsyncCriteria.java (1)
38-38: 🧹 Nitpick (assertive)
Remove extra blank line.
Remove the unnecessary blank line to maintain consistent code style.
private Long totalCount; - private String householdId;
Committable suggestion skipped: line range outside the PR's diff.
core-services/egov-hrms/src/main/java/org/egov/hrms/web/models/IndividualBulkResponse.java (3)
22-29: 🧹 Nitpick (assertive)
Remove extra blank line.
The annotations are well-chosen for a response DTO. Consider removing the extra blank line at line 24 for better readability.
46-52: 🧹 Nitpick (assertive)
Consider modernizing the helper method implementation.
The method could be more concise using Java 8+ features and have a more consistent name.
- public IndividualBulkResponse addIndividualItem(Individual individualItem) { - if (this.individual == null) { - this.individual = new ArrayList<>(); - } - this.individual.add(individualItem); - return this; - } + public IndividualBulkResponse addIndividual(Individual individual) { + this.individual = this.individual == null ? new ArrayList<>() : this.individual; + this.individual.add(individual); + return this; + }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public IndividualBulkResponse addIndividual(Individual individual) { this.individual = this.individual == null ? new ArrayList<>() : this.individual; this.individual.add(individual); return this; }
32-44: 🧹 Nitpick (assertive)
Standardize JSON property names to follow camelCase convention.
The @JsonProperty annotations use PascalCase ("ResponseInfo", "TotalCount", "Individual") which is inconsistent with typical JSON naming conventions. Consider using camelCase for consistency with standard Java/JSON practices.
- @JsonProperty("ResponseInfo") + @JsonProperty("responseInfo") @NotNull @Valid private ResponseInfo responseInfo = null; - @JsonProperty("TotalCount") + @JsonProperty("totalCount") @Valid @Builder.Default private Long totalCount = 0L; - @JsonProperty("Individual") + @JsonProperty("individual") @Valid private List<Individual> individual = null;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@JsonProperty("responseInfo") @NotNull @Valid private ResponseInfo responseInfo = null; @JsonProperty("totalCount") @Valid @Builder.Default private Long totalCount = 0L; @JsonProperty("individual") @Valid private List<Individual> individual = null;
core-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java (2)
205-229: 🧹 Nitpick (assertive)
Optimize search criteria building.
The code block for handling userServiceUuids search criteria contains duplicated logic from the previous name search block. Consider extracting the common logic into a helper method.
+private void enrichSearchCriteriaWithUserResponse(EmployeeSearchCriteria criteria, Map<String, Object> userSearchCriteria, + Map<String, User> mapOfUsers, UserResponse userResponse) { + List<String> userUUIDs = new ArrayList<>(); + if(!CollectionUtils.isEmpty(userResponse.getUser())) { + mapOfUsers.putAll(userResponse.getUser().stream() + .collect(Collectors.toMap(User::getUuid, Function.identity()))); + } + List<String> uuids = userResponse.getUser().stream().map(User :: getUuid).collect(Collectors.toList()); + userUUIDs.addAll(uuids); + + if(!CollectionUtils.isEmpty(criteria.getUuids())) + criteria.setUuids(criteria.getUuids().stream().filter(userUUIDs::contains).collect(Collectors.toList())); + else + criteria.setUuids(userUUIDs); +}Committable suggestion skipped: line range outside the PR's diff.
272-279: 🛠️ Refactor suggestion
Review conditional user creation logic.
The implementation introduces a runtime type check using
instanceof
, which is generally considered a code smell. Consider using dependency injection or strategy pattern instead.-if(userService instanceof IndividualService) { - String localityCode = (employee.getJurisdictions()!=null && !employee.getJurisdictions().isEmpty())? employee.getJurisdictions().get(0).getBoundary() : null; - response = individualService.createUserByLocality(request, localityCode); -} -else{ - response = userService.createUser(request); -} +String localityCode = (employee.getJurisdictions()!=null && !employee.getJurisdictions().isEmpty())? + employee.getJurisdictions().get(0).getBoundary() : null; +response = userService.createUser(request, localityCode);Committable suggestion skipped: line range outside the PR's diff.
health-services/project/src/main/java/org/egov/project/repository/ProjectRepository.java (1)
84-86: 🧹 Nitpick (assertive)
Consider lazy initialization for collections.
Targets and documents lists are initialized regardless of whether they are used. This is not a big issue, but you could optionally initialize them after you confirm!projectIds.isEmpty()
.health-services/project/src/main/java/org/egov/project/service/ProjectService.java (3)
135-135: 🧹 Nitpick (assertive)
Hard-coded
false
for isAncestorProjectId.
You might later consider making this parameter dynamic. Currently, it’s alwaysfalse
for updates, which may be correct, but keep in mind any evolving requirements.
290-291: 🧹 Nitpick (assertive)
Same note on hard-coded
false
.
Make sure it’s intentional to ignore ancestor references in this cascading date update scenario.
312-312: 🧹 Nitpick (assertive)
Parent project lookups always exclude ancestry logic.
If the design changes, consider whether the parent search might need to include ancestor IDs in the future.health-services/project/CHANGELOG.md (2)
3-5: 🧹 Nitpick (assertive)
Enhance changelog entry with more details.
Consider expanding the changelog entry to provide more context about the feature's impact and usage. For example:
## 1.1.6 - 2025-01-27 -Added isAncestorProjectId param for search projects API to support search projects with ancestor project id as well +### Added +- New query parameter `isAncestorProjectId` to the search projects API + - When set to true, enables searching projects using an ancestor project ID + - Enhances project hierarchy navigation capabilities + - Affects `/project/v1/_search` endpoint📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.## 1.1.6 - 2025-01-27 ### Added - New query parameter `isAncestorProjectId` to the search projects API - When set to true, enables searching projects using an ancestor project ID - Enhances project hierarchy navigation capabilities - Affects `/project/v1/_search` endpoint
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below(MD022, blanks-around-headings)
4-4: Lists should be surrounded by blank lines
null(MD032, blanks-around-lists)
3-4: 🧹 Nitpick (assertive)
Fix markdown formatting.
Add blank lines around headings and lists to improve readability:
All notable changes to this module will be documented in this file. + ## 1.1.6 - 2025-01-27 + - Added isAncestorProjectId param for search projects API to support search projects with ancestor project id as well +📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.All notable changes to this module will be documented in this file. ## 1.1.6 - 2025-01-27 - Added isAncestorProjectId param for search projects API to support search projects with ancestor project id as well
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below(MD022, blanks-around-headings)
4-4: Lists should be surrounded by blank lines
null(MD032, blanks-around-lists)
health-services/household/src/main/java/org/egov/household/validators/household/HHouseholdTypeChangeValidator.java (4)
72-77: 🧹 Nitpick (assertive)
Clarify or refine error messages.
The error code and message both say "Household Type change," which does not explicitly convey the cause or resolution. Consider enhancing the error message to indicate the violation and potential next steps.
84-96:
⚠️ Potential issueAvoid potential NullPointerExceptions when comparing household types.
IfexistingEntity.getHouseholdType()
oreMap.get(existingEntity.getId()).getHouseholdType()
isnull
,.equals()
throws an NPE. Use a null-safe check (e.g.,Objects.equals()
).- if (!existingEntity.getHouseholdType() - .equals(eMap.get(existingEntity.getId()).getHouseholdType())) { + if (!Objects.equals(existingEntity.getHouseholdType(), + eMap.get(existingEntity.getId()).getHouseholdType())) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.private List<Household> changeInHouseholdType(Map<String, Household> eMap, List<Household> existingEntities) { List<Household> entitiesWithHouseholdTypeChange = new ArrayList<>(); for (Household existingEntity : existingEntities) { if (eMap.containsKey(existingEntity.getId())) { if (!Objects.equals(existingEntity.getHouseholdType(), eMap.get(existingEntity.getId()).getHouseholdType())) { entitiesWithHouseholdTypeChange.add(eMap.get(existingEntity.getId())); } } } return entitiesWithHouseholdTypeChange; }
35-39: 🛠️ Refactor suggestion
Handle null or empty request.getHouseholds().
Ifrequest.getHouseholds()
is null or empty, subsequent operations (e.g.,entities.get(0)
in line 62) may result inIndexOutOfBoundsException
. Consider adding a preliminary null or size check to gracefully handle this scenario.public Map<Household, List<Error>> validate(HouseholdBulkRequest request) { - List<Household> entities = request.getHouseholds(); + List<Household> entities = request.getHouseholds() != null ? request.getHouseholds() : Collections.emptyList(); + if (entities.isEmpty()) { + return Collections.emptyMap(); + } ... }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public Map<Household, List<Error>> validate(HouseholdBulkRequest request) { // Map to hold household entities and their error details Map<Household, List<Error>> errorDetailsMap = new HashMap<>(); // Get the list of household entities from the request List<Household> entities = request.getHouseholds() != null ? request.getHouseholds() : Collections.emptyList(); if (entities.isEmpty()) { return Collections.emptyMap(); }
61-62:
⚠️ Potential issueGuard against IndexOutOfBoundsException.
entities.get(0)
can fail ifentities
is empty. Ensure that the code checks for emptiness before accessing the first element.- existingEntities = householdRepository.find(householdSearch, entities.size(), 0, - entities.get(0).getTenantId(), null, false).getResponse(); + String tenantId = entities.get(0).getTenantId(); + existingEntities = householdRepository.find(householdSearch, entities.size(), 0, + tenantId, null, false).getResponse();Committable suggestion skipped: line range outside the PR's diff.
health-services/project/src/main/java/org/egov/project/repository/querybuilder/ProjectAddressQueryBuilder.java (1)
49-53: 🧹 Nitpick (assertive)
Enhance method documentation for better clarity.
While the documentation explains the purpose of
isAncestorProjectId
, it would be helpful to include:
- The impact on query behavior
- Example scenarios when this flag should be true/false
/** * Constructs project search query based on conditions - * @param isAncestorProjectId if set to true, project id in the projects would be considered as ancestor project id. + * @param isAncestorProjectId if set to true, matches projects where the given project ID is either: + * - directly equal to the project's ID, or + * - present in the project's hierarchy (ancestor relationship) + * Use this when searching for a project and all its descendants. */📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements./** * Constructs project search query based on conditions * @param isAncestorProjectId if set to true, matches projects where the given project ID is either: * - directly equal to the project's ID, or * - present in the project's hierarchy (ancestor relationship) * Use this when searching for a project and all its descendants. */ public String getProjectSearchQuery(List<Project> projects, Integer limit, Integer offset, String tenantId, Long lastChangedSince, Boolean includeDeleted, Long createdFrom, Long createdTo, boolean isAncestorProjectId, List<Object> preparedStmtList, boolean isCountQuery) {
core-services/egov-hrms/src/main/java/org/egov/hrms/utils/NotificationUtil.java (4)
140-153: 🧹 Nitpick (assertive)
Enhance error handling and consider batch processing.
The email sending implementation could be improved:
- Add error handling for producer failures
- Include more detailed logging
- Consider batch processing for better performance
Consider this enhanced implementation:
public void sendEmail(List<EmailRequest> emailRequestList) { if (propertiesManager.getIsEmailNotificationEnabled()) { if (CollectionUtils.isEmpty(emailRequestList)) { log.error("No Emails Found!"); return; } + int batchSize = 10; + List<EmailRequest> batch = new ArrayList<>(batchSize); for (EmailRequest emailRequest : emailRequestList) { - producer.push(propertiesManager.getEmailNotifTopic(), emailRequest); - log.info("Email Request -> " + emailRequest.toString()); - log.info("EMAIL notification sent!"); + try { + batch.add(emailRequest); + if (batch.size() >= batchSize) { + processBatch(batch); + batch.clear(); + } + } catch (Exception e) { + log.error("Failed to process email request: " + emailRequest.toString(), e); + } } + + if (!batch.isEmpty()) { + processBatch(batch); + } } } +private void processBatch(List<EmailRequest> batch) { + log.info("Processing batch of {} emails", batch.size()); + try { + for (EmailRequest emailRequest : batch) { + producer.push(propertiesManager.getEmailNotifTopic(), emailRequest); + log.debug("Email queued for delivery: {}", emailRequest.toString()); + } + log.info("Successfully processed batch of {} emails", batch.size()); + } catch (Exception e) { + log.error("Failed to process email batch", e); + throw e; + } +}Committable suggestion skipped: line range outside the PR's diff.
49-65: 🧹 Nitpick (assertive)
Add input validation and improve error handling.
The message template extraction could be more robust:
- Add null checks for input parameters
- Consider throwing a specific exception instead of returning null
- Use more specific exception handling
Consider this implementation:
public String getMessageTemplate(String notificationCode, String localizationMessage) { + if (StringUtils.isEmpty(notificationCode) || StringUtils.isEmpty(localizationMessage)) { + throw new IllegalArgumentException("Notification code and localization message must not be empty"); + } String path = "$..messages[?(@.code==\"{}\")].message"; path = path.replace("{}", notificationCode); - String message = null; + String message; try { List data = JsonPath.parse(localizationMessage).read(path); if (!CollectionUtils.isEmpty(data)) message = data.get(0).toString(); else { log.error("Fetching from localization failed with code " + notificationCode); - return null; + throw new IllegalStateException("Message not found for code: " + notificationCode); } - } catch (Exception e) { + } catch (JsonPathException e) { log.warn("Fetching from localization failed", e); - return null; + throw new IllegalStateException("Failed to parse localization message", e); } return message; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public String getMessageTemplate(String notificationCode, String localizationMessage) { if (StringUtils.isEmpty(notificationCode) || StringUtils.isEmpty(localizationMessage)) { throw new IllegalArgumentException("Notification code and localization message must not be empty"); } String path = "$..messages[?(@.code==\"{}\")].message"; path = path.replace("{}", notificationCode); String message; try { List data = JsonPath.parse(localizationMessage).read(path); if (!CollectionUtils.isEmpty(data)) message = data.get(0).toString(); else { log.error("Fetching from localization failed with code " + notificationCode); throw new IllegalStateException("Message not found for code: " + notificationCode); } } catch (JsonPathException e) { log.warn("Fetching from localization failed", e); throw new IllegalStateException("Failed to parse localization message", e); } return message; }
110-133:
⚠️ Potential issueReplace unsafe HTML parsing with proper HTML processing.
The current implementation has several issues:
- Unsafe HTML parsing using string indices
- No validation of email template format
- Missing escaping of replacement values
Consider using an HTML parser library and proper template engine:
+import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.apache.commons.text.StringSubstitutor; public List<EmailRequest> createEmailRequest(EmployeeRequest employeeRequest, String emailTemplate) { RequestInfo requestInfo = employeeRequest.getRequestInfo(); List<EmailRequest> emailRequest = new LinkedList<>(); for (Employee employee : employeeRequest.getEmployees()) { - String customizedMsg = emailTemplate.replace("{User's name}", employee.getUser().getName()); - customizedMsg = customizedMsg.replace("{Username}", employee.getCode()); - customizedMsg = customizedMsg.replace("{Password}", employee.getUser().getPassword()); - customizedMsg = customizedMsg.replace("{website URL}", propertiesManager.getEmailNotificationWebsiteLink()); - customizedMsg = customizedMsg.replace("{Implementation partner}", propertiesManager.getEmailNotificationImplementationPartner()); + Map<String, String> replacements = new HashMap<>(); + replacements.put("User's name", StringEscapeUtils.escapeHtml4(employee.getUser().getName())); + replacements.put("Username", StringEscapeUtils.escapeHtml4(employee.getCode())); + replacements.put("Password", StringEscapeUtils.escapeHtml4(employee.getUser().getPassword())); + replacements.put("website URL", StringEscapeUtils.escapeHtml4(propertiesManager.getEmailNotificationWebsiteLink())); + replacements.put("Implementation partner", StringEscapeUtils.escapeHtml4(propertiesManager.getEmailNotificationImplementationPartner())); + + StringSubstitutor sub = new StringSubstitutor(replacements, "{", "}"); + String customizedMsg = sub.replace(emailTemplate); - String subject = customizedMsg.substring(customizedMsg.indexOf("<h2>")+4, customizedMsg.indexOf("</h2>")); - String body = customizedMsg.substring(customizedMsg.indexOf("</h2>")+5); + Document doc = Jsoup.parse(customizedMsg); + String subject = doc.select("h2").first().text(); + doc.select("h2").remove(); + String body = doc.body().html(); Email emailObj = Email.builder() .emailTo(Collections.singleton(employee.getUser().getEmailId())) .isHTML(true) .body(body) .subject(subject) .build(); EmailRequest email = new EmailRequest(requestInfo, emailObj); emailRequest.add(email); } return emailRequest; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public List<EmailRequest> createEmailRequest(EmployeeRequest employeeRequest, String emailTemplate) { RequestInfo requestInfo = employeeRequest.getRequestInfo(); List<EmailRequest> emailRequest = new LinkedList<>(); for (Employee employee : employeeRequest.getEmployees()) { Map<String, String> replacements = new HashMap<>(); replacements.put("User's name", StringEscapeUtils.escapeHtml4(employee.getUser().getName())); replacements.put("Username", StringEscapeUtils.escapeHtml4(employee.getCode())); replacements.put("Password", StringEscapeUtils.escapeHtml4(employee.getUser().getPassword())); replacements.put("website URL", StringEscapeUtils.escapeHtml4(propertiesManager.getEmailNotificationWebsiteLink())); replacements.put("Implementation partner", StringEscapeUtils.escapeHtml4(propertiesManager.getEmailNotificationImplementationPartner())); StringSubstitutor sub = new StringSubstitutor(replacements, "{", "}"); String customizedMsg = sub.replace(emailTemplate); Document doc = Jsoup.parse(customizedMsg); String subject = doc.select("h2").first().text(); doc.select("h2").remove(); String body = doc.body().html(); Email emailObj = Email.builder() .emailTo(Collections.singleton(employee.getUser().getEmailId())) .isHTML(true) .body(body) .subject(subject) .build(); EmailRequest email = new EmailRequest(requestInfo, emailObj); emailRequest.add(email); } return emailRequest; }
88-100: 🛠️ Refactor suggestion
Add safety checks for array access and improve locale handling.
The URI construction has potential null pointer and array index issues:
- Missing null/empty check for employees list
- Unsafe array access for tenant ID split
- Complex locale extraction logic
Consider this safer implementation:
public StringBuilder getUri(EmployeeRequest employeeRequest) { + if (employeeRequest == null || CollectionUtils.isEmpty(employeeRequest.getEmployees())) { + throw new IllegalArgumentException("Employee request or employees list cannot be empty"); + } + + String tenantId = employeeRequest.getEmployees().get(0).getTenantId(); + if (StringUtils.isEmpty(tenantId)) { + throw new IllegalArgumentException("Tenant ID cannot be empty"); + } - String tenantId = employeeRequest.getEmployees().get(0).getTenantId().split("\\.")[0]; + String[] tenantParts = tenantId.split("\\."); + String rootTenantId = tenantParts.length > 0 ? tenantParts[0] : tenantId; String locale = HRMS_LOCALIZATION_ENG_LOCALE_CODE; - if (!StringUtils.isEmpty(employeeRequest.getRequestInfo().getMsgId()) && employeeRequest.getRequestInfo().getMsgId().split("|").length >= 2) - locale = employeeRequest.getRequestInfo().getMsgId().split("\\|")[1]; + String msgId = employeeRequest.getRequestInfo().getMsgId(); + if (!StringUtils.isEmpty(msgId)) { + String[] msgParts = msgId.split("\\|"); + if (msgParts.length >= 2) { + locale = msgParts[1]; + } + } StringBuilder uri = new StringBuilder(); uri.append(propertiesManager.getLocalizationHost()) .append(propertiesManager.getLocalizationSearchEndpoint()) .append("?") .append("locale=").append(locale) - .append("&tenantId=").append(tenantId) + .append("&tenantId=").append(rootTenantId) .append("&module=").append(HEALTH_HRMS_LOCALIZATION_MODULE_CODE); return uri; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public StringBuilder getUri(EmployeeRequest employeeRequest) { if (employeeRequest == null || CollectionUtils.isEmpty(employeeRequest.getEmployees())) { throw new IllegalArgumentException("Employee request or employees list cannot be empty"); } String tenantId = employeeRequest.getEmployees().get(0).getTenantId(); if (StringUtils.isEmpty(tenantId)) { throw new IllegalArgumentException("Tenant ID cannot be empty"); } String[] tenantParts = tenantId.split("\\."); String rootTenantId = tenantParts.length > 0 ? tenantParts[0] : tenantId; String locale = HRMS_LOCALIZATION_ENG_LOCALE_CODE; String msgId = employeeRequest.getRequestInfo().getMsgId(); if (!StringUtils.isEmpty(msgId)) { String[] msgParts = msgId.split("\\|"); if (msgParts.length >= 2) { locale = msgParts[1]; } } StringBuilder uri = new StringBuilder(); uri.append(propertiesManager.getLocalizationHost()) .append(propertiesManager.getLocalizationSearchEndpoint()) .append("?") .append("locale=").append(locale) .append("&tenantId=").append(rootTenantId) .append("&module=").append(HEALTH_HRMS_LOCALIZATION_MODULE_CODE); return uri; }
core-services/egov-hrms/src/main/java/org/egov/hrms/service/IndividualService.java (2)
66-79: 🛠️ Refactor suggestion
Reduce code duplication by refactoring
createUser
andcreateUserByLocality
.The new method duplicates most of the logic from
createUser
. Consider refactoring to eliminate this duplication.Here's a suggested implementation:
- @Override - public UserResponse createUser(UserRequest userRequest) { - IndividualRequest request = mapToIndividualRequest(userRequest, null); - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getIndividualHost()); - uri.append(propertiesManager.getIndividualCreateEndpoint()); - IndividualResponse response = restCallRepository - .fetchResult(uri, request, IndividualResponse.class); - UserResponse userResponse = null; - if (response != null && response.getIndividual() != null) { - log.info("response received from individual service"); - userResponse = mapToUserResponse(response); - } - return userResponse; - } - - public UserResponse createUserByLocality(UserRequest userRequest, String localityCode) { - IndividualRequest request = mapToIndividualRequest(userRequest,localityCode); - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getIndividualHost()); - uri.append(propertiesManager.getIndividualCreateEndpoint()); - IndividualResponse response = restCallRepository - .fetchResult(uri, request, IndividualResponse.class); - UserResponse userResponse = null; - if (response != null && response.getIndividual() != null) { - log.info("response received from individual service"); - userResponse = mapToUserResponse(response); - } - return userResponse; - } + private UserResponse createUserInternal(UserRequest userRequest, String localityCode) { + IndividualRequest request = mapToIndividualRequest(userRequest, localityCode); + StringBuilder uri = new StringBuilder() + .append(propertiesManager.getIndividualHost()) + .append(propertiesManager.getIndividualCreateEndpoint()); + IndividualResponse response = restCallRepository + .fetchResult(uri, request, IndividualResponse.class); + UserResponse userResponse = null; + if (response != null && response.getIndividual() != null) { + log.info("response received from individual service"); + userResponse = mapToUserResponse(response); + } + return userResponse; + } + + @Override + public UserResponse createUser(UserRequest userRequest) { + return createUserInternal(userRequest, null); + } + + public UserResponse createUserByLocality(UserRequest userRequest, String localityCode) { + return createUserInternal(userRequest, localityCode); + }Committable suggestion skipped: line range outside the PR's diff.
319-321: 💡 Codebase verification
Role codes should not be directly mapped to skill types and levels
The current implementation is problematic because:
- No validation exists to ensure role codes are valid skill types/levels
- Using the same role code for both type and level lacks semantic meaning
- No configuration exists to map roles to appropriate skill levels
Recommendations:
- Introduce a mapping configuration to translate role codes to appropriate skill types
- Define separate logic for determining skill levels
- Add validation to ensure only valid skill types and levels are assigned
🔗 Analysis chain
Verify the role-to-skill mapping logic.
The current implementation assumes that role codes can directly map to both skill type and level. This might lead to incorrect skill assignments if role codes don't align with actual skill levels.
Consider:
- Should there be a mapping configuration for role codes to skill levels?
- Is it appropriate to use the same value for both type and level?
Let's verify the role codes in use:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for role definitions to understand the available role codes rg -A 5 "role.*code.*="Length of output: 5152
Script:
#!/bin/bash # Search for skill-related configurations and type/level definitions echo "=== Searching for skill configurations ===" rg -g "!*.{log,lock}" "skill.*type|skill.*level" -B 2 -A 2 echo -e "\n=== Searching for role definitions in configuration files ===" fd -e yaml -e json -e properties | xargs rg "roles:|role:|ROLE_" -B 2 -A 2 echo -e "\n=== Searching for other skill mapping implementations ===" ast-grep --pattern 'Skill.builder()' -A 5Length of output: 26400
core-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmailRequest.java (1)
12-16: 🛠️ Refactor suggestion
Add validation annotations to ensure request integrity.
Consider adding validation annotations to ensure the request fields are properly validated:
public class EmailRequest { + @NotNull(message = "Request info is required") private RequestInfo requestInfo; + @NotNull(message = "Email details are required") private Email email; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public class EmailRequest { @NotNull(message = "Request info is required") private RequestInfo requestInfo; @NotNull(message = "Email details are required") private Email email; }
core-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/Email.java (1)
11-16: 🧹 Nitpick (assertive)
Remove redundant Lombok annotation.
The
@Data
annotation is redundant since you're already using@Getter
,@Setter
,@NoArgsConstructor
, and@AllArgsConstructor
.@Setter @Getter @NoArgsConstructor @AllArgsConstructor -@Data @Builder
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@Setter @Getter @NoArgsConstructor @AllArgsConstructor @Builder
core-services/egov-hrms/src/main/java/org/egov/hrms/consumer/HrmsConsumer.java (1)
35-45: 🛠️ Refactor suggestion
Enhance error handling and logging security.
The current implementation has several areas for improvement:
- Add request validation:
@KafkaListener(topics = {"${kafka.topics.hrms.updateData}", "${kafka.topics.hrms.email.notification}"}) public void listenUpdateEmployeeData(final HashMap<String, Object> record,@Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { EmployeeRequest employeeRequest = mapper.convertValue(record, EmployeeRequest.class); + validateRequest(employeeRequest); if(topic.equals(propertiesManager.getHrmsEmailNotifTopic())) {
- Improve exception handling and secure logging:
- } catch (final Exception e) { - log.error("Error while listening to value: " + record + " on topic: " + topic + ": ", e); + } catch (IllegalArgumentException e) { + log.error("Error deserializing message from topic: {}", topic, e); + } catch (Exception e) { + log.error("Error processing message from topic: {}", topic, e); } } + +private void validateRequest(EmployeeRequest request) { + if (request == null || request.getRequestInfo() == null) { + throw new IllegalArgumentException("Invalid request format"); + } +}The changes:
- Add input validation to prevent null pointer exceptions
- Separate exception handling for different error types
- Remove sensitive data from error logs
- Add a validation helper method
Committable suggestion skipped: line range outside the PR's diff.
core-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java (2)
90-91: 🧹 Nitpick (assertive)
Improve boolean property naming and add default value.
Follow Java naming conventions for boolean properties and provide a default value:
-@Value("${notification.email.enabled}") -private Boolean isEmailNotificationEnabled; +@Value("${notification.email.enabled:false}") +private boolean emailNotificationEnabled;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@Value("${notification.email.enabled:false}") private boolean emailNotificationEnabled;
152-156: 🛠️ Refactor suggestion
Add default values for new properties.
Provide default values to prevent null pointer exceptions if properties are not configured:
-@Value("${hrms.email.notification.implementation.partner}") +@Value("${hrms.email.notification.implementation.partner:}") public String emailNotificationImplementationPartner; -@Value("${hrms.email.notification.website.link}") +@Value("${hrms.email.notification.website.link:}") public String emailNotificationWebsiteLink;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@Value("${hrms.email.notification.implementation.partner:}") public String emailNotificationImplementationPartner; @Value("${hrms.email.notification.website.link:}") public String emailNotificationWebsiteLink;
core-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java (1)
211-227: 🧹 Nitpick (assertive)
Enhance error logging in processEmailNotification.
While the error handling is good, the log messages could be more detailed to aid in debugging.
Apply this diff to improve the logging:
- log.error("Invalid employee request received for email notification"); + log.error("Invalid employee request received for email notification. Request: {}", employeeRequest);- log.error("Error processing email notification for given employees"); + log.error("Error processing email notification for employees: {}", e.getMessage(), e);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public void processEmailNotification(EmployeeRequest employeeRequest) { if (employeeRequest == null || CollectionUtils.isEmpty(employeeRequest.getEmployees())) { log.error("Invalid employee request received for email notification. Request: {}", employeeRequest); return; } try { // Fetch localization messages and get email message template for HEALTH_HRMS_EMAIL_LOCALIZATION_CODE template code. String localizationMessages = notificationUtil.getLocalizationMessages(employeeRequest); String messageTemplate = notificationUtil.getMessageTemplate(HEALTH_HRMS_EMAIL_LOCALIZATION_CODE, localizationMessages); // Create email requests from the employee details provided in the employeeRequest. List<EmailRequest> emailRequests = notificationUtil.createEmailRequest(employeeRequest, messageTemplate); notificationUtil.sendEmail(emailRequests); } catch (Exception e) { log.error("Error processing email notification for employees: {}", e.getMessage(), e); } }
core-services/egov-hrms/src/main/resources/application.properties (1)
123-127: 🛠️ Refactor suggestion
Remove hardcoded website link from properties file.
According to previous discussions,
hrms.email.notification.website.link
should be managed through the DevOps chart to support environment-specific values.Remove the hardcoded value and ensure it's configured in the DevOps chart instead.
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/household/HouseHoldType.java (2)
15-19: 🧹 Nitpick (assertive)
Add toString/JsonValue annotation for consistent serialization
For consistency with
BeneficiaryType
, add@JsonValue
annotation and override toString.private String value; HouseHoldType(String value) { this.value = value; } + +@Override +@JsonValue +public String toString() { + return String.valueOf(value); +}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.private String value; HouseHoldType(String value) { this.value = value; } @Override @JsonValue public String toString() { return String.valueOf(value); }
21-29:
⚠️ Potential issueHandle invalid enum values more gracefully
The
fromValue
method returns null for invalid values, which could lead to NullPointerExceptions. Consider throwing an IllegalArgumentException with a descriptive message instead.@JsonCreator public static HouseHoldType fromValue(String text) { for (HouseHoldType b : HouseHoldType.values()) { if (String.valueOf(b.value).equalsIgnoreCase(text)) { return b; } } - return null; + throw new IllegalArgumentException("Unknown HouseHoldType value: " + text); }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@JsonCreator public static HouseHoldType fromValue(String text) { for (HouseHoldType b : HouseHoldType.values()) { if (String.valueOf(b.value).equalsIgnoreCase(text)) { return b; } } throw new IllegalArgumentException("Unknown HouseHoldType value: " + text); }
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/project/BeneficiaryType.java (1)
25-34:
⚠️ Potential issueHandle invalid enum values more gracefully
Similar to HouseHoldType, the
fromValue
method returns null for invalid values. Consider throwing an IllegalArgumentException instead.@JsonCreator public static BeneficiaryType fromValue(String text) { for(BeneficiaryType a:BeneficiaryType.values()){ if(String.valueOf(a.value).equalsIgnoreCase(text)){ return a; } } - return null; + throw new IllegalArgumentException("Unknown BeneficiaryType value: " + text); }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@JsonCreator public static BeneficiaryType fromValue(String text) { for(BeneficiaryType a:BeneficiaryType.values()){ if(String.valueOf(a.value).equalsIgnoreCase(text)){ return a; } } throw new IllegalArgumentException("Unknown BeneficiaryType value: " + text); }
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/project/Target.java (1)
34-34: 🧹 Nitpick (assertive)
Add validation for required beneficiaryType
Consider adding
@NotNull
validation to ensure beneficiaryType is always provided, as it seems to be a crucial field for target definition.@JsonProperty("beneficiaryType") +@NotNull private BeneficiaryType beneficiaryType = null;
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@JsonProperty("beneficiaryType") @NotNull private BeneficiaryType beneficiaryType = null;
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/household/Household.java (1)
37-39: 🧹 Nitpick (assertive)
Add validation for householdType field
The new householdType field lacks validation. Consider adding @NotNull if this is a required field.
@JsonProperty("householdType") +@NotNull private HouseHoldType householdType = null;
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@JsonProperty("householdType") @NotNull private HouseHoldType householdType = null;
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/household/HouseholdSearch.java (1)
40-41: 🛠️ Refactor suggestion
Consider using HouseHoldType enum instead of String.
The
householdType
field should be of typeHouseHoldType
enum instead of String to maintain type safety and consistency with other related changes in the codebase.@JsonProperty("householdType") - private String householdType = null; + private HouseHoldType householdType = null;Committable suggestion skipped: line range outside the PR's diff.
health-services/household/src/main/java/org/egov/household/config/HouseholdConfiguration.java (2)
49-50: 🧹 Nitpick (assertive)
Add default value for communityHouseholdCreatorRoleCode.
Consider providing a default value in the annotation to ensure graceful behavior if the configuration is missing.
- @Value("${household.type.community.creator.role}") + @Value("${household.type.community.creator.role:COMMUNITY_HOUSEHOLD_CREATOR}") private String communityHouseholdCreatorRoleCode;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@Value("${household.type.community.creator.role:COMMUNITY_HOUSEHOLD_CREATOR}") private String communityHouseholdCreatorRoleCode;
46-47: 🧹 Nitpick (assertive)
Add default value for householdTypeSameValidation.
Consider providing a default value in the annotation to ensure graceful behavior if the configuration is missing.
- @Value("${household.type.same.validation}") + @Value("${household.type.same.validation:false}") private boolean householdTypeSameValidation;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@Value("${household.type.same.validation:false}") private boolean householdTypeSameValidation;
health-services/libraries/health-services-models/src/main/java/org/egov/common/models/project/ProjectType.java (1)
51-51: 🧹 Nitpick (assertive)
Add validation annotations for beneficiaryType.
Consider adding validation annotations to ensure the field is properly validated during object creation and updates.
+ @Valid + @NotNull private BeneficiaryType beneficiaryType = null;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@Valid @NotNull private BeneficiaryType beneficiaryType = null;
health-services/household/src/main/java/org/egov/household/repository/rowmapper/HouseholdRowMapper.java (1)
40-40:
⚠️ Potential issueHandle potential null householdType values.
The direct call to
fromValue()
on the result ofgetString("householdType")
could throw a NullPointerException if the householdType column contains NULL values in the database.Apply this diff to safely handle null values:
- .householdType(HouseHoldType.fromValue(resultSet.getString("householdType"))) + .householdType(resultSet.getString("householdType") != null ? + HouseHoldType.fromValue(resultSet.getString("householdType")) : null)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements..householdType(resultSet.getString("householdType") != null ? HouseHoldType.fromValue(resultSet.getString("householdType")) : null)
health-services/household/src/main/java/org/egov/household/repository/HouseholdRepository.java (1)
85-88: 🛠️ Refactor suggestion
Refactor duplicated logic and avoid hardcoded strings.
The logic for handling FAMILY type is duplicated between
find
andfindByRadius
methods. Additionally, the "COMMUNITY" string is hardcoded.
- Extract the common logic to a private method:
private String getHouseholdTypeCondition(String originalCondition, HouseholdSearch searchObject) { if (searchObject.getHouseholdType() != null && searchObject.getHouseholdType().equalsIgnoreCase(HouseHoldType.FAMILY.name())) { return originalCondition.replace( "householdType=:householdType", String.format("(householdType!='%s' OR householdType IS NULL)", HouseHoldType.COMMUNITY.name()) ); } return originalCondition; }
- Use the extracted method in both places:
- if (searchObject.getHouseholdType() != null && searchObject.getHouseholdType().equalsIgnoreCase("FAMILY")) { - query = query.replace("householdType=:householdType", "(householdType!='COMMUNITY' OR householdType IS NULL)"); - } + query = getHouseholdTypeCondition(query, searchObject);Also applies to: 136-139
health-services/household/src/main/java/org/egov/household/service/HouseholdService.java (1)
58-60: 🧹 Nitpick (assertive)
Document the purpose and ordering of validators.
The new validators have been added without documentation explaining their purpose or why they need to run in this specific order. This makes it difficult for other developers to understand the validation flow.
Add comments explaining each validator's purpose and any ordering dependencies:
private final Predicate<Validator<HouseholdBulkRequest, Household>> isApplicableForCreate = validator -> validator.getClass().equals(HBoundaryValidator.class) + // Validates if the entity already exists || validator.getClass().equals(HExistentEntityValidator.class) + // Validates community-specific rules || validator.getClass().equals(HCommunityValidator.class) + // Validates household type constraints || validator.getClass().equals(HCommunityTypeValidator.class); private final Predicate<Validator<HouseholdBulkRequest, Household>> isApplicableForUpdate = validator -> validator.getClass().equals(HNullIdValidator.class) || validator.getClass().equals(HBoundaryValidator.class) || validator.getClass().equals(HIsDeletedValidator.class) || validator.getClass().equals(HUniqueEntityValidator.class) || validator.getClass().equals(HNonExistentEntityValidator.class) || validator.getClass().equals(HRowVersionValidator.class) + // Validates community-specific rules || validator.getClass().equals(HCommunityValidator.class) + // Validates household type constraints || validator.getClass().equals(HCommunityTypeValidator.class) + // Validates changes to household type || validator.getClass().equals(HHouseholdTypeChangeValidator.class);Also applies to: 68-71
health-services/project/src/main/java/org/egov/project/validator/beneficiary/BeneficiaryValidator.java (1)
116-127: 🧹 Nitpick (assertive)
Modernize switch statement and improve error message.
The switch statement could be modernized using the enhanced switch syntax, and the error message could be more descriptive.
Apply this diff to modernize the code:
- private void searchBeneficiary(BeneficiaryType beneficiaryType, List<ProjectBeneficiary> beneficiaryList, - RequestInfo requestInfo, String tenantId, - Map<ProjectBeneficiary, List<Error>> errorDetailsMap) { - switch (beneficiaryType) { - case HOUSEHOLD: - searchHouseholdBeneficiary(beneficiaryList, requestInfo, tenantId, errorDetailsMap); - break; - case INDIVIDUAL: - searchIndividualBeneficiary(beneficiaryList, requestInfo, tenantId, errorDetailsMap); - break; - default: - throw new CustomException("INVALID_BENEFICIARY_TYPE", beneficiaryType.name()); - } - } + private void searchBeneficiary(BeneficiaryType beneficiaryType, List<ProjectBeneficiary> beneficiaryList, + RequestInfo requestInfo, String tenantId, + Map<ProjectBeneficiary, List<Error>> errorDetailsMap) { + switch (beneficiaryType) { + case HOUSEHOLD -> searchHouseholdBeneficiary(beneficiaryList, requestInfo, tenantId, errorDetailsMap); + case INDIVIDUAL -> searchIndividualBeneficiary(beneficiaryList, requestInfo, tenantId, errorDetailsMap); + default -> throw new CustomException("INVALID_BENEFICIARY_TYPE", + String.format("Beneficiary type '%s' is not supported. Supported types are: %s", + beneficiaryType.name(), + java.util.Arrays.toString(BeneficiaryType.values()))); + } + }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.private void searchBeneficiary(BeneficiaryType beneficiaryType, List<ProjectBeneficiary> beneficiaryList, RequestInfo requestInfo, String tenantId, Map<ProjectBeneficiary, List<Error>> errorDetailsMap) { switch (beneficiaryType) { case HOUSEHOLD -> searchHouseholdBeneficiary(beneficiaryList, requestInfo, tenantId, errorDetailsMap); case INDIVIDUAL -> searchIndividualBeneficiary(beneficiaryList, requestInfo, tenantId, errorDetailsMap); default -> throw new CustomException("INVALID_BENEFICIARY_TYPE", String.format("Beneficiary type '%s' is not supported. Supported types are: %s", beneficiaryType.name(), java.util.Arrays.toString(BeneficiaryType.values()))); } }
health-services/household/src/main/resources/application.properties (1)
107-109: 🧹 Nitpick (assertive)
Document the new configuration properties.
The new household type configuration properties would benefit from inline documentation explaining their purpose and possible values.
#Community Household Type +# Controls whether to validate if households of the same type exist in the locality household.type.same.validation=true +# Role required to create community type households household.type.community.creator.role=COMMUNITY_CREATOR📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.#Community Household Type # Controls whether to validate if households of the same type exist in the locality household.type.same.validation=true # Role required to create community type households household.type.community.creator.role=COMMUNITY_CREATOR
health-services/household/src/main/resources/household-persister.yml (1)
9-9: 💡 Codebase verification
Invalid INSERT query: 'householdType' column not found in table schema
The INSERT query includes a 'householdType' column that does not exist in the HOUSEHOLD table schema. This will cause the query to fail.
- Remove 'householdType' from the INSERT query in
household-persister.yml
or add the column to the table schema if it's required.🔗 Analysis chain
Verify the column order in INSERT query.
The column order in the INSERT query should match the order of values and JSON mappings.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check the table schema to verify column order echo "SELECT column_name, ordinal_position FROM information_schema.columns WHERE table_name = 'household' ORDER BY ordinal_position;" > verify_columns.sql # Note: This is just to verify the schema, actual execution would be done in the database cat verify_columns.sqlLength of output: 299
Script:
#!/bin/bash # Search for CREATE TABLE household in SQL files rg -i "create table.*household" -A 20Length of output: 7403
Summary by CodeRabbit
Release Notes
New Features
Improvements
Bug Fixes
Technical Updates
Configuration Changes