-
Notifications
You must be signed in to change notification settings - Fork 91
Update WorkflowService.java #660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe pull request introduces modifications to three Java files in the inbox service: Changes
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/InboxQueryBuilder.java (1)
73-73: Good improvement in logging practice!Replacing
System.out.printlnwithlog.infois a better approach for production environments. Consider adding log level checks and query length truncation for very large queries:- log.info("Final ES Query after adding must clause: " + baseEsQuery.toString()); + if (log.isDebugEnabled()) { + String query = baseEsQuery.toString(); + log.debug("Final ES Query after adding must clause: {}", + query.length() > 1000 ? query.substring(0, 1000) + "..." : query); + }accelerators/inbox/src/main/java/org/egov/inbox/service/V2/InboxServiceV2.java (1)
135-135: Review removal of status check.The removal of the empty status check could lead to unnecessary query execution. Consider keeping a guard clause for performance optimization.
+ if (CollectionUtils.isEmpty(inboxRequest.getInbox().getProcessSearchCriteria().getStatus())) { + log.debug("Status criteria is empty, optimizing query execution"); + return Collections.emptyList(); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/InboxQueryBuilder.java(2 hunks)accelerators/inbox/src/main/java/org/egov/inbox/service/V2/InboxServiceV2.java(2 hunks)accelerators/inbox/src/main/java/org/egov/inbox/service/WorkflowService.java(3 hunks)
🔇 Additional comments (4)
accelerators/inbox/src/main/java/org/egov/inbox/service/WorkflowService.java (3)
33-36: LGTM! Good addition of logging capabilities.Adding @slf4j annotation aligns with the project's move towards proper logging practices.
197-197: Verify the impact of tenant ID splitting.The change to split tenant ID and use only the first part (
split("\\.")[0]) could affect functionality if tenant IDs have meaningful subparts. Please ensure this aligns with the tenant hierarchy design.✅ Verification successful
Tenant ID splitting is a verified pattern in the codebase
The split operation to extract the state-level tenant (e.g., "state" from "state.city") is consistently used across multiple core services including user management, billing, and workflow processing. This change aligns with the established tenant hierarchy design.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for tenant ID usage patterns in the codebase echo "Searching for tenant ID patterns..." rg -A 3 'getTenantId\(\)' --type java # Search for split operations on tenant IDs echo "Searching for tenant ID split operations..." rg -A 3 'split\\(\"\\.\"\\).*tenantId' --type javaLength of output: 68123
378-383:⚠️ Potential issueReview tenant ID to roles mapping logic.
The modification to use only the first part of tenant ID (
split("\\.")[0]) for role mapping could impact role-based access control. This change should be thoroughly tested with different tenant ID formats.Consider adding validation for tenant ID format and handling potential array index exceptions:
- if (tenantIdToUserRoles.containsKey(role.getTenantId().split("\\.")[0])) { - tenantIdToUserRoles.get(role.getTenantId().split("\\.")[0]).add(role.getCode()); + String tenantId = role.getTenantId(); + String rootTenant = tenantId.contains(".") ? tenantId.split("\\.")[0] : tenantId; + if (tenantIdToUserRoles.containsKey(rootTenant)) { + tenantIdToUserRoles.get(rootTenant).add(role.getCode()); } else { List<String> roleCodes = new LinkedList<>(); roleCodes.add(role.getCode()); - tenantIdToUserRoles.put(role.getTenantId().split("\\.")[0], roleCodes); + tenantIdToUserRoles.put(rootTenant, roleCodes); }accelerators/inbox/src/main/java/org/egov/inbox/service/V2/InboxServiceV2.java (1)
165-166: LGTM! Improved null safety.The additional checks for null and empty status improve the robustness of the code by preventing potential NullPointerException.
Summary by CodeRabbit
Logging Improvements
Service Logic Updates
Code Quality