Build policy dropdown¶
When the policy dropdown is shown, the BolPolicyHeader view calls GetPolicyAssociationDropdown to produce the select list from the header associations.
| Field | Value |
|---|---|
| Operation ID | OP-13 |
| Trigger | BolPolicyHeader view rendering |
| Inputs | PolicyHeader with associations |
| Outputs | SelectList of policy numbers and labels |
| Primary components | HeaderExtensions.GetPolicyAssociationDropdown |
| Entry point | src/BolMiddleware/Extensions/HeaderExtensions.cs |
Steps¶
- Validate that the helper and header arguments are not null.
- Flatten the policies from every association into one list.
- Order the list by policy number descending (BR-BOLMIDDLEWARE-015).
- Move the policy that equals the header policy number to the first position.
- Add each policy to a dictionary keyed by policy number with the label
<number> - <name>. - If a policy number appears twice:
Dictionary.Addthrows anArgumentExceptionand the view fails. - Return a
SelectListover the dictionary. The view shows it only when the dropdown is allowed (BR-BOLMIDDLEWARE-012).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Render dropdown]) --> S1[Flatten associations]
S1 --> S2[Order by policy number descending]
S2 --> S3[Move current policy first]
S3 --> D1{Duplicate policy number?}
D1 -->|Yes| EndErr([ArgumentException])
D1 -->|No| EndOk([Return SelectList])
Failure and edge-case behavior¶
- Duplicate policy numbers across associations break rendering of the whole header.
Related documentation¶
- Index
- Overview
- Architecture
- Dependencies
- Configuration
- Operations and processes
- Business rules
- Security and authorization
- Service registration
- API reference
Sources¶
- src/BolMiddleware/Extensions/HeaderExtensions.cs
- src/BolMiddleware/Pages/Components/BolPolicyHeader/default.cshtml