---
title: Aggravation rights date calculation
summary: Returns the start and end dates of a claim's aggravation rights window by invoking the sp82046_CalcAggRightDates stored procedure.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-30
library: SAIF.Business.Claim
reference_type: package
operation_id: OP-BC-06
trigger: A caller requests the aggravation rights window for a claim through GetAggRightDates
---

# Aggravation rights date calculation

Aggravation rights define the period during which a worker may reopen a closed claim for a worsened condition. This operation asks an Oracle procedure to compute the start and end of that window for a claim and returns the two dates as a read-only object. It adds one client-side safeguard: if the procedure reports no error but either date comes back empty, the operation treats the claim as not found.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-BC-06 |
| **Trigger** | `clsAggRightDates.GetAggRightDates(dataPortalInfo, claimID)` |
| **Inputs** | `ClaimID` |
| **Outputs** | `AggRightStartDate`; `AggRightEndDate`; `ErrorMessage`; error message `clsAggRightDates01` with the text "Claim Not Found" |
| **Primary components** | `clsAggRightDates.Criteria`, `clsAggRightDates.BeforeRetrieve`, `clsAggRightDates.AfterRetrieve` |
| **Entry point** | `Business\SAIF.Business.Claim\clsAggRightDates.vb` |

## Steps

1. **Capture the claim.** The shared factory builds a Criteria holding the claim identifier and asks the framework data-access layer to retrieve the object.
2. **Bind the procedure call.** `BeforeRetrieve` switches the request to stored-procedure mode, names the aggravation-rights procedure, tags the request, binds the claim identifier as an input parameter, and adds an output cursor named `recordset` ([SQL-014](../sql/SQL-014-saif-business-claim.md)).
3. **Read the returned row.** `AfterRetrieve` opens the cursor and, when a row is present, reads the aggravation right start date, the aggravation right end date, and the procedure's error message into the object.
   - Any exception raised while reading the row is caught and discarded, leaving the dates and message at their initial values.
4. **Detect a missing claim.** When the procedure returned no error message but either the start date or the end date is still the minimum date value, the operation adds the error message `clsAggRightDates01` with the text "Claim Not Found".
5. **Surface the procedure's own message.** The branch that would have promoted the procedure's error message text into the object's error collection is present in source but disabled, so a procedure-reported error reaches the caller only through the `ErrorMessage` property.
6. **Return the read-only object.** The object is marked read-only at construction and its create, insert, update, and delete SQL properties raise an application exception.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller requests the aggravation<br>rights window for a claim]) --> Bind[Bind the claim id and<br>the output cursor]
	Bind --> Proc[Execute the aggravation<br>rights procedure]
	Proc --> Row{Row returned?}
	Row -->|No| Empty([Dates stay unset])
	Row -->|Yes| Read[Read start date, end date<br>and error message]
	Read --> Msg{Error message empty?}
	Msg -->|No| Pass([Return object carrying<br>the procedure message])
	Msg -->|Yes| Dates{Either date unset?}
	Dates -->|Yes| NotFound([Add Claim Not Found error])
	Dates -->|No| Ok([Return the aggravation<br>rights window])
```

## Failure and edge-case behavior

- A procedure-reported error is not converted into a business rule failure; the caller must read the error message property to see it.
- The "Claim Not Found" safeguard only fires when the procedure was silent, so a claim that legitimately has no aggravation window and no message is reported as missing rather than as having no rights.*
- The exception handler around the cursor read swallows all errors silently, so a schema or type mismatch surfaces as an unset pair of dates rather than a failure.
- When the cursor returns no row at all the object is returned with both dates unset and no error message, which callers must treat the same as a missing claim.*
- The object is read-only, so the calculated window can never be written back through this operation.

## Related documentation

- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources

- `Business\SAIF.Business.Claim\clsAggRightDates.vb`
