Skip to content

removed issanjeevani variable - #225

Merged
helenKaryamsetty merged 1 commit into
PSMRI:developfrom
ravishanigarapu:develop
Jun 17, 2025
Merged

removed issanjeevani variable#225
helenKaryamsetty merged 1 commit into
PSMRI:developfrom
ravishanigarapu:develop

Conversation

@ravishanigarapu

@ravishanigarapu ravishanigarapu commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

📋 Description

JIRA ID: AMM-1654

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • New Features
    • Replaced the "isSanjeevani" attribute with a new "teleConsultation" attribute in user role mapping features.
  • Bug Fixes
    • Updated all relevant screens and data handling to display and process the "teleConsultation" attribute instead of "isSanjeevani".
  • Refactor
    • Removed deprecated fields and cleaned up unused code related to the previous "isSanjeevani" attribute.

@coderabbitai

coderabbitai Bot commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes replace the usage of the Boolean field and database column isSanjeevani with a new String field and column teleConsultation across multiple user role-related classes, methods, and queries. Associated method signatures, JSON keys, and repository queries are updated to use the new field, with all relevant references adjusted accordingly.

Changes

File(s) Change Summary
.../controller/users/IEMRAdminController.java In createUserMapping, replaced JSON key and value from isSanjeevani to teleConsultation.
.../data/users/Role.java Replaced field isSanjeevani (Boolean) with teleConsultation (String); removed commented-out code.
.../data/users/UserServiceRoleMapping.java Changed field and DB mapping from isSanjeevani (Boolean) to teleConsultation (String); updated static method signature and implementation accordingly.
.../repository/users/UserRoleMappingRepository.java Updated JPQL query to select teleConsultation instead of isSanjeevani.
.../service/users/IEMRAdminUserServiceImpl.java Updated calls to initializeUserRoleMappingObjs to pass teleConsultation (String) instead of isSanjeevani (Boolean).

Sequence Diagram(s)

sequenceDiagram
    participant Controller as IEMRAdminController
    participant Service as IEMRAdminUserServiceImpl
    participant Mapping as UserServiceRoleMapping
    participant Repo as UserRoleMappingRepository
    participant DB as Database

    Controller->>Service: Request user role mapping
    Service->>Repo: getUserRoleMappingForUser(userID)
    Repo->>DB: Query includes 'teleConsultation' field
    DB-->>Repo: Returns user role mapping with 'teleConsultation'
    Repo-->>Service: Mapping data
    Service->>Mapping: initializeUserRoleMappingObjs(..., teleConsultation, ...)
    Mapping-->>Service: UserServiceRoleMapping object
    Service-->>Controller: User role mapping (with 'teleConsultation')
Loading

Suggested reviewers

  • drtechie

Poem

In fields where carrots and code entwine,
"isSanjeevani" hops away, replaced in line.
Now "teleConsultation" takes the lead,
Stringing along wherever there's need.
The bunnies cheer, the mappings clear—
Change is nigh, and bugs disappear!
🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (3)
src/main/java/com/iemr/common/service/users/IEMRAdminUserServiceImpl.java (2)

468-478: Guard length check must match new projection size

Array element object[11] is accessed but the guard still checks for >= 11.
Use >= 12 to avoid a potential ArrayIndexOutOfBoundsException.

