---
title: Establish the policy data layer
summary: Creates the Oracle policy portal and fixed database identity used by the application layer.
status: draft
owner: SAIF Documentation Generation
last_reviewed: 2026-07-31
library: SAIF.Application.Policy
reference_type: package
operation_id: OP-01
trigger: Framework initialization of PolicyAppManager
---

# Establish the policy data layer

This operation prepares the application-layer database context used by all subsequent policy retrievals.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-01 |
| **Trigger** | Framework initialization of `PolicyAppManager` |
| **Inputs** | Security principal and host-supplied portal configuration |
| **Outputs** | Initialized `Policy` portal, fixed `GEN` database identity, and reusable `DPI` |
| **Primary components** | `PolicyAppManager.OnInitialize`, `PolicyAppManager.OnCreateDataLayer` |
| **Entry point** | `Application\SAIF.Application.Policy\PolicyAppManager.vb` |

## Steps

1. Set `DataLayer.DBUser = "GEN"` for the policy portal ([BR-101](../business-rules.md#br-101-fixed-gen-database-user)).
2. Attempt to create the Oracle portal named `Policy`.
3. If portal creation fails, call `MarkContextNotSet()`, call `MarkNoAccess()`, and raise `ApplicationException("Unable to Establish Database Connection")` ([BR-102](../business-rules.md#br-102-failed-portal-creation-revokes-context-and-access)).
4. Expose the resulting portal through `DPI` so downstream retrieval and transaction logic can reuse it.

## Process flow

The following diagram visualizes the initialization flow.

```mermaid
flowchart TD
    Start([Manager initialization]) --> SetUser[Set DB user to GEN]
    SetUser --> Create[Create Oracle portal Policy]
    Create --> Ok{Created?}
    Ok -->|Yes| Done([Expose DPI])
    Ok -->|No| Fail([Mark no access and raise])
```

## Failure and edge-case behavior
- Missing or invalid portal configuration fails closed through [BR-102](../business-rules.md#br-102-failed-portal-creation-revokes-context-and-access).
- The fixed `GEN` identity applies to every caller of this library ([BR-101](../business-rules.md#br-101-fixed-gen-database-user)).

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

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