﻿---
title: PolicyAppManager
summary: API reference for PolicyAppManager.
status: draft
owner: SAIF Documentation Generation
last_reviewed: 2026-07-31
library: SAIF.Application.Policy
reference_type: package
---

# PolicyAppManager

`PolicyAppManager` is the application-layer entry point for policy retrieval in this library. Consuming applications inherit from it to obtain a managed policy context, delegated policy authorization, Business Online access metadata, and the policy-header settings and data-provider surfaces used by downstream UI or workflow code.

## Purpose
- Own the lifecycle of the active policy context, including portal setup, policy-data retrieval, and authorization outcome management.
- Expose lower-layer policy, agency, and header collaborators through a single orchestrating API surface.
- Provide overridable factory points so consuming applications can customize policy-header or policy-data behavior without rewriting the orchestration flow.

## Context
- Namespace: `SAIF.Application.Policy`
- Assembly/package: `SAIF.Application.Policy`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Security` | `ReadOnly Property Security() As clsPolicySecurity` | Returns the local role-classification service for the current principal. |
| `UserCanAccessPolicy` | `ReadOnly Property UserCanAccessPolicy() As Boolean` | Gates per-policy authorization for `Retrieve`/`OnRetrieve`: delegates to `SAIF.Business.View.Policy.clsPolicySecurity.IsPolicyValidForUser` for web requests, but grants access unconditionally when `HttpContext.Current Is Nothing` ([BR-106](../../business-rules.md#br-106-policy-authorization-runs-only-in-web-context)). |
| `PolicyNumber` | `Property PolicyNumber() As Decimal` | Selects which policy the manager establishes context for; changing it (protected setter) invalidates the cached `PolicyData` so the next read re-retrieves the aggregate for the new number ([BR-104](../../business-rules.md#br-104-policy-data-is-cached-per-policy-number)). |
| `IsCombinationTotalsSelected` | `Property IsCombinationTotalsSelected() As Boolean` | Carries the caller's totals-selection preference into the header-settings flow. |
| `Policy` | `ReadOnly Property Policy As clsPolicy` | Backing policy aggregate (`SAIF.Business.Policy.Core.clsPolicy`) that downstream header, association, and financial computations read for the currently authorized policy context. |
| `PolicyData` | `ReadOnly Property PolicyData() As clsPolicyData` | View-layer aggregate whose validity gates `OnRetrieve`'s "policy not found" outcome ([BR-105](../../business-rules.md#br-105-invalid-policy-returns-policynotfound)); cached per policy number and re-retrieved with the manager's user access level whenever the number changes or `ReLoadPolicyData` is called ([BR-104](../../business-rules.md#br-104-policy-data-is-cached-per-policy-number)). |
| `ReLoadPolicyData` | `Sub ReLoadPolicyData()` | Forces a fresh policy-data retrieval for the current policy number. |
| `DepositOnHand` | `ReadOnly Property DepositOnHand As Decimal` | Delegates to `SAIF.Business.Policy.Premium.Billing.clsFinancialTransactionCollection.GetTotalDepositOnHand` to surface the policy's aggregated deposit-on-hand total. |
| `HasBusinessOnlineAccess` | `ReadOnly Property HasBusinessOnlineAccess() As Boolean` | Reports whether the policy has Business Online access through external accounts. |
| `LastLoginDate` | `ReadOnly Property LastLoginDate() As Date` | Exposes the latest external Business Online logon date found for the policy. |
| `BOAccessText` | `ReadOnly Property BOAccessText() As String` | Renders the internal-only Business Online access text for the current policy. |
| `UserType` | `ReadOnly Property UserType() As clsUserType` | Exposes the cached SAIF user-type classification for the current principal. |
| `UserAccessLevel` | `ReadOnly Property UserAccessLevel() As clsPolicyData.UserAccessLevels` | Exposes the delegated view-layer access-level value used during policy-data retrieval. |
| `DPI` | `ReadOnly Property DPI() As SAIF.Framework.IDataPortalInfo` | Oracle data portal (`DataLayer.DPI("Policy")`) established in `OnCreateDataLayer`/`OnInitialize` under the fixed `GEN` database account ([BR-101](../../business-rules.md#br-101-fixed-gen-database-user)); every downstream policy, header, and association retrieval call uses this portal. |
| `SelectedAssociationType` | `Property SelectedAssociationType As IPolicyAssociationType` | Carries the current header association-type selection between manager and settings/provider layers. |
| `PolicyHeaderSettings` | `ReadOnly Property PolicyHeaderSettings As IPolicyHeaderSettings` | Returns the header-settings object governing visibility, selection, and diagnostic flags. |
| `PolicyHeaderDataProvider` | `ReadOnly Property PolicyHeaderDataProvider As IPolicyHeaderDataProvider` | Returns the provider that composes the rendered policy-header payload. |

## Behavioral notes
- The class is read-only from the caller's perspective because the write path always returns false.
- Authorization is split between local role classification and delegated per-policy authorization.

## Constraints and usage notes
- Concrete applications consume this type through inheritance rather than direct instantiation.

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