Support order connection management¶
Support order connection management owns the CL_CLAIM_SUPPORT_ORDER_CONN link rows that tie individual claims to a support order. clsClaimSupportOrderConnectionCollection retrieves the connections for a support order and tracks in-memory additions and removals; clsClaimSupportOrderConnection performs the underlying insert/delete for a single link row. The header's Connections property (documented in Support order retrieval and maintenance) lazily hydrates this collection but does not cascade its save automatically.
| Field | Value |
|---|---|
| Operation ID | OP-SO-02 |
| Trigger | Caller calls clsClaimSupportOrderConnectionCollection.GetClaimSupportOrderConnectionCollection(dpi, supportOrderID) (or NewClaimSupportOrderConnectionCollection), calls CreateConnection/DeleteConnection to attach or detach claims, and calls Save() |
| Inputs | SupportOrderID; ClaimID values to attach or detach; acting user from the data-portal info (used only when creating a connection) |
| Outputs | Persisted or removed CL_CLAIM_SUPPORT_ORDER_CONN rows; populated clsClaimSupportOrderConnectionCollection; InsertError / DeleteError messages on a rows-affected mismatch |
| Primary components | clsClaimSupportOrderConnection (Create, BeforeInsert/AfterInsert, BeforeDelete/AfterDelete, NewClaimSupportOrderConnection), clsClaimSupportOrderConnectionCollection (GetClaimSupportOrderConnectionCollection, NewClaimSupportOrderConnectionCollection, BeforeRetrieve/AfterRetrieve, CreateConnection, DeleteConnection, Save, Item, Contains, ContainsDeleted) |
| Entry point | Business\SAIF.Business.Claim.SupportOrder\clsClaimSupportOrderConnection.vb |
Steps¶
- Retrieve connections for a support order.
GetClaimSupportOrderConnectionCollection(dataPortal, supportOrderID)builds aCriteria(dataPortal, supportOrderID)and callsDataAccessLayer.RetrieveObject. - Issue the read.
BeforeRetrievebindsSupportOrderIDand issues the connection select (SQL-005, CL_CLAIM_SUPPORT_ORDER_CONN). - Load each row.
AfterRetrievereads the cursor; for each row it constructs aclsClaimSupportOrderConnection, callsLoad()— which fillsClaimID,SupportOrderID,UpdateDate, andUpdateUser, rebuildsCriteria(dataPortalInfo, ClaimID, SupportOrderID), and marks the object old — and adds it to the collection. - Create a new connection in memory.
CreateConnection(inClaimID)callsclsClaimSupportOrderConnection.NewClaimSupportOrderConnection(dataPortalInfo, inClaimID, MyCriteria.SupportOrderID). Create()on the new connection seedsClaimIDandSupportOrderIDfrom the criteria and setsUpdateUserfromMyCriteria.DataPortalInfo.UserID— unlikeclsClaimSupportOrder, this class does populate the acting user automatically at creation time (see Support order retrieval and maintenance).- The new connection is added to the collection's in-memory list.
- Remove a connection from the collection in memory.
DeleteConnection(inClaimID)walks the list comparing each item'sSupportOrderID(notClaimID) to the suppliedinClaimIDargument and removes the first match. - The parameter is named
inClaimIDbut is actually compared against each connection'sSupportOrderIDproperty, so this method removes an item by matchingSupportOrderID, not by the claim it names — a caller intending to detach a specific claim from a support order that has more than one connection could remove the wrong row or none at all.** - The item is removed with the base list's
Remove()rather than the collection's tracked-delete mechanism, so it is unclear whether the removed connection is retained on a deleted-items list for the subsequentSave()to delete from the database, or simply dropped from memory without ever being deleted fromCL_CLAIM_SUPPORT_ORDER_CONN.** - Save the collection.
Save()callsApplyEdit()and then the inherited collectionSave(), which persists new and deleted connection items tracked by the base collection. - Insert a new connection.
BeforeInsertbindsClaimID,UpdateUser, andSupportOrderIDand issues the insert (SQL-002, CL_CLAIM_SUPPORT_ORDER_CONN). AfterInsert: rows affected other than1adds anInsertErrorwith the DB contention message; otherwise the error is removed (BR-004).- Delete a connection.
BeforeDeletebindsClaimIDandSupportOrderIDand issues the delete (SQL-008, CL_CLAIM_SUPPORT_ORDER_CONN). - The delete statement's
WHEREclause references onlyCLAIM_ID; the boundSupportOrderIDparameter has no matching predicate and does not narrow which row is removed.* AfterDelete: rows affected other than1adds aDeleteErrorwith the DB contention message; otherwise the error is removed (BR-003).- Query the in-memory collection.
Item(index),Item(supportOrderID),Contains(...), andContainsDeleted(...)operate only on the in-memory list and deleted-list; they perform no database access. - Lazily hydrate from the header.
clsClaimSupportOrder.ConnectionscallsGetClaimSupportOrderConnectionCollectionthe first time it is accessed for a given header object and caches the result for the life of that object, tying this operation to the header's lifecycle without cascading itsSave()automatically.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([GetClaimSupportOrderConnectionCollection<br>or header.Connections]) --> Retrieve[BeforeRetrieve reads<br>connections for SupportOrderID]
Retrieve --> Load[AfterRetrieve loads each row]
Load --> Edit{Caller action?}
Edit -->|CreateConnection| Create[Create new connection;<br>UpdateUser set from portal info]
Edit -->|DeleteConnection| Remove[Remove from in-memory list<br>by matching SupportOrderID]
Create --> Save[Collection Save cascades<br>new / deleted items]
Remove --> Save
Save --> Which{New or deleted item?}
Which -->|New| Ins[BeforeInsert / AfterInsert]
Which -->|Deleted| Del[BeforeDelete / AfterDelete]
Ins --> Rows{RowsAffected = 1?}
Del --> Rows2{RowsAffected = 1?}
Rows -->|No| InsErr([InsertError added])
Rows -->|Yes| InsOk([Error cleared; item marked old])
Rows2 -->|No| DelErr([DeleteError added])
Rows2 -->|Yes| DelOk([Error cleared; item removed])
Failure and edge-case behavior¶
DeleteConnection(inClaimID)compares its argument against each item'sSupportOrderIDrather thanClaimID, so removal by claim identifier does not behave as its name and parameter suggest.**- The connection delete statement filters only on
CLAIM_ID, so theSupportOrderIDparameter bound inBeforeDeleteis inert; if the same claim were ever connected to more than one support order, the delete could remove the wrong link (no evidence in this library that a claim can have more than one active connection, so the practical exposure is unconfirmed).* AfterInsert/AfterDeleteonclsClaimSupportOrderConnectionclear the corresponding error message on success, matching BR-003 and BR-004; no equivalent clearing is confirmed to occur for whatever in-memory delete-trackingDeleteConnectionrelies on.**- The connection collection is not saved automatically when the parent header (
clsClaimSupportOrder) is saved; a caller must callSave()onConnectionsseparately, or connection changes will be lost.
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.
Related documentation¶
Sources¶
Business\SAIF.Business.Claim.SupportOrder\clsClaimSupportOrderConnection.vbBusiness\SAIF.Business.Claim.SupportOrder\clsClaimSupportOrderConnectionCollection.vb