Claim unit maintenance¶
A claim unit links a claim to a policy unit for Unit Stat reporting purposes, carrying the loss/exposure detail and reporting flags for that claim within the unit. This operation covers clsClaimUnit's create/retrieve/update/delete lifecycle and clsClaimUnitCollection's retrieval of all claim units for a policy unit.
| Field | Value |
|---|---|
| Operation ID | OP-US-02 |
| Trigger | clsClaimUnit.NewClaimUnit / GetClaimUnit, followed by property edits and Save(), or clsClaimUnitCollection.GetClaimUnits |
| Inputs | Policy unit sequence number, claim ID, loss/exposure amounts, value code, reporting flags |
| Outputs | Persisted US_CLAIM_UNIT row; populated clsClaimUnit or clsClaimUnitCollection |
| Primary components | clsClaimUnit.Create, clsClaimUnit.BeforeInsert/AfterInsert, clsClaimUnit.BeforeUpdate/AfterUpdate, clsClaimUnit.BeforeDelete/AfterDelete, clsClaimUnit.BeforeRetrieve/AfterRetrieve, clsClaimUnitCollection.BeforeRetrieve/AfterRetrieve |
| Entry point | Business\SAIF.Business.UnitStat\clsClaimUnit.vb, Business\SAIF.Business.UnitStat\clsClaimUnitCollection.vb |
Steps¶
- Create.
NewClaimUnit(dataPortal, claimID, policyUnitSeqNum)invokesCreate(), which seedsClaimIDfrom the criteria but, rather than using the criteria'sPolicyUnitSeqNum(already supplied by the caller), allocates a brand-new value from theUS_POLICY_UNIT_SEQsequence intom_PolicyUnitSeqNum* — this appears to be an unintended divergence from the pattern used elsewhere in the library (see Failure and edge-case behavior below). - New-object defaults.
ValueCode,ReportedFatalFlag,ReportedClosedFlag, andPreferredWorkerFlagare all seeded to'N'by member-variable initializers, so every new claim unit starts in these states unless explicitly overridden before save:ValueCode→'N'(BR-US-028),ReportedFatalFlagandReportedClosedFlag→'N'(BR-US-029),PreferredWorkerFlag→'N'(BR-US-030). - Insert.
BeforeInsertstampsUpdateUser/UpdateDate, resetsUpdateNumberto 0, and binds every column for the parameterized insert (SQL-003, US_CLAIM_UNIT).AfterInsertchecks rows affected: - If
RowsAffected <> 1: addsInsertErrorwith the literal "Insert Failed" message. - Otherwise:
MarkOld(). - Retrieve single claim unit.
Criteria.RetrieveSQLdispatches onRetrieveType, exposed through two public factory overloads: GetClaimUnit(dataPortal, claimID)— retrieves the active claim unit by claim ID alone, filteringACTIVE_UNIT_FLAG = 'Y'(SQL-012).GetClaimUnit(dataPortal, claimID, policyUnitSeqNum)— retrieves by the composite claim ID and policy unit sequence number, regardless of active status (SQL-013).AfterRetrievefills the object when a row is found and always callsMarkOld().- Retrieve claim-unit collection.
clsClaimUnitCollection.GetClaimUnits(policyUnitSeqNum)selects everyUS_CLAIM_UNITrow for the policy unit (SQL-016), including inactive/previously-removed claim units — per an explicit source comment, this collection intentionally returns all rows rather than filtering to an active subset. - Update.
BeforeUpdateincrementsUpdateNumber, restampsUpdateUser/UpdateDate, and rebinds every column (SQL-028, US_CLAIM_UNIT).AfterUpdatechecks rows affected: - If
RowsAffected <> 1: addsUpdateErrorwithclsConstants.Messages.DBContentionError(BR-US-020). - Otherwise:
MarkOld(). - Delete.
BeforeDeletebindsClaimIDandPolicyUnitSeqNumto the delete-by-composite-key statement (SQL-034).AfterDeletechecks rows affected: - If
RowsAffected <> 1: addsDeleteErrorwithclsConstants.Messages.DBContentionError(BR-US-020). - Otherwise:
MarkNew(). - Parent linkage. A claim unit is always retrieved and persisted as a child of a policy unit's
ClaimUnitscollection (see Policy unit CRUD); it is not saved as a standalone root object in normal use.
Process flow¶
flowchart TD
Start([Caller creates or retrieves<br>a claim unit]) --> Which{Create, retrieve one,<br>retrieve collection,<br>update, or delete?}
Which -->|Create| SeqBug[Allocate new PolicyUnitSeqNum<br>from sequence, ignoring criteria value]
SeqBug --> Defaults[Apply flag defaults:<br>ValueCode=N, ReportedFatalFlag=N,<br>ReportedClosedFlag=N, PreferredWorkerFlag=N]
Defaults --> Insert[Insert US_CLAIM_UNIT row]
Insert --> InsRows{RowsAffected = 1?}
InsRows -->|No| InsErr([InsertError: Insert Failed])
InsRows -->|Yes| MarkOldA([MarkOld])
Which -->|Retrieve one| RetOne[Select by PolicyUnitSeqNum<br>and ClaimID]
RetOne --> FillOne[Fill object if found;<br>MarkOld regardless]
Which -->|Retrieve collection| RetAll[Select all rows<br>for PolicyUnitSeqNum<br>includes inactive units]
Which -->|Update| Upd[Rebind all columns;<br>restamp UpdateUser/UpdateDate]
Upd --> UpdRows{RowsAffected = 1?}
UpdRows -->|No| Contention([UpdateError: DB contention])
UpdRows -->|Yes| MarkOldB([MarkOld])
Which -->|Delete| Del[Delete by PolicyUnitSeqNum<br>and ClaimID]
Del --> DelRows{RowsAffected = 1?}
DelRows -->|No| ContentionDel([DeleteError: DB contention])
DelRows -->|Yes| MarkNewA([MarkNew])
Failure and edge-case behavior¶
Create()allocates a brand-newUS_POLICY_UNIT_SEQvalue into the claim unit'sPolicyUnitSeqNuminstead of using the value supplied viaNewClaimUnit(...)'s criteria; this looks like an unintended bug rather than deliberate behavior, since it would associate the new claim unit with the wrong policy unit if the allocated sequence differs from the intended parent.*clsClaimUnitCollection.GetClaimUnitsreturns all claim units for a policy unit, including inactive ones, by explicit design (per source comment) — callers must filter by activity status themselves if only active claim units are wanted.- Insert failures use the literal "Insert Failed" message, distinct from the shared
DBContentionErrormessage used for update/delete failures.
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
Business\SAIF.Business.UnitStat\clsClaimUnit.vbBusiness\SAIF.Business.UnitStat\clsClaimUnitCollection.vb