Skip to content

104: Add Call Activity Details Section for Outbound Calls#65

Open
vanitha1822 wants to merge 10 commits intorelease-3.7.0from
nd/vs/AMM-2083
Open

104: Add Call Activity Details Section for Outbound Calls#65
vanitha1822 wants to merge 10 commits intorelease-3.7.0from
nd/vs/AMM-2083

Conversation

@vanitha1822
Copy link
Member

@vanitha1822 vanitha1822 commented Feb 16, 2026

📋 Description

JIRA ID:

AMM-2083


✅ Type of Change

  • New feature (non-breaking change which adds functionality)

Summary by CodeRabbit

  • Chores

    • Updated project version to 3.7.0
  • New Features

    • Introduced outbound call activity management system enabling creation, retrieval, updating, and status toggling of call activities
    • Added call details tracking with support for call status, remarks, and activity associations

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR introduces outbound call activity management functionality with new entity, repository, service, and controller layers across the codebase. Additionally, Redis configuration is updated to broaden value type handling and add StringRedisTemplate support, with @EnableCaching removed. The project version is incremented to 3.7.0.

Changes

Cohort / File(s) Summary
Version & Configuration
pom.xml, src/main/java/com/iemr/helpline104/config/RedisConfig.java
Version bumped to 3.7.0. RedisConfig modified: RedisTemplate generics changed from <String, M_User> to <String, Object>, ObjectMapper configured with JavaTimeModule and WRITE_DATES_AS_TIMESTAMPS disabled, new StringRedisTemplate bean added, @EnableCaching annotation removed.
Entity & Data Layer
src/main/java/com/iemr/helpline104/data/comoOutbound/OutboundCallActivity.java, src/main/java/com/iemr/helpline104/data/comoOutbound/T_104CoMoOutboundCallDetails.java, src/main/java/com/iemr/helpline104/repository/comoOutbound/OutboundCallActivityRepository.java, src/main/java/com/iemr/helpline104/repository/comoOutbound/CoMoOutboundCallRepository.java
New OutboundCallActivity JPA entity introduced with auditing fields and identity mapping. T_104CoMoOutboundCallDetails expanded with new fields (activityID, callStatus, callRemarks, beneficiaryPhoneNumber) and many-to-one relationship to OutboundCallActivity. New OutboundCallActivityRepository created with JPQL queries for activity retrieval and updates. CoMoOutboundCallRepository extended with methods for activity management and call detail querying.
Service Layer
src/main/java/com/iemr/helpline104/service/outbound/OutboundCallActivityService.java, src/main/java/com/iemr/helpline104/service/outbound/OutboundCallActivityServiceImpl.java
New service interface and implementation for outbound call activity management, including retrieval (by provider or all), creation, name/status updates, call status validation against predefined list, and call detail persistence with activity name mapping via batch loading.
Controller
src/main/java/com/iemr/helpline104/controller/outbound/OutboundCallActivityController.java
New REST controller at /outbound endpoint with 7 public methods: retrieve activities (filtered or all), save/update activities, toggle status, save call details, and retrieve active call details for authenticated user via token extraction from cookies/headers.

Sequence Diagram

sequenceDiagram
    participant Client as Client
    participant Controller as OutboundCallActivityController
    participant Service as OutboundCallActivityServiceImpl
    participant ActivityRepo as OutboundCallActivityRepository
    participant DetailRepo as CoMoOutboundCallRepository
    participant Database as Database

    Client->>Controller: POST /outbound/saveActivity (activity data)
    Controller->>Service: saveActivity(OutboundCallActivity)
    Service->>ActivityRepo: save(activity)
    ActivityRepo->>Database: INSERT INTO OutboundCallActivity
    Database-->>ActivityRepo: Activity ID
    ActivityRepo-->>Service: OutboundCallActivity
    Service-->>Controller: OutboundCallActivity
    Controller-->>Client: OutputResponse (success)

    Client->>Controller: POST /outbound/saveCallDetails (call details)
    Controller->>Service: saveCallDetails(T_104CoMoOutboundCallDetails)
    Service->>Service: validateCallStatus(callStatus)
    Service->>ActivityRepo: findAllActiveActivitiesAsList()
    ActivityRepo->>Database: SELECT * FROM OutboundCallActivity
    Database-->>ActivityRepo: List<OutboundCallActivity>
    ActivityRepo-->>Service: Activities (for mapping)
    Service->>DetailRepo: save(callDetails)
    DetailRepo->>Database: INSERT INTO T_104CoMoOutboundCallDetails
    Database-->>DetailRepo: Persisted
    DetailRepo-->>Service: T_104CoMoOutboundCallDetails
    Service-->>Controller: T_104CoMoOutboundCallDetails
    Controller-->>Client: OutputResponse (success)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Poem

