Skip to content

Bulk-load producers for a set of agencies

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

Field Value
Operation ID OP-003
Trigger A caller invokes clsAgencyCollection.RetrieveProducers().
Inputs Populated clsAgencyCollection
Outputs Agency Producers collections populated in memory
Primary components clsAgencyCollection.RetrieveProducers, clsProducerCollection.GetProducerCollection
Entry point Business\SAIF.Business.Policy.Agency\clsAgencyCollection.vb

Steps

  1. Retrieve the full producer collection by executing SQL-009 against AGENT.
  2. Reset each agency's producer child collection to a fresh empty collection before assignment.
  3. Iterate the retrieved producer rows and locate the parent agency by AgencySeqNum (BR-025).
  4. Add each producer 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 producer collection populated from the shared query (BR-007, BR-023).

Process flow

The following diagram visualizes the producer bulk-load path.

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

Failure and edge-case behavior

  • Producers whose parent agency is not already in the collection are ignored.
  • The bulk query still reads all producers when no agency filter is applied.

Sources

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