Skip to content
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

Develop #931

Merged
merged 50 commits into from
Aug 26, 2024
Merged

Develop #931

merged 50 commits into from
Aug 26, 2024

Conversation

Hari-egov
Copy link
Collaborator

@Hari-egov Hari-egov commented Aug 26, 2024

Summary by CodeRabbit

  • New Features

    • Upgraded Android SDK to version 34 for improved compatibility.
    • Added a new LedgerLabelText widget for enhanced dashboard context.
    • Introduced new functionality for handling bulk demand operations.
    • New classes and endpoints for master data migration, including DataApiController and SchemaApiController.
  • Bug Fixes

    • Enhanced navigation reliability by updating pop navigation logic.
  • Documentation

    • Added a README for the MDMS Migration Toolkit and updated other documentation files.
  • Style

    • Improved CSS styling for specific components in the application.
  • Chores

    • Updated configuration files to streamline application settings.

Copy link

coderabbitai bot commented Aug 26, 2024

Walkthrough

The recent changes encompass updates to both the frontend and backend components of the application. Key modifications include enhancements to the Android SDK configuration, the introduction of new classes and methods for managing bulk demand processes, and improvements in navigation handling across various screens. Additionally, several UI components have been refined to enhance user experience, while configuration files have been updated to support new features and functionalities.

Changes

File Path Change Summary
frontend/mgramseva/android/app/build.gradle Updated compileSdkVersion to 34, set minSdkVersion to 21, and enabled code shrinking.
frontend/mgramseva/lib/components/dashboard/bills_table.dart Introduced LedgerLabelText widget for localized label display.
frontend/mgramseva/lib/main.dart Modified state management in _MyAppState and _LandingPageState classes.
frontend/mgramseva/lib/providers/common_provider.dart Replaced window.localStorage with html.window.localStorage and added appBarUpdate method.
frontend/mgramseva/lib/providers/consumer_details_provider.dart Updated navigation pop method to target root navigator.
frontend/mgramseva/lib/providers/reports_provider.dart Enhanced logic for generating reports and added optional parameter to methods.
frontend/mgramseva/lib/screeens/dashboard/dashboard.dart Replaced WillPopScope with PopScope for back navigation.
frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart Updated navigation logic in _GenerateBillState class.
frontend/mgramseva/lib/screeens/home/home.dart Added CommonProvider to update app bar state.
frontend/mgramseva/lib/screeens/home/home_card.dart Simplified key assignment for Card widget.
frontend/mgramseva/lib/screeens/household_register/household_register.dart Replaced WillPopScope with PopScope for navigation control.
frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart Commented out automatic calls related to ledger report display.
frontend/mgramseva/lib/utils/common_methods.dart Updated navigation method and replaced WillPopScope with PopScope.
frontend/micro-ui/web/.babelrc Simplified JSON structure in Babel configuration.
frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/topbar.scss Added CSS rule for margin adjustments.
frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js Enhanced filtering logic for tenant codes.
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/config/WSCalculationConfiguration.java Added configuration for duplicate bulk demand checks.
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/WSCalculationDao.java Introduced new methods for bulk demand handling.
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/WSCalculationDaoImpl.java Enhanced functionality with new methods for bulk demand operations.
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/builder/WSCalculatorQueryBuilder.java Added new query methods for bulk demand records.
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java Introduced methods for managing bulk demand operations.
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java Added new dependency for handling duplicate requests.
municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/web/models/BulkDemandBatch.java New class for handling bulk demand batches.
utilities/mdms-migration/.../application.properties Added configuration properties for server and database settings.
utilities/mdms-migration/output/.../DataApiControllerTest.java Added test suite for DataApiController.

Poem

🐇 In the garden where changes bloom,
The code hops lightly, making room.
New classes dance, and methods play,
Enhancing the app in a joyful way.
With every update, we leap and cheer,
For a brighter future, oh so near! 🌼


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 29

Outside diff range, codebase verification and nitpick comments (12)
municipal-services/ws-calculator/src/main/resources/db/migration/ddl/V20240826000600__wsc_bulk_create_ddl.sql (2)

4-4: Missing default value for createdTime column

The createdTime column is added with a BIGINT NOT NULL constraint, but there is no default value specified. This could lead to issues with existing rows in the eg_ws_bulk_demand_batch table. Consider setting a default value to ensure data integrity.

Analysis chain

Verify the default value for the createdTime column.

Ensure that all existing rows have a valid value for the createdTime column when adding it with a NOT NULL constraint.

Run the following script to verify the default value for the createdTime column:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the default value for the `createdTime` column.

# Test: Check if the `createdTime` column has a default value. Expect: A default value is set.
rg --type sql 'createdTime BIGINT NOT NULL'

Length of output: 231


2-2: Dropping the createdTime column may cause issues.

The createdTime column is actively used in the codebase, particularly in the WSCalculationDaoImpl class, where it is part of an SQL update query. Dropping this column without addressing its usage could lead to runtime errors or broken functionality.

  • Location of concern:
    • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/WSCalculationDaoImpl.java

Please ensure that all references to the createdTime column are appropriately handled before proceeding with its removal.

Analysis chain

Verify the impact of dropping the createdTime column.

Ensure that the createdTime column is not used elsewhere in the codebase before dropping it.

Run the following script to verify the usage of the createdTime column:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `createdTime` column in the codebase.

# Test: Search for the `createdTime` column usage. Expect: No occurrences.
rg --type sql --type java --type xml 'createdTime'

Length of output: 20022

utilities/mdms-migration/output/README.md (2)

13-13: Fix grammatical error.

Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound.

- Start your server as an simple java application
+ Start your server as a simple java application
Tools
LanguageTool

[misspelling] ~13-~13: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...gfox/springfox) Start your server as an simple java application You can view...

(EN_A_VS_AN)


15-16: Fix bare URL.

Use Markdown syntax to format the URL.

