Claim-person name management¶
Claim-person name management loads the full name-history collection for a claim person, lets the caller add a new name row or edit an existing one, generates a phonetic name code for search indexing before every insert, and validates required fields and flag consistency before persisting inserts, updates, and deletes. The collection also enforces that exactly one name row is marked primary.
| Field | Value |
|---|---|
| Operation ID | OP-PER-02 |
| Trigger | Caller retrieves name history for a person, edits one or more name rows, and calls Save() on the collection |
| Inputs | PersonID; row fields FirstName, LastName, MiddleName, NameExtensionCode, PrimaryFlag, VoidFlag; acting user from DataPortalInfo.UserID |
| Outputs | In-memory clsClaimPersonNameCollection; persisted inserts, updates, or deletes in CL_CLAIM_PERSON_NAME_HISTORY; broken rules and DB-contention messages |
| Primary components | clsClaimPersonNameCollection.GetClaimPersonNameCol, clsClaimPersonNameCollection.NewClaimPersonName, clsClaimPersonName.BeforeInsert, clsClaimPersonName.BeforeUpdate, clsClaimPersonName.BeforeDelete, clsClaimPersonName.GetPhoneticNameCode |
| Entry point | Business\SAIF.Business.Claim.Person\clsClaimPersonNameCollection.vb |
Steps¶
- Retrieve the person's full name history.
GetClaimPersonNameColissues the collection read query for the givenPersonID, loads each row intoclsClaimPersonName, and tracks the highestPrimaryKeySubNumseen so far (SQL-009, CL_CLAIM_PERSON_NAME_HISTORY). - Create a new name row when requested.
NewClaimPersonNameincrements the cached maximum sub-number, creates a child row throughclsClaimPersonName.NewClaimPersonNamefor the currentPersonID, and adds it to the managed collection.Create()seeds blank name fields, a blank phonetic name code,PrimaryFlag = "N", andVoidFlag = "N"as defaults. - Validate required fields and flag values on each dirty row. The row rules require a non-blank last name, require
PrimaryFlagto beYorN, requireVoidFlagto beYorN, and reject a row that is both primary and void (BR-PER-028, BR-PER-029, BR-PER-030, BR-PER-031). - Validate the collection-wide primary selection. When the collection is dirty and non-empty, the collection-level rule counts primary rows and rejects the change unless exactly one row is marked primary (BR-PER-032).
- Generate the phonetic name code before insert.
PhoneticNameCode's getter calls the sharedGetPhoneticNameCodehelper, which issues a scalar Oracle call to the phonetic-name package using the row's last, first, and middle names, and returns the derived code for persistence (BR-PER-002, SQL-008, DUAL). - Insert a new name-history row.
BeforeInsertbuilds the insert request with first, last, and middle names, upper-case variants, name-extension code, primary and void flags, the phonetic name code, and the acting user, binding all key values (SQL-002, CL_CLAIM_PERSON_NAME_HISTORY). - On failure: if the insert affects zero rows,
AfterInsertadds the standard DB-contention error message; otherwise it marks the row old. - Update an existing name-history row.
BeforeUpdateupdates onlyPrimaryFlag,VoidFlag, and update metadata for the row identified byPersonIDandPrimaryKeySubNum(SQL-017, CL_CLAIM_PERSON_NAME_HISTORY). - On failure: if the update affects zero rows,
AfterUpdateadds the DB-contention error message. - Delete a name-history row.
BeforeDeletedeletes the row identified byPersonIDandPrimaryKeySubNum(SQL-021, CL_CLAIM_PERSON_NAME_HISTORY). - On failure: if the delete does not affect exactly one row, the standard DB-contention error message is added.
- Save the managed collection.
clsClaimPersonNameCollection.SavecallsApplyEdit()before delegating toMyBase.Save(), so pending in-progress edits on the active row are committed before the collection-level save runs.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Load name history for one person]) --> Read[Retrieve name-history rows]
Read --> Change{Add or edit a row?}
Change -->|Add| NewRow[Assign next sub-number<br>and initialize defaults]
Change -->|Edit| Validate[Validate row and collection]
NewRow --> Validate
Validate --> Valid{Validation passes?}
Valid -->|No| Fail([Broken rules returned])
Valid -->|Yes| Phonetic[Generate phonetic name code]
Phonetic --> Save[Insert, update, or delete row]
Save --> Rows{Expected rows affected?}
Rows -->|No| Contention([Add DB-contention message])
Rows -->|Yes| Done([Save completes])
Failure and edge-case behavior¶
PhoneticNameCode's getter has a side effect: every read issues a live Oracle call rather than returning a cached value, so repeated reads repeat the database round trip.- A row that is both primary and void is rejected by validation, so a caller cannot silently void the primary name.
- The class defines
UpdateClaimPersonSQL(an update againstCL_CLAIM_PERSON.PRIMARY_LAST_NAME/PRIMARY_FIRST_NAME/PRIMARY_MIDDLE_NAME/PRIMARY_NAME_EXTENSION_CODE, SQL-016), but no caller in this source set invokes it during name-history save — the primary name fields onCL_CLAIM_PERSONare not kept in sync by this class.* IsValidon the individual name row short-circuits toTruewhen the row is not dirty, so unmodified rows are never re-validated.
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.
Sources¶
Business\SAIF.Business.Claim.Person\clsClaimPersonName.vbBusiness\SAIF.Business.Claim.Person\clsClaimPersonNameCollection.vb