Aggregate active offices across agencies¶
This operation walks an agency collection, loads each agency's office rows as needed, and clones the active offices into one detached result collection.
| Field | Value |
|---|---|
| Operation ID | OP-014 |
| Trigger | A caller invokes clsAgencyCollection.ActiveAgencyOffices(inDate). |
| Inputs | clsAgencyCollection, as-of date |
| Outputs | clsAgencyOfficeCollection |
| Primary components | clsAgencyCollection.ActiveAgencyOffices, clsAgency.Offices, clsAgencyOfficeCollection.AddClone |
| Entry point | Business\SAIF.Business.Policy.Agency\clsAgencyCollection.vb, Business\SAIF.Business.Policy.Agency\clsAgencyOfficeCollection.vb |
Steps¶
- Iterate each agency in the source collection.
- Ensure that agency's office collection is loaded, lazily retrieving it with SQL-006 from AGENT when necessary.
- Filter each office collection to rows active on the requested date (BR-008).
- Clone each active office into the aggregated result collection rather than reusing the original object instance (BR-022).
- Return the detached office collection after all agencies have been processed.
Process flow¶
The following diagram visualizes active-office aggregation.
flowchart TD
Start([ActiveAgencyOffices]) --> Loop[Iterate agencies]
Loop --> Load[Ensure offices loaded]
Load --> Filter[Filter active offices]
Filter --> Clone[Clone office into result]
Clone --> More{More agencies?}
More -->|Yes| Loop
More -->|No| End([Detached office collection returned])
Failure and edge-case behavior¶
- Agencies with no active offices contribute nothing to the aggregated result.
- The operation may still trigger one office query per agency when office collections were not preloaded.
Related documentation¶
Sources¶
Business\SAIF.Business.Policy.Agency\clsAgencyCollection.vbBusiness\SAIF.Business.Policy.Agency\clsAgencyOfficeCollection.vb