---
title: Build the policy header settings
summary: Constructs the standard policy-header settings object and initializes its security-sensitive display state.
status: draft
owner: SAIF Documentation Generation
last_reviewed: 2026-07-31
library: SAIF.Application.Policy
reference_type: package
operation_id: OP-04
trigger: First read of PolicyHeaderSettings
---

# Build the policy header settings

This operation constructs the standard header-settings object that governs association-type visibility, selected association state, demo-mode behavior, and non-production diagnostics.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-04 |
| **Trigger** | First read of `PolicyHeaderSettings` |
| **Inputs** | `DPI`, security principal, selected association type, totals-selection state |
| **Outputs** | Initialized `IPolicyHeaderSettings` implementation |
| **Primary components** | `PolicyAppManager.PolicyHeaderSettings`, `GetPolicyHeaderSettings`, `clsStandardPolicyHeaderSettings` |
| **Entry point** | `Application\SAIF.Application.Policy\PolicyAppManager.vb` |

## Steps

1. Construct `clsStandardPolicyHeaderSettings(DPI, SecurityPrincipal)` through the overridable `GetPolicyHeaderSettings()` factory.
2. Push the manager's totals-selection state into the settings object.
3. If no association type has been selected, compute the default association type from the currently available header associations ([BR-117](../business-rules.md#br-117-default-association-type-is-lowest-sort-order)).
4. Load the candidate association-type target set from `clsAssociationTypeCodeCollection.GetAssociationTypeCodes(DPI)` and keep only rows marked `IsDefaultPolicyHeaderType` ([BR-110](../business-rules.md#br-110-only-default-header-association-types-are-candidates)).
5. Resolve the principal's validated association types and cache them per user name.
6. Evaluate `IsTestInformationViewable` from `Not AppGlobal.EnvironmentService.IsProduction` ([BR-111](../business-rules.md#br-111-test-information-is-hidden-in-production)).
7. Evaluate `DemoMode` from `clsUserType(SecurityPrincipal).IsDemoUser`.

## Process flow

The following diagram visualizes header-settings construction.

```mermaid
flowchart TD
    Start([Header settings requested]) --> Create[Construct clsStandardPolicyHeaderSettings]
    Create --> Targets[Load default header association types]
    Targets --> Validated[Resolve validated association types]
    Validated --> Default{Selected type already set?}
    Default -->|No| Pick[Pick default association type]
    Default -->|Yes| Flags[Evaluate demo and test-information flags]
    Pick --> Flags
    Flags --> Done([Return settings])
```

## Failure and edge-case behavior
- Per-user association-type security is cached for the process lifetime.*
- Test-information visibility depends entirely on the host's environment-service implementation.**

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Security and authorization](../security-authorization.md)
- [Configuration](../configuration.md)

## Sources
- `Application\SAIF.Application.Policy\PolicyAppManager.vb`
- `Application\SAIF.Application.Policy\PolicyHeader\clsStandardPolicyHeaderSettings.vb`
