Skip to content

Lazy retrieval of policy detail and indicators

Defers a set of expensive per-policy lookups (waiver existence, extended detail record, secondary status, coverage-bound flag, information-page-printed flag, coverage gaps) until the corresponding property is first read, rather than loading them during GetPolicyData.

Field Value
Operation ID op-02-lazy-retrieve-policy-detail
Trigger Consumer reads a detail-backed property (e.g. HasWaiver, a detail field, GetCoverageBoundFlag, IsInformationPagePrinted)
Inputs Policy number (from the already-retrieved clsPolicyData)
Outputs Detail fields, flags
Primary components LazyRead, RetrieveHasWaiver, RetrievePolicyDetail/FillDetail, GetSecondaryPolicyStatus, GetCoverageBoundFlag, IsInformationPagePrinted
Entry point SAIF.Business.View.Policy/clsPolicyData.vb

Steps

  1. A property getter (there are ~10 detail-backed properties in clsPolicyData) calls LazyRead(LazyReadRequest.PolicyDetail) or LazyRead(LazyReadRequest.HasWaiver) before returning its backing field.
  2. LazyRead dispatches on the request type:
  3. HasWaiver → RetrieveHasWaiver() (no exception handling — a failure here propagates to the caller).
  4. PolicyDetail → RetrievePolicyDetail(), wrapped in a Try/Catch that silently swallows all exceptions (BR-VP-026).
  5. RetrieveHasWaiver: guarded by m_WaiverRead (read-once flag); opens a portal request, sets CommandType = StoredProcedure, RequestType = Scalar, SQLStatement = MyCriteria.HasWaiverSQL (SQL-012, procedure Pk82033_ThirdParty.get_policy_waiver_count), binds PolicyNum and a WaiverCount return-value parameter, processes the request, and casts the return value to Boolean via CBool.
  6. RetrievePolicyDetail: guarded by m_PolicyDetailRead; opens a portal request with RequestType = Reader, SQLStatement = MyCriteria.RetrieveDetailSQL (SQL-011, procedure pk72846_view_policy.getviewdetail), binds apolicynum and a cursor parameter, and sets AfterRequestMethod = AddressOf FillDetail so the framework invokes FillDetail once the request completes.
  7. FillDetail reads the first row (if the reader is not closed) and hydrates ~20 detail fields (m_ChapterCode, m_ComboWrapSubFlag, m_CurrentBalance, date fields converted via clsSmartDate, m_NaicsCode/m_NaicsDescr, m_SicCode, etc.) directly from named reader columns.
  8. GetSecondaryPolicyStatus (invoked by another lazily-backed property, not gated by a LazyRead flag) executes MyCriteria.GetSecondaryPolicyStatusSQL (SQL-015) as CommandType.Text/Scalar, binding in_policy_num, and trims the scalar result — an empty string if the result is null.
  9. GetCoverageBoundFlag only runs its query if PolicyPeriods.Count > 0 (short-circuits otherwise). It executes MyCriteria.GetCoverageBoundFlagSQL (SQL-016) as Text/Scalar, binding in_policy_num and in_policy_period_eff_date from GetCurrentPolicyPeriod().PolicyPeriodEffDate (see Retrieve policy periods), and returns True only if the trimmed result equals "Y".
  10. IsInformationPagePrinted(policyNum, effDate) executes MyCriteria.GetIsInformationPagePrintedSQL (SQL-017, procedure SP72347_INFO_PAGE_PRINTED_YN) as CommandType.StoredProcedure/Scalar, binding in_policy_num, in_policy_period_eff_date, and an out_flag return-value parameter; returns True only if the flag equals "Y".
  11. Coverage gaps (SQL-018, procedure pk72846_view_policy.getgaps) are exposed through a similarly lazily-triggered accessor that was not directly located in this pass — cross-referenced from the hub catalog only.**

Process flow

flowchart TD
    Start(["Property getter reads<br>a detail-backed field"]) --> A["LazyRead dispatches<br>on request type"]
    A -->|HasWaiver| B["RetrieveHasWaiver:<br>scalar query, get_policy_waiver_count"]
    A -->|PolicyDetail| C["RetrievePolicyDetail:<br>reader query, getviewdetail"]
    B --> D["m_Waiver flag set,<br>m_WaiverRead = True"]
    C --> E{Try succeeds?}
    E -->|Yes| F["FillDetail hydrates<br>detail fields"]
    E -->|No| G["Exception swallowed,<br>fields remain default"]
    F --> H["m_PolicyDetailRead = True"]
    G --> H
    D --> End(["Return requested field"])
    H --> End

Failure and edge-case behavior

  • RetrievePolicyDetail failures are caught and discarded — the caller sees default field values with no indication a read failed (BR-VP-026).
  • RetrieveHasWaiver has no exception handling — a data-access failure propagates directly to the caller of the HasWaiver-backed property.*
  • Both m_WaiverRead and m_PolicyDetailRead are read-once flags: a caught exception in RetrievePolicyDetail still sets m_PolicyDetailRead = True, so a transient failure is never retried on a subsequent property read within the same object instance.*
  • GetCoverageBoundFlag returns False (not unknown) when PolicyPeriods.Count = 0, which is indistinguishable from a genuine "not bound" result.*

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.

Sources

  • SAIF.Business.View.Policy/clsPolicyData.vb