- if (object != null && object.length >= 11) {
+ if (object != null && object.length >= 12) {

667-675: Same length-check issue in getUserServiceRoleMapping

Replicate the fix here:

- if (object != null && object.length >= 11) {
+ if (object != null && object.length >= 12) {
src/main/java/com/iemr/common/data/users/UserServiceRoleMapping.java (1)

303-321: Parameter explosion – consider a value object

initializeUserRoleMappingObjs now takes 13 positional parameters, which is error-prone (the recent rename already caused index mis-alignment). A builder or dedicated DTO would make future changes safer and self-documenting.

Example sketch:

UserServiceRoleMapping mapping = UserServiceRoleMappingBuilder
        .ids(USRMappingID, UserID)
        .role(roleID, m_Role)
        .provider(providerServiceMapID, m_ProviderServiceMapping)
        .agent(agentID, agentPassword, inbound, outbound, teleConsultation)
        .location(workingLocationID, providerServiceAddressMapping)
        .build();
🧹 Nitpick comments (2)
src/main/java/com/iemr/common/controller/users/IEMRAdminController.java (1)

408-411: Null-safety for new field when building JSON

m_UserServiceRoleMapping.getTeleConsultation() can be null.
If the client relies on a non-null string, add a default (e.g., "") or omit the key when null to avoid "teleConsultation":null leaking into the payload.

- roleObject.put("teleConsultation", m_UserServiceRoleMapping.getTeleConsultation());
+ String tc = m_UserServiceRoleMapping.getTeleConsultation();
+ if (tc != null) {
+     roleObject.put("teleConsultation", tc);
+ }
src/main/java/com/iemr/common/data/users/Role.java (1)

96-104: Transient teleConsultation field seems redundant

teleConsultation is now held in UserServiceRoleMapping and copied into JSON directly from there.
Keeping another copy inside Role (and marking it @Transient) increases object size and can get out-of-sync. Unless there is a clear future use-case, consider dropping it.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e0ae3b and fd9ffc3.

📒 Files selected for processing (5)
  • src/main/java/com/iemr/common/controller/users/IEMRAdminController.java (1 hunks)
  • src/main/java/com/iemr/common/data/users/Role.java (2 hunks)
  • src/main/java/com/iemr/common/data/users/UserServiceRoleMapping.java (3 hunks)
  • src/main/java/com/iemr/common/repository/users/UserRoleMappingRepository.java (1 hunks)
  • src/main/java/com/iemr/common/service/users/IEMRAdminUserServiceImpl.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: style-check / checkstyle
  • GitHub Check: Package-test
  • GitHub Check: Analyze (java)
  • GitHub Check: Build
🔇 Additional comments (1)
src/main/java/com/iemr/common/data/users/UserServiceRoleMapping.java (1)

112-115: Column definition – ensure DB schema matches

The column is declared as varchar (String), whereas the removed isSanjeevani was a boolean.
Confirm the DB migration alters the column type accordingly; otherwise Hibernate may fail on schema validation.

Comment on lines 38 to 40
@Query("select map.USRMappingID, map.UserID, map.RoleID, map.m_Role, map.providerServiceMapID, "
+ "map.agentID, map.inbound, map.outbound, map.isSanjeevani, map.agentPassword, map.workingLocationID, map.providerServiceAddressMapping from "
+ "map.agentID, map.inbound, map.outbound, map.teleConsultation, map.agentPassword, map.workingLocationID, map.providerServiceAddressMapping from "
+ "UserServiceRoleMapping map left join map.m_ProviderServiceMapping psm left join psm.serviceProvider sp "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Index shift introduces downstream risk – update consuming code accordingly

The projection now returns 12 columns (the new map.teleConsultation at position 9).
Down-stream loops in IEMRAdminUserServiceImpl still guard with object.length >= 11 but subsequently dereference object[11], which will throw ArrayIndexOutOfBoundsException if a shorter result is ever returned (e.g., due to LEFT JOIN nulls).

Either:

- if (object != null && object.length >= 11) {
+ if (object != null && object.length >= 12) {

or switch to a DTO/result-class projection to remove this brittle positional coupling.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/main/java/com/iemr/common/repository/users/UserRoleMappingRepository.java
around lines 38 to 40, the query projection now returns 12 columns due to the
addition of map.teleConsultation, but downstream code in
IEMRAdminUserServiceImpl still checks for object length >= 11 and accesses
object[11], risking ArrayIndexOutOfBoundsException. To fix this, update the
downstream code to check for object length >= 12 before accessing object[11], or
refactor the query and consuming code to use a DTO or result-class projection to
avoid brittle positional indexing.

@helenKaryamsetty
helenKaryamsetty merged commit 5df5d95 into PSMRI:develop Jun 17, 2025
7 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.

2 participants