🐰 Hops through code with glee,
New outbound calls flow free,
Activities bloom and dance,
Redis templates advance,
Version bumped, features spree! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.24% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main feature: adding a call activity details section for outbound calls, which aligns with the substantial changes across entities, repositories, services, and controllers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nd/vs/AMM-2083

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@vanitha1822 vanitha1822 self-assigned this Feb 20, 2026
@vanitha1822 vanitha1822 requested a review from vishwab1 February 27, 2026 06:13
@vishwab1
Copy link
Member

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@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: 8

🧹 Nitpick comments (2)
src/main/java/com/iemr/helpline104/controller/outbound/OutboundCallActivityController.java (1)

83-89: Method naming/comment and behavior are out of sync.

Line 83 and method name getAllActiveActivities imply active-only results, but Line 88 calls getAllActivities() (active + inactive). Rename/update comment to avoid API confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/iemr/helpline104/controller/outbound/OutboundCallActivityController.java`
around lines 83 - 89, The method getAllActiveActivities (and its comment "Get
ALL active activities") is misleading because it calls
activityService.getAllActivities() which returns all activities; either change
the service call to the active-only variant (e.g.,
activityService.getActiveActivities()) or rename the controller method and
comment to reflect that it returns all activities (e.g., getAllActivities / "Get
ALL activities"); update the method name, Javadoc/comment and any references to
the controller endpoint to keep them consistent with the chosen behavior.
src/main/java/com/iemr/helpline104/repository/comoOutbound/CoMoOutboundCallRepository.java (1)

50-83: Activity persistence concerns are duplicated across repositories.

Lines 50-83 replicate activity methods already present in OutboundCallActivityRepository. Keeping activity operations in one repository will reduce divergence and maintenance risk.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/iemr/helpline104/repository/comoOutbound/CoMoOutboundCallRepository.java`
around lines 50 - 83, The CoMoOutboundCallRepository duplicates activity
operations defined in OutboundCallActivityRepository; remove the duplicated
methods (findActiveActivitiesByProvider, findAllActiveActivitiesAsList,
findAllActiveActivities, updateActivityName, toggleActivityStatus) from
CoMoOutboundCallRepository and instead delegate activity persistence to
OutboundCallActivityRepository (inject/use OutboundCallActivityRepository where
those operations are needed in service/manager code), or call its equivalent
methods for queries and `@Modifying` updates; ensure any callers are updated to
reference OutboundCallActivityRepository methods and retain
transactional/modifying semantics at the service layer if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/com/iemr/helpline104/config/RedisConfig.java`:
- Around line 47-56: The RedisTemplate is declared as RedisTemplate<String,
Object> but uses Jackson2JsonRedisSerializer<M_User>, causing runtime type
mismatches; either change the template signature to RedisTemplate<String,
M_User> (and keep the Jackson2JsonRedisSerializer<M_User>) or replace the
hardcoded Jackson2JsonRedisSerializer<M_User> with a polymorphic Object
serializer (e.g., a Jackson2JsonRedisSerializer<Object> with defaultTyping or a
GenericJackson2JsonRedisSerializer configured on the ObjectMapper) so
deserialization works for multiple types; also explicitly set a
StringRedisSerializer for keys via template.setKeySerializer(...) to avoid
binary-prefixed keys.
- Around line 61-65: Fix the indentation of the StringRedisTemplate bean method:
reformat the lines inside the stringRedisTemplate(RedisConnectionFactory
factory) bean to use tabs to match the file's existing indentation style (method
name: stringRedisTemplate, return type: StringRedisTemplate). Also, if the
application relies on Spring declarative caching, uncomment the
`@EnableCaching`(proxyTargetClass = true) annotation in the main application class
(App.java) to enable `@Cacheable/`@CacheEvict behavior; otherwise leave it
commented since the StringRedisTemplate bean works for direct Redis operations.

In
`@src/main/java/com/iemr/helpline104/controller/outbound/OutboundCallActivityController.java`:
- Around line 98-103: The controller is currently deserializing full
OutboundCallActivity/related entities from client JSON (saveActivity,
saveCallDetails) and trusting client-supplied audit/persistence fields
(activityID, modifiedBy, createdBy, timestamps), which allows ID spoofing and
audit tampering; change the handlers to (1) parse only a DTO or Map and manually
map/whitelist writable fields into a new OutboundCallActivity instance, (2)
ignore any client-provided ID or audit fields (activityID, createdBy,
modifiedBy, createdAt, updatedAt), (3) derive the actor/user from the
authenticated token/context instead of request values and set
modifiedBy/createdBy server-side before calling activityService.saveActivity
(and equivalent service methods), and (4) ensure update paths load the existing
entity by ID from the DB and apply only allowed setters rather than replacing
the entity from the request.
- Around line 162-171: In getActiveCallDetails in
OutboundCallActivityController, the token extraction only checks cookie
"Jwttoken" and header "JwtToken" and misses standard "Authorization: Bearer ..."
requests; update the extraction logic (around cookieUtil.getCookieValue and
httpRequest.getHeader calls) to first read the "Authorization" header, strip the
"Bearer " prefix if present to obtain the JWT, then fallback to "JwtToken"
header and the "Jwttoken" cookie; throw the same IllegalArgumentException only
if none are present so the existing header contract headers="Authorization" is
honored.

In
`@src/main/java/com/iemr/helpline104/data/comoOutbound/OutboundCallActivity.java`:
- Around line 35-36: Replace the class-level `@Data` on OutboundCallActivity with
explicit Lombok annotations to avoid including the transient helper field in
equality: remove `@Data` and add `@Getter`, `@Setter`, and
`@EqualsAndHashCode`(onlyExplicitlyIncluded = true) on the class, then annotate
the primary identifier field (the `@Id` field) with `@EqualsAndHashCode.Include` so
equals() and hashCode() are based only on the entity identity; ensure the
transient field outputMapper remains unannotated for inclusion in equality.

In
`@src/main/java/com/iemr/helpline104/data/comoOutbound/T_104CoMoOutboundCallDetails.java`:
- Around line 58-60: In T_104CoMoOutboundCallDetails, remove the Java
'transient' modifier from the field named 'activity' annotated with
`@ManyToOne`(fetch = FetchType.LAZY) and `@JoinColumn`(...) so JPA can manage and
hydrate the lazy relation to OutboundCallActivity; locate the declaration
"private transient OutboundCallActivity activity" and change it to a regular
private field (e.g., "private OutboundCallActivity activity") so the ORM will
persist and load the association correctly.

In
`@src/main/java/com/iemr/helpline104/service/outbound/OutboundCallActivityServiceImpl.java`:
- Around line 48-52: The validation currently checks the raw callStatus string
against VALID_CALL_STATUSES, causing values with extra whitespace/case
differences (e.g., "Answered ") to be rejected and rebuilding Arrays.asList each
call; update the logic to normalize the incoming callStatus (trim() and, if
desired, normalize case) before validating and replace the per-call
Arrays.asList check with a precomputed immutable Set constant (e.g.,
VALID_CALL_STATUSES_SET) so lookups are O(1); adjust the validation in the
method that references callStatus to use the trimmed/normalized value and the
new Set.
- Around line 98-100: The method saveCallDetails currently dereferences
callDetails (callDetails.getCallStatus(), callDetails.getDeleted()) without a
null check; add an early guard at the start of saveCallDetails that checks if
callDetails is null and throws a clear client-facing exception (e.g.,
IllegalArgumentException or your API's BadRequest/InvalidInput exception) with a
descriptive message, then proceed to call validateCallStatus(...) and the
existing logic; reference the saveCallDetails method and the calls to
callDetails.getCallStatus and callDetails.getDeleted when adding the guard.

---

Nitpick comments:
In
`@src/main/java/com/iemr/helpline104/controller/outbound/OutboundCallActivityController.java`:
- Around line 83-89: The method getAllActiveActivities (and its comment "Get ALL
active activities") is misleading because it calls
activityService.getAllActivities() which returns all activities; either change
the service call to the active-only variant (e.g.,
activityService.getActiveActivities()) or rename the controller method and
comment to reflect that it returns all activities (e.g., getAllActivities / "Get
ALL activities"); update the method name, Javadoc/comment and any references to
the controller endpoint to keep them consistent with the chosen behavior.

In
`@src/main/java/com/iemr/helpline104/repository/comoOutbound/CoMoOutboundCallRepository.java`:
- Around line 50-83: The CoMoOutboundCallRepository duplicates activity
operations defined in OutboundCallActivityRepository; remove the duplicated
methods (findActiveActivitiesByProvider, findAllActiveActivitiesAsList,
findAllActiveActivities, updateActivityName, toggleActivityStatus) from
CoMoOutboundCallRepository and instead delegate activity persistence to
OutboundCallActivityRepository (inject/use OutboundCallActivityRepository where
those operations are needed in service/manager code), or call its equivalent
methods for queries and `@Modifying` updates; ensure any callers are updated to
reference OutboundCallActivityRepository methods and retain
transactional/modifying semantics at the service layer if needed.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df313f0 and a7d97a1.

📒 Files selected for processing (9)
  • pom.xml
  • src/main/java/com/iemr/helpline104/config/RedisConfig.java
  • src/main/java/com/iemr/helpline104/controller/outbound/OutboundCallActivityController.java
  • src/main/java/com/iemr/helpline104/data/comoOutbound/OutboundCallActivity.java
  • src/main/java/com/iemr/helpline104/data/comoOutbound/T_104CoMoOutboundCallDetails.java
  • src/main/java/com/iemr/helpline104/repository/comoOutbound/CoMoOutboundCallRepository.java
  • src/main/java/com/iemr/helpline104/repository/comoOutbound/OutboundCallActivityRepository.java
  • src/main/java/com/iemr/helpline104/service/outbound/OutboundCallActivityService.java
  • src/main/java/com/iemr/helpline104/service/outbound/OutboundCallActivityServiceImpl.java

@sonarqubecloud
Copy link

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