Filter associations and select the default¶
This operation narrows the policy-header association set to the rows the current principal may see and chooses the default association type used by the header.
| Field | Value |
|---|---|
| Operation ID | OP-06 |
| Trigger | Header associations are loaded or the selected association type is unset |
| Inputs | Policy-header associations, security principal, validated association types |
| Outputs | Filtered association rows and default association-type selection |
| Primary components | clsPolicyHeaderSecurityManager.FilterAssociationsByUserType, PolicyAppManager.GetDefaultAssociationType |
| Entry point | Application\SAIF.Application.Policy\PolicyHeader\clsPolicyHeaderSecurityManager.vb |
Steps¶
- Classify the principal as policyholder, agent, or neither.
- If the principal is neither a policyholder nor an agent, return the incoming associations unchanged (BR-113).
- Resolve the caller's user number and convert it to
Decimal. - If conversion fails, raise
ApplicationException("Unable to determine user number.")(BR-114). - For policyholders, collect the association types where the user's own policy is the parent and keep only rows of those types (BR-115).
- For agents, keep only rows whose
AgentNumberorAgencySeqNummatches the user's number (BR-116). - When the header needs a default association type, keep only rows whose types survive both
AssociationTypeTargetsandValidatedAssociationTypes, then select the lowestSortOrdertype. - If no association survives both filters, return
clsUnknownAssociationTypeCodeinstead of throwing (BR-117).
Process flow¶
The following diagram visualizes ownership filtering and default selection.
flowchart TD
Start([Associations loaded]) --> Role{Policyholder or agent?}
Role -->|Neither| All[Return all rows]
Role -->|Yes| UserNo[Resolve numeric user number]
UserNo --> Convert{Numeric?}
Convert -->|No| Fail([Raise exception])
Convert -->|Yes| Branch{Policyholder or agent?}
Branch -->|Policyholder| PH[Keep parented association types]
Branch -->|Agent| AG[Keep matching agent or agency rows]
PH --> Default[Choose lowest-sort-order type]
AG --> Default
All --> Default
Default --> Done([Return filtered rows and default type])
Failure and edge-case behavior¶
- User-number conversion fails closed through BR-114.
- Empty post-filter results fall back to
clsUnknownAssociationTypeCoderather than surfacing an invalid-operation exception (BR-117).
Related documentation¶
Sources¶
Application\SAIF.Application.Policy\PolicyAppManager.vbApplication\SAIF.Application.Policy\PolicyHeader\clsPolicyHeaderSecurityManager.vb