- http://localhost:8080/
+ [http://localhost:8080/](http://localhost:8080/)
Tools
Markdownlint

16-16: null
Bare URL used

(MD034, no-bare-urls)

utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationRequest.java (2)

1-1: Consider adding a license header.

It's a good practice to include a license header at the top of the file.


19-19: Remove autogenerated annotation.

The @Generated annotation is typically used to indicate that the class was generated by a tool. If this class is not autogenerated, consider removing this annotation.

utilities/mdms-migration/output/src/main/java/digit/util/ResponseInfoFactory.java (1)

1-1: Consider adding a license header.

It's a good practice to include a license header at the top of the file.

utilities/mdms-migration/output/src/main/java/digit/util/FileWriter.java (1)

1-1: Consider adding a license header.

It's a good practice to include a license header at the top of the file.

utilities/mdms-migration/output/src/main/java/digit/web/models/Mdms.java (1)

1-1: Add a class-level Javadoc comment.

Consider adding a Javadoc comment to describe the purpose of the Mdms class.

utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionResponse.java (1)

1-1: Add a class-level Javadoc comment.

Consider adding a Javadoc comment to describe the purpose of the SchemaDefinitionResponse class.

frontend/mgramseva/lib/widgets/common_success_page.dart (1)

38-47: Add documentation.

The method should include documentation to explain the purpose and behavior of the PopScope widget.

Apply this diff to add documentation:

 @override
 Widget build(BuildContext context) {
+  // The PopScope widget is used to manage the back navigation behavior.
+  // The canPop property is set to false to prevent popping the current route.
+  // The onPopInvoked callback is used to handle the pop event.
   return PopScope(
     canPop: false,
     onPopInvoked: (didPop) async {
        if (didPop) {    
         CommonMethods.home(); 
         return;
       }
     },
     child: Scaffold(
frontend/mgramseva/lib/screeens/household_register/household_register.dart (1)

53-56: Add documentation.

The method should include documentation to explain the purpose and behavior of the PopScope widget.

Apply this diff to add documentation:

 @override
 Widget build(BuildContext context) {
+  // The PopScope widget is used to manage the back navigation behavior.
+  // The canPop property is set to false to prevent popping the current route.
+  // The onPopInvoked callback is used to handle the pop event.
   return PopScope(
     canPop: householdRegisterProvider.removeOverLay(_overlayEntry) ? false: true,
     onPopInvoked : (didPop){
   },
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0c76cb4 and db043d8.

Files selected for processing (78)
  • frontend/mgramseva/android/app/build.gradle (3 hunks)
  • frontend/mgramseva/lib/components/dashboard/bills_table.dart (2 hunks)
  • frontend/mgramseva/lib/main.dart (3 hunks)
  • frontend/mgramseva/lib/providers/common_provider.dart (15 hunks)
  • frontend/mgramseva/lib/providers/consumer_details_provider.dart (1 hunks)
  • frontend/mgramseva/lib/providers/reports_provider.dart (6 hunks)
  • frontend/mgramseva/lib/screeens/dashboard/dashboard.dart (1 hunks)
  • frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart (1 hunks)
  • frontend/mgramseva/lib/screeens/home/home.dart (2 hunks)
  • frontend/mgramseva/lib/screeens/home/home_card.dart (1 hunks)
  • frontend/mgramseva/lib/screeens/household_register/household_register.dart (1 hunks)
  • frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart (1 hunks)
  • frontend/mgramseva/lib/utils/common_methods.dart (4 hunks)
  • frontend/mgramseva/lib/utils/constants.dart (1 hunks)
  • frontend/mgramseva/lib/utils/loaders.dart (4 hunks)
  • frontend/mgramseva/lib/widgets/common_success_page.dart (1 hunks)
  • frontend/mgramseva/lib/widgets/custom_app_bar.dart (4 hunks)
  • frontend/mgramseva/lib/widgets/error_page.dart (2 hunks)
  • frontend/micro-ui/web/.babelrc (1 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/topbar.scss (1 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js (2 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/OpenLinkContainer.js (1 hunks)
  • frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js (3 hunks)
  • frontend/micro-ui/web/public/index.html (1 hunks)
  • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/config/WSCalculationConfiguration.java (1 hunks)
  • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/WSCalculationDao.java (2 hunks)
  • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/WSCalculationDaoImpl.java (3 hunks)
  • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/builder/WSCalculatorQueryBuilder.java (3 hunks)
  • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java (2 hunks)
  • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java (3 hunks)
  • municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/web/models/BulkDemandBatch.java (1 hunks)
  • municipal-services/ws-calculator/src/main/resources/application.properties (1 hunks)
  • municipal-services/ws-calculator/src/main/resources/db/migration/ddl/V20240821000600__wsc_bulk_create_ddl.sql (1 hunks)
  • municipal-services/ws-calculator/src/main/resources/db/migration/ddl/V20240826000600__wsc_bulk_create_ddl.sql (1 hunks)
  • utilities/mdms-migration/mdms-migration-toolkit.yaml (1 hunks)
  • utilities/mdms-migration/output/README.md (1 hunks)
  • utilities/mdms-migration/output/pom.xml (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/Main.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/config/Configuration.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/config/MainConfiguration.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/constants/ErrorCodes.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/kafka/Consumer.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/kafka/Producer.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/repository/ServiceRequestRepository.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/service/MDMSApplicationRunnerImpl.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/service/MasterDataMigrationService.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/service/SchemaDefinitionMigrationService.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/FileReader.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/FileWriter.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/IdgenUtil.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/MdmsUtil.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/ResponseInfoFactory.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/UrlShortenerUtil.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/UserUtil.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/util/WorkflowUtil.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/controllers/DataApiController.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/controllers/SchemaApiController.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/Error.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/ErrorRes.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationCriteria.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationRequest.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/Mdms.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/MdmsRequest.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/RequestInfoWrapper.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/ResponseInfo.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/Role.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinition.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionRequest.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionResponse.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationCriteria.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationRequest.java (1 hunks)
  • utilities/mdms-migration/output/src/main/java/digit/web/models/User.java (1 hunks)
  • utilities/mdms-migration/output/src/main/resources/application.properties (1 hunks)
  • utilities/mdms-migration/output/src/test/java/digit/TestConfiguration.java (1 hunks)
  • utilities/mdms-migration/output/src/test/java/digit/web/controllers/DataApiControllerTest.java (1 hunks)
  • utilities/mdms-migration/output/src/test/java/digit/web/controllers/SchemaApiControllerTest.java (1 hunks)
Files skipped from review due to trivial changes (11)
  • frontend/mgramseva/lib/main.dart
  • frontend/mgramseva/lib/screeens/home/home_card.dart
  • frontend/mgramseva/lib/utils/constants.dart
  • frontend/micro-ui/web/.babelrc
  • frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js
  • frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/OpenLinkContainer.js
  • frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js
  • frontend/micro-ui/web/public/index.html
  • utilities/mdms-migration/output/src/main/java/digit/constants/ErrorCodes.java
  • utilities/mdms-migration/output/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java
  • utilities/mdms-migration/output/src/test/java/digit/TestConfiguration.java
Additional context used
LanguageTool
utilities/mdms-migration/output/README.md

[misspelling] ~13-~13: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...gfox/springfox) Start your server as an simple java application You can view...

(EN_A_VS_AN)

Markdownlint
utilities/mdms-migration/output/README.md

16-16: null
Bare URL used

(MD034, no-bare-urls)

yamllint
utilities/mdms-migration/mdms-migration-toolkit.yaml

[error] 63-63: trailing spaces

(trailing-spaces)


[error] 111-111: no new line character at the end of file

(new-line-at-end-of-file)


[error] 111-111: trailing spaces

(trailing-spaces)

checkov
utilities/mdms-migration/mdms-migration-toolkit.yaml

[HIGH] 1-112: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-112: Ensure that security operations is not empty.

(CKV_OPENAPI_5)

Additional comments not posted (177)
municipal-services/ws-calculator/src/main/resources/db/migration/ddl/V20240826000600__wsc_bulk_create_ddl.sql (2)

6-6: Verify the impact of changing the column type for lastModifiedBy.

Ensure that the data stored in the lastModifiedBy column is compatible with the new type VARCHAR(64).

Run the following script to verify the impact of changing the column type:


8-8: Verify the default value for the lastModifiedTime column.

Ensure that all existing rows have a valid value for the lastModifiedTime column when setting it as NOT NULL.

Run the following script to verify the default value for the lastModifiedTime column:

utilities/mdms-migration/output/src/main/java/digit/web/models/RequestInfoWrapper.java (1)

1-18: LGTM!

The class is well-structured and uses Lombok annotations to reduce boilerplate code. The JsonProperty annotation ensures proper serialization and deserialization.

The code changes are approved.

municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/web/models/BulkDemandBatch.java (1)

1-23: LGTM!

The class is well-structured and uses Lombok annotations to reduce boilerplate code. The fields cover essential information for a bulk demand batch.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/kafka/Producer.java (4)

1-6: LGTM!

The package and import statements are correct and necessary for the functionality.

The code changes are approved.


10-12: LGTM!

The class-level annotations and class definition are correct and follow best practices.

The code changes are approved.


14-15: LGTM!

The field-level annotations and field definition are correct and necessary for the functionality.

The code changes are approved.


17-19: LGTM!

The method definition is correct and follows best practices.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/kafka/Consumer.java (3)

1-7: LGTM!

The package and import statements are correct and necessary for the functionality.

The code changes are approved.


8-9: LGTM!

The class-level annotations and class definition are correct and follow best practices.

The code changes are approved.


16-20: LGTM!

The method-level comments and method definition are correct, but the method is not yet implemented.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/Main.java (3)

1-9: LGTM!

The package and import statements are correct and necessary for the functionality.

The code changes are approved.


10-13: LGTM!

The class-level annotations and class definition are correct and follow best practices.

The code changes are approved.


16-18: LGTM!

The method definition is correct and follows best practices.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/MdmsRequest.java (3)

1-11: LGTM!

The package declaration and imports are standard and correctly implemented.

The code changes are approved.


12-17: LGTM!

The class annotations and declaration are correctly implemented.

The code changes are approved.


19-25: LGTM!

The fields and their annotations are correctly implemented.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionRequest.java (3)

1-10: LGTM!

The package declaration and imports are standard and correctly implemented.

The code changes are approved.


11-17: LGTM!

The class annotations and declaration are correctly implemented.

The code changes are approved.


18-26: LGTM!

The fields and their annotations are correctly implemented.

The code changes are approved.

utilities/mdms-migration/output/README.md (1)

18-18: LGTM!

The content is informative and correctly implemented.

The code changes are approved.

municipal-services/ws-calculator/src/main/resources/db/migration/ddl/V20240821000600__wsc_bulk_create_ddl.sql (5)

1-11: Improve table schema and ensure consistency.

  • Ensure that tenantId and billingPeriod columns have appropriate constraints (e.g., foreign keys).
  • The lastModifiedBy column is of type bigint while createdBy is of type character varying(64), which might be inconsistent. Ensure consistency in data types.
  • Consider adding comments to describe the purpose of each column.
CREATE TABLE IF NOT EXISTS eg_ws_bulk_demand_batch
(
  id VARCHAR(64) PRIMARY KEY,
  tenantId VARCHAR(64) NOT NULL,
  billingPeriod VARCHAR(64) NOT NULL,
  createdTime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  status VARCHAR(50) NOT NULL,
  createdBy character varying(64) NOT NULL,
  lastModifiedBy character varying(64) NOT NULL, -- Changed to match createdBy
  lastModifiedTime TIMESTAMP -- Changed to TIMESTAMP for consistency
);

12-17: LGTM!

The sequence creation statement is correctly implemented.

The code changes are approved.


18-18: LGTM!

The alter table statement is correctly implemented.

The code changes are approved.


20-20: LGTM!

The index creation statement is correctly implemented.

The code changes are approved.


21-21: LGTM!

The index creation statement is correctly implemented.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationCriteria.java (1)

1-33: Improve validation and documentation.

  • Ensure that the tenantId property is validated for length and format.
  • Consider adding comments to describe the purpose of the class and its properties.
package digit.web.models;

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.*;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Data;
import lombok.Builder;

/**
 * SchemaMigrationCriteria
 */
@Validated
@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SchemaMigrationCriteria {

    @JsonProperty("tenantId")
    @NotNull
    @Size(min = 1, max = 64) // Added length validation
    private String tenantId = null;

}
utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationCriteria.java (1)

1-36: Improve validation and documentation.

  • Ensure that the tenantId property is validated for format.
  • Consider adding comments to describe the purpose of the class and its properties.
package digit.web.models;

import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.*;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Data;
import lombok.Builder;

/**
 * MasterDataMigrationCriteria
 */
@Validated
@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MasterDataMigrationCriteria {

    @JsonProperty("tenantId")
    @NotNull
    @Size(min = 1, max = 2000)
    @Pattern(regexp = "^[a-zA-Z0-9-]+$") // Added format validation
    private List<String> tenantId = null;

}
utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationRequest.java (4)

18-18: Ensure proper validation.

The @Validated annotation ensures that the fields are validated. Ensure that the validation logic is correctly implemented in the MasterDataMigrationCriteria and RequestInfo classes.


20-23: LGTM!

The Lombok annotations (@Data, @AllArgsConstructor, @NoArgsConstructor, @Builder) are correctly used to generate boilerplate code.


25-27: Ensure MasterDataMigrationCriteria is correctly defined.

The masterDataMigrationCriteria field is annotated with @JsonProperty and @Valid. Ensure that the MasterDataMigrationCriteria class is correctly defined and validated.


29-32: LGTM!

The requestInfo field is annotated with @JsonProperty, @NotNull, and @Valid. The annotations are correctly used to ensure that the field is not null and is validated.

utilities/mdms-migration/output/src/main/java/digit/util/ResponseInfoFactory.java (1)

21-22: LGTM!

The method correctly creates a ResponseInfo object from the RequestInfo object.

utilities/mdms-migration/output/src/main/java/digit/util/FileWriter.java (1)

20-21: Ensure the property is correctly defined.

The masterSchemaFilesDirectory property is injected using @Value. Ensure that the property is correctly defined in the configuration files.

utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationRequest.java (1)

1-39: LGTM!

The class is correctly implemented with appropriate annotations and validation.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinition.java (1)

1-52: LGTM!

The class is correctly implemented with appropriate annotations and validation.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/Mdms.java (8)

3-5: Ensure proper import organization.

The imports are well-organized and relevant to the class.


17-21: Annotations for validation and Lombok.

The class is annotated with @Validated, @Data, @AllArgsConstructor, @NoArgsConstructor, and @Builder, which are appropriate for this data model.


23-26: Property tenantId should be non-null and have a size constraint.

The tenantId property is correctly annotated with @JsonProperty, @NotNull, and @Size to ensure it meets the required constraints.


28-30: Property schemaCode should have a size constraint.

The schemaCode property is correctly annotated with @JsonProperty and @Size to ensure it meets the required constraints.


32-34: Property uniqueIdentifier should have a size constraint.

The uniqueIdentifier property is correctly annotated with @JsonProperty and @Size to ensure it meets the required constraints.


36-38: Property data should be non-null.

The data property is correctly annotated with @JsonProperty and @NotNull to ensure it meets the required constraints.


40-41: Property isActive should have a default value.

The isActive property is correctly annotated with @JsonProperty and has a default value of true.


43-45: Property auditDetails should be valid.

The auditDetails property is correctly annotated with @JsonProperty and @Valid to ensure it meets the required constraints.

utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionResponse.java (6)

3-5: Ensure proper import organization.

The imports are well-organized and relevant to the class.


16-19: Class-level Javadoc comment.

The class has a Javadoc comment describing it as a response from the server, which is helpful for understanding its purpose.


20-25: Annotations for validation and Lombok.

The class is annotated with @Schema, @Validated, @Data, @AllArgsConstructor, @NoArgsConstructor, and @Builder, which are appropriate for this data model.


27-30: Property responseInfo should be valid.

The responseInfo property is correctly annotated with @JsonProperty and @Valid to ensure it meets the required constraints.


32-34: Property schemaDefinitions should be valid.

The schemaDefinitions property is correctly annotated with @JsonProperty and @Valid to ensure it meets the required constraints.


37-43: Method addSchemaDefinitionsItem should handle null list.

The addSchemaDefinitionsItem method correctly handles the case where schemaDefinitions is null by initializing it as a new ArrayList.

municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/WSCalculationDao.java (3)

33-33: Method isDuplicateBulkDemandCall should handle potential null values.

Ensure that the implementation of this method handles potential null values for tenantId, billingPeriod, and fromTime.


35-35: Method insertBulkDemandCall should handle potential null values.

Ensure that the implementation of this method handles potential null values for tenantId, billingPeriod, status, and auditDetails.


37-37: Method updateStatusForOldRecords should handle potential null values.

Ensure that the implementation of this method handles potential null values for tenantId, durationAgo, billingPeriod, and auditDetails.

utilities/mdms-migration/output/src/main/java/digit/repository/ServiceRequestRepository.java (2)

4-14: LGTM!

The imports are appropriate and necessary for the class functionality.

The code changes are approved.


15-45: LGTM!

The class is well-structured and follows Spring's dependency injection principles.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/Role.java (2)

3-9: LGTM!

The imports are appropriate and necessary for the class functionality.

The code changes are approved.


15-44: LGTM!

The class is well-structured and follows best practices for model classes.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/util/FileReader.java (2)

3-19: LGTM!

The imports are appropriate and necessary for the class functionality.

The code changes are approved.


21-47: LGTM!

The class is well-structured and follows Spring's dependency injection principles.

The code changes are approved.

utilities/mdms-migration/output/src/test/java/digit/web/controllers/DataApiControllerTest.java (4)

1-26: LGTM!

The imports are appropriate and necessary for the test class.

The code changes are approved.


27-34: LGTM!

The class definition and annotations are appropriate for the test class.

The code changes are approved.


39-44: LGTM!

The method is correctly implemented to test the success scenario.

The code changes are approved.


46-51: LGTM!

The method is correctly implemented to test the failure scenario.

The code changes are approved.

utilities/mdms-migration/output/src/test/java/digit/web/controllers/SchemaApiControllerTest.java (4)

1-26: LGTM!

The imports are appropriate and necessary for the test class.

The code changes are approved.


27-34: LGTM!

The class definition and annotations are appropriate for the test class.

The code changes are approved.


39-44: LGTM!

The method is correctly implemented to test the success scenario.

The code changes are approved.


46-51: LGTM!

The method is correctly implemented to test the failure scenario.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/ErrorRes.java (2)

1-18: LGTM!

The imports are appropriate and necessary for the class.

The code changes are approved.


19-49: LGTM!

The class definition and annotations are appropriate for the model class. The addErrorsItem method is correctly implemented.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/Error.java (4)

1-15: LGTM!

The package and import statements are appropriate and necessary for the functionality of the Error class.

The code changes are approved.


17-27: LGTM!

The class-level annotations and documentation are appropriate and provide necessary metadata for the Error class.

The code changes are approved.


28-44: LGTM!

The property declarations and annotations are appropriate for the Error class.

The code changes are approved.


47-53: LGTM!

The addParamsItem method is correctly implemented and handles null initialization.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/util/IdgenUtil.java (3)

1-19: LGTM!

The package and import statements are appropriate and necessary for the functionality of the IdgenUtil class.

The code changes are approved.


20-30: LGTM!

The class-level annotations and member variables are appropriate and provide necessary dependencies for the IdgenUtil class.

The code changes are approved.


32-48: Add error handling for fetchResult call.

The getIdList method is correctly implemented but lacks error handling for the fetchResult call. Consider adding a try-catch block to handle potential exceptions.

 public List<String> getIdList(RequestInfo requestInfo, String tenantId, String idName, String idformat, Integer count) {
     List<IdRequest> reqList = new ArrayList<>();
     for (int i = 0; i < count; i++) {
         reqList.add(IdRequest.builder().idName(idName).format(idformat).tenantId(tenantId).build());
     }

     IdGenerationRequest request = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build();
     StringBuilder uri = new StringBuilder(configs.getIdGenHost()).append(configs.getIdGenPath());
-    IdGenerationResponse response = mapper.convertValue(restRepo.fetchResult(uri, request), IdGenerationResponse.class);
+    IdGenerationResponse response;
+    try {
+        response = mapper.convertValue(restRepo.fetchResult(uri, request), IdGenerationResponse.class);
+    } catch (Exception e) {
+        throw new CustomException("IDGEN ERROR", "Error while fetching result from idgen Service: " + e.getMessage());
+    }

     List<IdResponse> idResponses = response.getIdResponses();

     if (CollectionUtils.isEmpty(idResponses))
         throw new CustomException("IDGEN ERROR", "No ids returned from idgen Service");

     return idResponses.stream().map(IdResponse::getId).collect(Collectors.toList());
 }
frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/topbar.scss (2)

Line range hint 1-100: LGTM!

The existing CSS rules are appropriate for the topbar component.

The code changes are approved.


101-104: LGTM!

The new CSS rule is appropriate and ensures that .rmv-padding and .employee-select-wrap elements will not have any bottom margin.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/config/MainConfiguration.java (6)

3-18: LGTM!

The import statements are appropriate and necessary for the functionality provided in the file.

The code changes are approved.


25-26: LGTM!

The field is correctly defined to inject the application timezone.

The code changes are approved.


28-31: LGTM!

The method is correctly implemented to set the default timezone.

The code changes are approved.


33-40: LGTM!

The method is correctly implemented to provide a JsonSchemaInferrer bean.

The code changes are approved.


43-45: LGTM!

The method is correctly implemented to provide a configured ObjectMapper.

The code changes are approved.


47-53: LGTM!

The method is correctly implemented to provide a MappingJackson2HttpMessageConverter bean.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/controllers/SchemaApiController.java (4)

4-26: LGTM!

The import statements are appropriate and necessary for the functionality provided in the file.

The code changes are approved.


33-43: LGTM!

The fields are correctly defined and initialized via constructor injection.

The code changes are approved.


46-50: LGTM!

The method is correctly implemented to handle the request and call the service method.

The code changes are approved.


52-56: LGTM!

The method is correctly implemented to handle the request and call the service method.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/controllers/DataApiController.java (3)

4-33: LGTM!

The import statements are appropriate and necessary for the functionality provided in the file.

The code changes are approved.


40-47: LGTM!

The fields are correctly defined and initialized via constructor injection.

The code changes are approved.


50-54: LGTM!

The method is correctly implemented to handle the request and call the service method.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/config/Configuration.java (9)

3-15: LGTM!

The import statements are appropriate and necessary for the functionality provided in the class.

The code changes are approved.


16-23: LGTM!

The class annotations and declaration are appropriate and necessary for the functionality provided in the class.

The code changes are approved.


26-40: LGTM!

The User Config section is appropriately defined with necessary configuration properties.

The code changes are approved.


43-48: LGTM!

The Idgen Config section is appropriately defined with necessary configuration properties.

The code changes are approved.


51-62: LGTM!

The Workflow Config section is appropriately defined with necessary configuration properties.

The code changes are approved.


65-70: LGTM!

The MDMS Config section is appropriately defined with necessary configuration properties.

The code changes are approved.


73-78: LGTM!

The HRMS Config section is appropriately defined with necessary configuration properties.

The code changes are approved.


81-86: LGTM!

The URLShortening Config section is appropriately defined with necessary configuration properties.

The code changes are approved.


89-91: LGTM!

The SMSNotification Config section is appropriately defined with necessary configuration properties.

The code changes are approved.

frontend/mgramseva/android/app/build.gradle (3)

36-36: LGTM!

The compileSdkVersion has been appropriately updated to the latest SDK version.

The code changes are approved.


45-45: LGTM!

The minSdkVersion has been appropriately set to 21, clarifying the minimum supported version for the application.

The code changes are approved.


68-68: LGTM!

The minifyEnabled has been appropriately set to true for the release build type, indicating that code shrinking will be applied during the release build process.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/ResponseInfo.java (6)

3-15: LGTM!

The import statements are appropriate and necessary for the functionality provided in the class.

The code changes are approved.


16-25: LGTM!

The class annotations and declaration are appropriate and necessary for the functionality provided in the class.

The code changes are approved.


27-30: LGTM!

The apiId property is appropriately defined with necessary annotations.

The code changes are approved.


32-35: LGTM!

The ver property is appropriately defined with necessary annotations.

The code changes are approved.


37-40: LGTM!

The ts property is appropriately defined with necessary annotations.

The code changes are approved.


42-82: LGTM!

The resMsgId, msgId, and status properties are appropriately defined with necessary annotations.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/util/MdmsUtil.java (1)

54-77: LGTM!

The method is correctly implemented.

The code changes are approved.

frontend/mgramseva/lib/widgets/error_page.dart (1)

20-26: LGTM! But verify the CommonMethods.home() method.

The changes improve the handling of back navigation. Ensure that the CommonMethods.home() method handles navigation correctly.

The code changes are approved.

Run the following script to verify the CommonMethods.home() method:

frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js (2)

57-57: LGTM!

The changes improve the robustness of the code.

The code changes are approved.


84-87: LGTM!

The changes enhance the user experience by preventing the dropdown from becoming excessively large or small.

The code changes are approved.

utilities/mdms-migration/output/src/main/resources/application.properties (10)

23-29: Ensure Kafka configurations are correct.

Verify that the Kafka configurations are correct and appropriate for the application. Consider using environment variables for sensitive information.

Ensure that the Kafka configurations are correct and appropriate for the application.


44-49: Verify localization configurations.

Ensure that the localization configurations are correct and appropriate for the application.

Ensure that the localization configurations are correct and appropriate for the application.


51-56: Verify MDMS and HRMS configurations.

Ensure that the MDMS and HRMS configurations are correct and appropriate for the application.

Ensure that the MDMS and HRMS configurations are correct and appropriate for the application.


59-63: Verify user configurations.

Ensure that the user configurations are correct and appropriate for the application.

Ensure that the user configurations are correct and appropriate for the application.


66-67: Verify ID generation configurations.

Ensure that the ID generation configurations are correct and appropriate for the application.

Ensure that the ID generation configurations are correct and appropriate for the application.


70-74: Verify workflow configurations.

Ensure that the workflow configurations are correct and appropriate for the application.

Ensure that the workflow configurations are correct and appropriate for the application.


77-78: Verify URL shortener configurations.

Ensure that the URL shortener configurations are correct and appropriate for the application.

Ensure that the URL shortener configurations are correct and appropriate for the application.


80-84: Verify Kafka topics configurations.

Ensure that the Kafka topics configurations are correct and appropriate for the application.

Ensure that the Kafka topics configurations are correct and appropriate for the application.


86-88: Verify MDMS configuration path and URL.

Ensure that the MDMS configuration path and URL are correct and appropriate for the application.

Ensure that the MDMS configuration path and URL are correct and appropriate for the application.


90-90: Verify master schema files directory.

Ensure that the master schema files directory is correct and appropriate for the application.

Ensure that the master schema files directory is correct and appropriate for the application.

utilities/mdms-migration/mdms-migration-toolkit.yaml (5)

1-8: Ensure API information is correct.

Verify that the API information, including title, description, contact, and version, is correct and appropriate for the application.

Ensure that the API information is correct and appropriate for the application.

Tools
checkov

[HIGH] 1-112: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-112: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


10-35: Ensure schema migration API specifications are correct.

Verify that the schema migration API specifications, including paths, request body, and responses, are correct and appropriate for the application.

Ensure that the schema migration API specifications are correct and appropriate for the application.


37-63: Ensure master data migration API specifications are correct.

Verify that the master data migration API specifications, including paths, request body, and responses, are correct and appropriate for the application.

Ensure that the master data migration API specifications are correct and appropriate for the application.

Tools
yamllint

[error] 63-63: trailing spaces

(trailing-spaces)


65-93: Ensure schema and master data migration criteria are correct.

Verify that the schema and master data migration criteria, including required fields and properties, are correct and appropriate for the application.

Ensure that the schema and master data migration criteria are correct and appropriate for the application.


95-111: Ensure schema and master data migration request specifications are correct.

Verify that the schema and master data migration request specifications, including required fields and properties, are correct and appropriate for the application.

Ensure that the schema and master data migration request specifications are correct and appropriate for the application.

Tools
yamllint

[error] 111-111: no new line character at the end of file

(new-line-at-end-of-file)


[error] 111-111: trailing spaces

(trailing-spaces)

utilities/mdms-migration/output/src/main/java/digit/util/UserUtil.java (4)

91-100: LGTM!

The method is correctly implemented.

The code changes are approved.


109-116: LGTM!

The method is correctly implemented.

The code changes are approved.


123-129: LGTM!

The method is correctly implemented.

The code changes are approved.


31-35: Remove redundant field initialization.

The fields mapper and serviceRequestRepository are already initialized by dependency injection. Remove the redundant field initialization in the constructor.

@Autowired
public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository) {
-    this.mapper = mapper;
-    this.serviceRequestRepository = serviceRequestRepository;
}

Likely invalid or redundant comment.

utilities/mdms-migration/output/pom.xml (3)

1-7: LGTM!

The project metadata section is correctly implemented.

The code changes are approved.


8-12: LGTM!

The properties section is correctly implemented.

The code changes are approved.


13-17: LGTM!

The parent section is correctly implemented.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/web/models/User.java (3)

1-28: LGTM!

The class-level annotations and metadata are correctly implemented.

The code changes are approved.


30-189: LGTM!

The field declarations and annotations are correctly implemented.

The code changes are approved.


192-195: LGTM!

The method is correctly implemented.

The code changes are approved.

municipal-services/ws-calculator/src/main/resources/application.properties (1)

170-170: LGTM!

The new property bulk.demand.duplicateCheck.duration.hours is appropriately named and the value is set correctly.

The code changes are approved.

frontend/mgramseva/lib/utils/loaders.dart (4)

20-21: LGTM!

The use of PopScope with canPop: false is appropriate for a loading dialog to prevent dismissal.

The code changes are approved.


63-70: LGTM!

The use of PopScope with canPop: false and canPop: true appropriately controls the dismissal behavior of the dialog.

The code changes are approved.


95-102: LGTM!

The use of PopScope with canPop: false and canPop: true appropriately controls the dismissal behavior of the dialog.

The code changes are approved.


135-142: LGTM!

The use of PopScope with canPop: false and canPop: true appropriately controls the dismissal behavior of the dialog.

The code changes are approved.

municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/config/WSCalculationConfiguration.java (1)

277-278: LGTM!

The new field duplicateBulkDemandDurationHours is appropriately named and the @Value annotation is correctly used.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/util/WorkflowUtil.java (6)

39-55: LGTM!

The method is correctly implemented with proper error handling.

The code changes are approved.


68-76: LGTM!

The method is correctly implemented.

The code changes are approved.


84-92: LGTM!

The method is correctly implemented.

The code changes are approved.


104-129: LGTM!

The method is correctly implemented with proper handling of user assignments.

The code changes are approved.


136-158: LGTM!

The method is correctly implemented.

The code changes are approved.


165-171: LGTM!

The method is correctly implemented.

The code changes are approved.

frontend/mgramseva/lib/screeens/home/home.dart (1)

42-50: LGTM!

The changes enhance the functionality of the method by updating the app bar based on the common provider's state.

The code changes are approved.

utilities/mdms-migration/output/src/main/java/digit/service/MDMSApplicationRunnerImpl.java (2)

198-200: LGTM!

The method is correctly implemented.

The code changes are approved.


202-204: LGTM!

The method is correctly implemented.

The code changes are approved.

frontend/mgramseva/lib/components/dashboard/bills_table.dart (1)

132-134: LGTM!

The conditional rendering is correctly implemented.

The code changes are approved.

frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart (1)

79-81: Verify the change.

The commenting out of these lines indicates a shift in control flow. Ensure that this change is intentional and does not affect the functionality.

Please confirm that the commenting out of these lines is intentional and does not affect the functionality.

frontend/mgramseva/lib/widgets/custom_app_bar.dart (3)

35-38: Verify the intention behind commenting out the original logic.

The original logic for handling tenant selection is commented out. Ensure this is intentional and not an oversight.


59-59: LGTM!

Filtering tenants based on city?.districtCode refines the tenant list displayed to the user.


107-107: LGTM!

The updated navigation logic ensures the correct context is used when dismissing the dialog.

municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/repository/builder/WSCalculatorQueryBuilder.java (3)

49-49: LGTM!

The constant duplicateBulkDemandCallQuery is correctly defined.


207-220: LGTM!

The method getDuplicateBulkDemandCallQuery is correctly implemented and enhances the ability to check for duplicate processing of bulk demands.


222-235: LGTM!

The method getInsertBulkDemandCallQuery is correctly implemented and ensures all necessary information is captured when creating a new record.

frontend/mgramseva/lib/utils/common_methods.dart (2)

24-29: LGTM!

The new approach simplifies the navigation process to the home screen by removing all previous routes and pushing a new route to the stack.


Line range hint 381-402: LGTM!

The new callback mechanism for handling pop actions enhances the user experience during updates.

frontend/mgramseva/lib/screeens/dashboard/dashboard.dart (2)

90-95: Implement the onPopInvoked callback.

The onPopInvoked callback is currently incomplete. Ensure to implement the necessary logic to handle the pop event.

Verify the intended functionality and error handling during the pop event.


91-92: LGTM!

The canPop property is correctly set based on the result of CustomOverlay.removeOverLay().

The code changes are approved.

municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java (4)

81-82: LGTM!

The EnrichmentService is correctly injected into the class.

The code changes are approved.


402-410: LGTM!

The logic for handling duplicate bulk demand requests is correctly implemented.

The code changes are approved.


417-422: LGTM!

The processing of audit details through the EnrichmentService is correctly implemented.

The code changes are approved.


418-418: LGTM!

The status update for old records is correctly implemented.

The code changes are approved.

frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart (1)

81-82: LGTM!

The change to use the root navigator for popping the route is correct and can address issues related to navigation hierarchy.

The code changes are approved.

frontend/mgramseva/lib/providers/consumer_details_provider.dart (2)

388-388: LGTM!

The change to use Navigator.of(context, rootNavigator: true).pop() ensures that the pop operation targets the root navigator, which is useful when multiple navigators are present in the widget tree.

The code changes are approved.


392-392: LGTM!

The change to use Navigator.of(context, rootNavigator: true).pop() ensures that the pop operation targets the root navigator, which is useful when multiple navigators are present in the widget tree.

The code changes are approved.

frontend/mgramseva/lib/providers/common_provider.dart (2)

14-14: LGTM!

The import of tenants.dart is necessary for the new tenant selection logic introduced in the file.

The code changes are approved.


995-1172: LGTM!

The introduction of the appBarUpdate and showDialogBox methods enhances the app bar's functionality by integrating tenant selection logic and improving user interactivity and experience.

The code changes are approved.

frontend/mgramseva/lib/providers/reports_provider.dart (3)

Line range hint 224-233: LGTM!

The updated calculation for total dues is robust and prevents potential null reference errors.

The code changes are approved.


374-380: LGTM!

The addition of the hideSerialNo parameter adds flexibility in report generation.

The code changes are approved.


392-395: LGTM!

The conditional statement for displaying the serial number based on the hideSerialNo parameter is correctly implemented.

The code changes are approved.

Comment on lines +11 to +15
/*
* Uncomment the below line to start consuming record from kafka.topics.consumer
* Value of the variable kafka.topics.consumer should be overwritten in application.properties
*/
//@KafkaListener(topics = {"kafka.topics.consumer"})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder: Implement the method.

The method listen is commented out and has a TODO comment.

Do you want me to generate the implementation code or open a GitHub issue to track this task?

Comment on lines +10 to +23
public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) {

final String apiId = requestInfo != null ? requestInfo.getApiId() : "";
final String ver = requestInfo != null ? requestInfo.getVer() : "";
Long ts = null;
if(requestInfo!=null)
ts = requestInfo.getTs();
final String resMsgId = "uief87324"; // FIXME : Hard-coded
final String msgId = requestInfo != null ? requestInfo.getMsgId() : "";
final String responseStatus = success ? "successful" : "failed";

return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId)
.status(responseStatus).build();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid hardcoding values.

The resMsgId is hardcoded. Consider making it configurable or generating it dynamically.

Apply this diff to avoid hardcoding the value:

- final String resMsgId = "uief87324"; // FIXME : Hard-coded
+ final String resMsgId = UUID.randomUUID().toString(); // Generate dynamically
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.

Suggested change
public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) {
final String apiId = requestInfo != null ? requestInfo.getApiId() : "";
final String ver = requestInfo != null ? requestInfo.getVer() : "";
Long ts = null;
if(requestInfo!=null)
ts = requestInfo.getTs();
final String resMsgId = "uief87324"; // FIXME : Hard-coded
final String msgId = requestInfo != null ? requestInfo.getMsgId() : "";
final String responseStatus = success ? "successful" : "failed";
return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId)
.status(responseStatus).build();
}
public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) {
final String apiId = requestInfo != null ? requestInfo.getApiId() : "";
final String ver = requestInfo != null ? requestInfo.getVer() : "";
Long ts = null;
if(requestInfo!=null)
ts = requestInfo.getTs();
final String resMsgId = UUID.randomUUID().toString(); // Generate dynamically
final String msgId = requestInfo != null ? requestInfo.getMsgId() : "";
final String responseStatus = success ? "successful" : "failed";
return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId)
.status(responseStatus).build();
}

Comment on lines +23 to +28
public void writeJsonToFile(JsonNode content, String fileName) {
try {
objectMapper.writeValue(new File(masterSchemaFilesDirectory + fileName + JSON_EXTENSION), content);
}catch (Exception e){
throw new CustomException(IO_ERROR_CODE, IO_WRITE_ERROR_MESSAGE);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve error handling.

The method catches a generic Exception. Consider catching more specific exceptions or adding more context to the CustomException.

Apply this diff to improve error handling:

- }catch (Exception e){
+ } catch (IOException e) {
+     throw new CustomException(IO_ERROR_CODE, IO_WRITE_ERROR_MESSAGE + ": " + e.getMessage());

Committable suggestion was skipped due to low confidence.

Comment on lines +22 to +35
public String getShortenedUrl(String url){

HashMap<String,String> body = new HashMap<>();
body.put("url",url);
StringBuilder builder = new StringBuilder(configs.getUrlShortnerHost());
builder.append(configs.getUrlShortnerEndpoint());
String res = restTemplate.postForObject(builder.toString(), body, String.class);

if(StringUtils.isEmpty(res)){
log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url); ;
return url;
}
else return res;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve error handling and logging.

The current implementation logs an error if the response is empty but does not handle other potential exceptions that may occur during the HTTP request. Additionally, consider using a more specific exception handling mechanism.

Apply this diff to improve error handling:

 public String getShortenedUrl(String url){
     HashMap<String,String> body = new HashMap<>();
     body.put("url",url);
     StringBuilder builder = new StringBuilder(configs.getUrlShortnerHost());
     builder.append(configs.getUrlShortnerEndpoint());
-    String res = restTemplate.postForObject(builder.toString(), body, String.class);
+    String res;
+    try {
+        res = restTemplate.postForObject(builder.toString(), body, String.class);
+    } catch (Exception e) {
+        log.error("URL_SHORTENING_ERROR", "Exception occurred while shortening url: " + url, e);
+        return url;
+    }

     if(StringUtils.isEmpty(res)){
         log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url);
         return url;
     } else {
         return res;
     }
 }
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.

Suggested change
public String getShortenedUrl(String url){
HashMap<String,String> body = new HashMap<>();
body.put("url",url);
StringBuilder builder = new StringBuilder(configs.getUrlShortnerHost());
builder.append(configs.getUrlShortnerEndpoint());
String res = restTemplate.postForObject(builder.toString(), body, String.class);
if(StringUtils.isEmpty(res)){
log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url); ;
return url;
}
else return res;
}
public String getShortenedUrl(String url){
HashMap<String,String> body = new HashMap<>();
body.put("url",url);
StringBuilder builder = new StringBuilder(configs.getUrlShortnerHost());
builder.append(configs.getUrlShortnerEndpoint());
String res;
try {
res = restTemplate.postForObject(builder.toString(), body, String.class);
} catch (Exception e) {
log.error("URL_SHORTENING_ERROR", "Exception occurred while shortening url: " + url, e);
return url;
}
if(StringUtils.isEmpty(res)){
log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url);
return url;
} else {
return res;
}
}

Comment on lines +31 to +43
public Object fetchResult(StringBuilder uri, Object request) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
Object response = null;
try {
response = restTemplate.postForObject(uri.toString(), request, Map.class);
}catch(HttpClientErrorException e) {
log.error("External Service threw an Exception: ",e);
throw new ServiceCallException(e.getResponseBodyAsString());
}catch(Exception e) {
log.error("Exception while fetching from searcher: ",e);
}

return response;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhance error handling.

The method is well-implemented but lacks a generic exception handling strategy. Consider throwing a custom exception for generic errors to maintain consistency.

Apply this diff to enhance error handling:

 catch(Exception e) {
     log.error("Exception while fetching from searcher: ",e);
-}
+throw new ServiceCallException("An error occurred while fetching the result.");
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.

Suggested change
public Object fetchResult(StringBuilder uri, Object request) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
Object response = null;
try {
response = restTemplate.postForObject(uri.toString(), request, Map.class);
}catch(HttpClientErrorException e) {
log.error("External Service threw an Exception: ",e);
throw new ServiceCallException(e.getResponseBodyAsString());
}catch(Exception e) {
log.error("Exception while fetching from searcher: ",e);
}
return response;
public Object fetchResult(StringBuilder uri, Object request) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
Object response = null;
try {
response = restTemplate.postForObject(uri.toString(), request, Map.class);
}catch(HttpClientErrorException e) {
log.error("External Service threw an Exception: ",e);
throw new ServiceCallException(e.getResponseBodyAsString());
}catch(Exception e) {
log.error("Exception while fetching from searcher: ",e);
throw new ServiceCallException("An error occurred while fetching the result.");
}
return response;

Comment on lines +112 to +161
public void prepareTenantMap(Map<String, Object> map) {

String tenantId = (String) map.get("tenantId");
String moduleName = (String) map.get("moduleName");
Set<String> masterKeys = map.keySet();
String nonMasterKeys = "tenantId,moduleName";
List<String> ignoreKey = new ArrayList<String>(Arrays.asList(nonMasterKeys.split(",")));
masterKeys.removeAll(ignoreKey);
boolean isMergeAllowed;
Map<String, JSONArray> masterDataMap = new HashMap<>();
Iterator<String> masterKeyIterator = masterKeys.iterator();
String masterName = null;
JSONArray masterDataJsonArray = null;
while (masterKeyIterator.hasNext()) {
masterName = masterKeyIterator.next();
try {
masterDataJsonArray = JsonPath.read(objectMapper.writeValueAsString(map.get(masterName)),
"$");
} catch (JsonProcessingException e) {
log.error("Error while parsing file", e);
}

if (!tenantMap.containsKey(tenantId)) {
Map<String, Map<String, JSONArray>> moduleMap = new HashMap<>();
moduleMap.put(moduleName, masterDataMap);
tenantMap.put(tenantId, moduleMap);
} else {
Map<String, Map<String, JSONArray>> tenantModule = tenantMap.get(tenantId);

if (!tenantModule.containsKey(moduleName)) {
tenantModule.put(moduleName, masterDataMap);
} else {
Map<String, JSONArray> moduleMaster = tenantModule.get(moduleName);
isMergeAllowed = isMergeAllowedForMaster(moduleName, masterName);

if (!moduleMaster.containsKey(masterName)) {
masterDataMap.put(masterName, masterDataJsonArray);
moduleMaster.putAll(masterDataMap);
tenantModule.put(moduleName, moduleMaster);
} else if (moduleMaster.containsKey(masterName) && isMergeAllowed) {
JSONArray existingMasterDataJsonArray = moduleMaster.get(masterName);
existingMasterDataJsonArray.merge(masterDataJsonArray);
} else if ((moduleMaster.containsKey(masterName) && !isMergeAllowed)) {
log.error("merge is not allowed for master ++" + moduleName + " " + masterName);
}
}
tenantMap.put(tenantId, tenantModule);
}
masterDataMap.put(masterName, masterDataJsonArray);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve readability and error handling.

Consider refactoring the method to improve readability and adding more specific error handling.

public void prepareTenantMap(Map<String, Object> map) {
    String tenantId = (String) map.get("tenantId");
    String moduleName = (String) map.get("moduleName");
    Set<String> masterKeys = map.keySet();
    String nonMasterKeys = "tenantId,moduleName";
    List<String> ignoreKey = new ArrayList<>(Arrays.asList(nonMasterKeys.split(",")));
    masterKeys.removeAll(ignoreKey);
    boolean isMergeAllowed;
    Map<String, JSONArray> masterDataMap = new HashMap<>();
    for (String masterName : masterKeys) {
        JSONArray masterDataJsonArray = null;
        try {
            masterDataJsonArray = JsonPath.read(objectMapper.writeValueAsString(map.get(masterName)), "$");
        } catch (JsonProcessingException e) {
            log.error("Error while parsing master data for {}: {}", masterName, e.getMessage(), e);
        }

        if (!tenantMap.containsKey(tenantId)) {
            Map<String, Map<String, JSONArray>> moduleMap = new HashMap<>();
            moduleMap.put(moduleName, masterDataMap);
            tenantMap.put(tenantId, moduleMap);
        } else {
            Map<String, Map<String, JSONArray>> tenantModule = tenantMap.get(tenantId);
            if (!tenantModule.containsKey(moduleName)) {
                tenantModule.put(moduleName, masterDataMap);
            } else {
                Map<String, JSONArray> moduleMaster = tenantModule.get(moduleName);
                isMergeAllowed = isMergeAllowedForMaster(moduleName, masterName);
                if (!moduleMaster.containsKey(masterName)) {
                    masterDataMap.put(masterName, masterDataJsonArray);
                    moduleMaster.putAll(masterDataMap);
                } else if (moduleMaster.containsKey(masterName) && isMergeAllowed) {
                    JSONArray existingMasterDataJsonArray = moduleMaster.get(masterName);
                    existingMasterDataJsonArray.merge(masterDataJsonArray);
                } else if (moduleMaster.containsKey(masterName) && !isMergeAllowed) {
                    log.error("Merge is not allowed for master {}: {}", moduleName, masterName);
                }
            }
            tenantMap.put(tenantId, tenantModule);
        }
        masterDataMap.put(masterName, masterDataJsonArray);
    }
}
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.

Suggested change
public void prepareTenantMap(Map<String, Object> map) {
String tenantId = (String) map.get("tenantId");
String moduleName = (String) map.get("moduleName");
Set<String> masterKeys = map.keySet();
String nonMasterKeys = "tenantId,moduleName";
List<String> ignoreKey = new ArrayList<String>(Arrays.asList(nonMasterKeys.split(",")));
masterKeys.removeAll(ignoreKey);
boolean isMergeAllowed;
Map<String, JSONArray> masterDataMap = new HashMap<>();
Iterator<String> masterKeyIterator = masterKeys.iterator();
String masterName = null;
JSONArray masterDataJsonArray = null;
while (masterKeyIterator.hasNext()) {
masterName = masterKeyIterator.next();
try {
masterDataJsonArray = JsonPath.read(objectMapper.writeValueAsString(map.get(masterName)),
"$");
} catch (JsonProcessingException e) {
log.error("Error while parsing file", e);
}
if (!tenantMap.containsKey(tenantId)) {
Map<String, Map<String, JSONArray>> moduleMap = new HashMap<>();
moduleMap.put(moduleName, masterDataMap);
tenantMap.put(tenantId, moduleMap);
} else {
Map<String, Map<String, JSONArray>> tenantModule = tenantMap.get(tenantId);
if (!tenantModule.containsKey(moduleName)) {
tenantModule.put(moduleName, masterDataMap);
} else {
Map<String, JSONArray> moduleMaster = tenantModule.get(moduleName);
isMergeAllowed = isMergeAllowedForMaster(moduleName, masterName);
if (!moduleMaster.containsKey(masterName)) {
masterDataMap.put(masterName, masterDataJsonArray);
moduleMaster.putAll(masterDataMap);
tenantModule.put(moduleName, moduleMaster);
} else if (moduleMaster.containsKey(masterName) && isMergeAllowed) {
JSONArray existingMasterDataJsonArray = moduleMaster.get(masterName);
existingMasterDataJsonArray.merge(masterDataJsonArray);
} else if ((moduleMaster.containsKey(masterName) && !isMergeAllowed)) {
log.error("merge is not allowed for master ++" + moduleName + " " + masterName);
}
}
tenantMap.put(tenantId, tenantModule);
}
masterDataMap.put(masterName, masterDataJsonArray);
}
public void prepareTenantMap(Map<String, Object> map) {
String tenantId = (String) map.get("tenantId");
String moduleName = (String) map.get("moduleName");
Set<String> masterKeys = map.keySet();
String nonMasterKeys = "tenantId,moduleName";
List<String> ignoreKey = new ArrayList<>(Arrays.asList(nonMasterKeys.split(",")));
masterKeys.removeAll(ignoreKey);
boolean isMergeAllowed;
Map<String, JSONArray> masterDataMap = new HashMap<>();
for (String masterName : masterKeys) {
JSONArray masterDataJsonArray = null;
try {
masterDataJsonArray = JsonPath.read(objectMapper.writeValueAsString(map.get(masterName)), "$");
} catch (JsonProcessingException e) {
log.error("Error while parsing master data for {}: {}", masterName, e.getMessage(), e);
}
if (!tenantMap.containsKey(tenantId)) {
Map<String, Map<String, JSONArray>> moduleMap = new HashMap<>();
moduleMap.put(moduleName, masterDataMap);
tenantMap.put(tenantId, moduleMap);
} else {
Map<String, Map<String, JSONArray>> tenantModule = tenantMap.get(tenantId);
if (!tenantModule.containsKey(moduleName)) {
tenantModule.put(moduleName, masterDataMap);
} else {
Map<String, JSONArray> moduleMaster = tenantModule.get(moduleName);
isMergeAllowed = isMergeAllowedForMaster(moduleName, masterName);
if (!moduleMaster.containsKey(masterName)) {
masterDataMap.put(masterName, masterDataJsonArray);
moduleMaster.putAll(masterDataMap);
} else if (moduleMaster.containsKey(masterName) && isMergeAllowed) {
JSONArray existingMasterDataJsonArray = moduleMaster.get(masterName);
existingMasterDataJsonArray.merge(masterDataJsonArray);
} else if (moduleMaster.containsKey(masterName) && !isMergeAllowed) {
log.error("Merge is not allowed for master {}: {}", moduleName, masterName);
}
}
tenantMap.put(tenantId, tenantModule);
}
masterDataMap.put(masterName, masterDataJsonArray);
}
}

Comment on lines +77 to +110
public void readFiles(String baseFolderPath, LinkedList<String> errorList) {
File folder = new File(baseFolderPath);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (File file : listOfFiles) {
if (file.isFile()) {
String name = file.getName();
String fileExtension = FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase();


if (fileExtension.equalsIgnoreCase("json")
|| fileExtension.equalsIgnoreCase("yaml")
|| fileExtension.equalsIgnoreCase("yml")
) {
log.debug("Reading file....:- " + file.getAbsolutePath());
try {
Map<String, Object> jsonMap = objectMapper.readValue(file, new TypeReference<Map<String, Object>>() {
@Override
public Type getType() {
return super.getType();
}
});
prepareTenantMap(jsonMap);
} catch (Exception e) {
log.error("Error occurred while loading file", e);
errorList.add(file.getAbsolutePath());
}
}
} else if (file.isDirectory()) {
readFiles(file.getAbsolutePath(), errorList);
}
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve readability and error handling.

Consider refactoring the method to improve readability and adding more specific error handling.

public void readFiles(String baseFolderPath, LinkedList<String> errorList) {
    File folder = new File(baseFolderPath);
    File[] listOfFiles = folder.listFiles();
    if (listOfFiles != null) {
        for (File file : listOfFiles) {
            if (file.isFile()) {
                processFile(file, errorList);
            } else if (file.isDirectory()) {
                readFiles(file.getAbsolutePath(), errorList);
            }
        }
    } else {
        log.warn("No files found in directory: {}", baseFolderPath);
    }
}

private void processFile(File file, LinkedList<String> errorList) {
    String name = file.getName();
    String fileExtension = FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase();

    if (fileExtension.equalsIgnoreCase("json")
            || fileExtension.equalsIgnoreCase("yaml")
            || fileExtension.equalsIgnoreCase("yml")
    ) {
        log.debug("Reading file....:- " + file.getAbsolutePath());
        try {
            Map<String, Object> jsonMap = objectMapper.readValue(file, new TypeReference<Map<String, Object>>() {});
            prepareTenantMap(jsonMap);
        } catch (Exception e) {
            log.error("Error occurred while loading file: {}", file.getAbsolutePath(), e);
            errorList.add(file.getAbsolutePath());
        }
    }
}
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.

Suggested change
public void readFiles(String baseFolderPath, LinkedList<String> errorList) {
File folder = new File(baseFolderPath);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (File file : listOfFiles) {
if (file.isFile()) {
String name = file.getName();
String fileExtension = FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase();
if (fileExtension.equalsIgnoreCase("json")
|| fileExtension.equalsIgnoreCase("yaml")
|| fileExtension.equalsIgnoreCase("yml")
) {
log.debug("Reading file....:- " + file.getAbsolutePath());
try {
Map<String, Object> jsonMap = objectMapper.readValue(file, new TypeReference<Map<String, Object>>() {
@Override
public Type getType() {
return super.getType();
}
});
prepareTenantMap(jsonMap);
} catch (Exception e) {
log.error("Error occurred while loading file", e);
errorList.add(file.getAbsolutePath());
}
}
} else if (file.isDirectory()) {
readFiles(file.getAbsolutePath(), errorList);
}
}
}
}
public void readFiles(String baseFolderPath, LinkedList<String> errorList) {
File folder = new File(baseFolderPath);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (File file : listOfFiles) {
if (file.isFile()) {
processFile(file, errorList);
} else if (file.isDirectory()) {
readFiles(file.getAbsolutePath(), errorList);
}
}
} else {
log.warn("No files found in directory: {}", baseFolderPath);
}
}
private void processFile(File file, LinkedList<String> errorList) {
String name = file.getName();
String fileExtension = FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase();
if (fileExtension.equalsIgnoreCase("json")
|| fileExtension.equalsIgnoreCase("yaml")
|| fileExtension.equalsIgnoreCase("yml")
) {
log.debug("Reading file....:- " + file.getAbsolutePath());
try {
Map<String, Object> jsonMap = objectMapper.readValue(file, new TypeReference<Map<String, Object>>() {});
prepareTenantMap(jsonMap);
} catch (Exception e) {
log.error("Error occurred while loading file: {}", file.getAbsolutePath(), e);
errorList.add(file.getAbsolutePath());
}
}
}

Comment on lines +114 to +115
var LedgerLabelText = Text(ApplicationLocalizations.of(context).translate("ledger_label"),style: TextStyle(
fontWeight: FontWeight.w700, color: Colors.black, fontSize: 12));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve readability.

Consider renaming LedgerLabelText to ledgerLabelText to follow naming conventions for variables.

var ledgerLabelText = Text(ApplicationLocalizations.of(context).translate("ledger_label"),style: TextStyle(
        fontWeight: FontWeight.w700, color: Colors.black, fontSize: 12));
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.

Suggested change
var LedgerLabelText = Text(ApplicationLocalizations.of(context).translate("ledger_label"),style: TextStyle(
fontWeight: FontWeight.w700, color: Colors.black, fontSize: 12));
var ledgerLabelText = Text(ApplicationLocalizations.of(context).translate("ledger_label"),style: TextStyle(
fontWeight: FontWeight.w700, color: Colors.black, fontSize: 12));

Comment on lines +1242 to +1244
public void insertBulkDemandCall(String tenantId, String billingPeriod, String status,AuditDetails auditDetails) {
waterCalculatorDao.insertBulkDemandCall(tenantId, billingPeriod, status,auditDetails);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add null checks for parameters.

To ensure robustness, consider adding null checks for the parameters tenantId, billingPeriod, status, and auditDetails.

Apply this diff to add null checks:

public void insertBulkDemandCall(String tenantId, String billingPeriod, String status, AuditDetails auditDetails) {
+  if (tenantId == null || billingPeriod == null || status == null || auditDetails == null) {
+    throw new IllegalArgumentException("Parameters cannot be null");
+  }
  waterCalculatorDao.insertBulkDemandCall(tenantId, billingPeriod, status, auditDetails);
}
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.

Suggested change
public void insertBulkDemandCall(String tenantId, String billingPeriod, String status,AuditDetails auditDetails) {
waterCalculatorDao.insertBulkDemandCall(tenantId, billingPeriod, status,auditDetails);
}
public void insertBulkDemandCall(String tenantId, String billingPeriod, String status, AuditDetails auditDetails) {
if (tenantId == null || billingPeriod == null || status == null || auditDetails == null) {
throw new IllegalArgumentException("Parameters cannot be null");
}
waterCalculatorDao.insertBulkDemandCall(tenantId, billingPeriod, status, auditDetails);
}

Comment on lines +1238 to +1240
public boolean isDuplicateBulkDemandCall(String tenantId, String billingPeriod, Timestamp fromTime) {
return waterCalculatorDao.isDuplicateBulkDemandCall(tenantId, billingPeriod, fromTime);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add null checks for parameters.

To ensure robustness, consider adding null checks for the parameters tenantId, billingPeriod, and fromTime.

Apply this diff to add null checks:

public boolean isDuplicateBulkDemandCall(String tenantId, String billingPeriod, Timestamp fromTime) {
+  if (tenantId == null || billingPeriod == null || fromTime == null) {
+    throw new IllegalArgumentException("Parameters cannot be null");
+  }
  return waterCalculatorDao.isDuplicateBulkDemandCall(tenantId, billingPeriod, fromTime);
}
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.

Suggested change
public boolean isDuplicateBulkDemandCall(String tenantId, String billingPeriod, Timestamp fromTime) {
return waterCalculatorDao.isDuplicateBulkDemandCall(tenantId, billingPeriod, fromTime);
}
public boolean isDuplicateBulkDemandCall(String tenantId, String billingPeriod, Timestamp fromTime) {
if (tenantId == null || billingPeriod == null || fromTime == null) {
throw new IllegalArgumentException("Parameters cannot be null");
}
return waterCalculatorDao.isDuplicateBulkDemandCall(tenantId, billingPeriod, fromTime);
}

@pradeepkumarcm-egov pradeepkumarcm-egov merged commit 2d1064a into master Aug 26, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants