Skip to content

Bulk-load contracts for a set of agencies

This operation avoids per-agency lazy contract retrieval by loading all contract rows once and then distributing them to the matching agencies already present in a collection.

Field Value
Operation ID OP-004
Trigger A caller invokes clsAgencyCollection.RetrieveContracts().
Inputs Populated clsAgencyCollection
Outputs Agency Contracts collections populated in memory
Primary components clsAgencyCollection.RetrieveContracts, clsAgencyContractCollection.GetAgencyContractCollection
Entry point Business\SAIF.Business.Policy.Agency\clsAgencyCollection.vb

Steps

  1. Retrieve the full contract collection by executing SQL-004 against AGENCY_CONTRACT.
  2. Reset each agency's contract child collection to a fresh empty collection before assignment.
  3. Iterate the retrieved contract rows and locate the parent agency by AgencySeqNum.
  4. Add each contract to the matching agency when the parent exists; otherwise discard the row silently (BR-006).
  5. Return with every in-scope agency carrying an in-memory contract collection populated from the shared query (BR-007, BR-010).

Process flow

The following diagram visualizes the contract bulk-load path.

flowchart TD
  Start([RetrieveContracts]) --> Query[Run SQL-004]
  Query --> Reset[Reset each agency contract collection]
  Reset --> Match{Parent agency found?}
  Match -->|Yes| Add[Add contract to agency]
  Match -->|No| Drop[Discard row]
  Add --> End([Child collections populated])
  Drop --> End

Failure and edge-case behavior

  • Contracts whose parent agency is not already in the collection are ignored.
  • The bulk query reads all contracts when no agency filter is supplied.

Sources

  • Business\SAIF.Business.Policy.Agency\clsAgencyCollection.vb
  • Business\SAIF.Business.Policy.Agency\clsAgencyContractCollection.vb